zed_extension_api: Return structured slash command completions (#13879)
This PR updates the extension API to use structured slash command completions instead of plain strings. This allows slash commands defined in extensions to take advantage of the improvements made in #13876. Release Notes: - N/A
This commit is contained in:
parent
950e7e5414
commit
61e4b6413a
6 changed files with 39 additions and 15 deletions
|
@ -63,9 +63,9 @@ impl SlashCommand for ExtensionSlashCommand {
|
|||
completions
|
||||
.into_iter()
|
||||
.map(|completion| ArgumentCompletion {
|
||||
label: completion.clone(),
|
||||
new_text: completion,
|
||||
run_command: true,
|
||||
label: completion.label,
|
||||
new_text: completion.new_text,
|
||||
run_command: completion.run_command,
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
|
|
|
@ -20,7 +20,7 @@ use wasmtime::{
|
|||
pub use latest::CodeLabelSpanLiteral;
|
||||
pub use latest::{
|
||||
zed::extension::lsp::{Completion, CompletionKind, InsertTextFormat, Symbol, SymbolKind},
|
||||
zed::extension::slash_command::SlashCommandOutput,
|
||||
zed::extension::slash_command::{SlashCommandArgumentCompletion, SlashCommandOutput},
|
||||
CodeLabel, CodeLabelSpan, Command, Range, SlashCommand,
|
||||
};
|
||||
pub use since_v0_0_4::LanguageServerConfig;
|
||||
|
@ -263,7 +263,7 @@ impl Extension {
|
|||
store: &mut Store<WasmState>,
|
||||
command: &SlashCommand,
|
||||
query: &str,
|
||||
) -> Result<Result<Vec<String>, String>> {
|
||||
) -> Result<Result<Vec<SlashCommandArgumentCompletion>, String>> {
|
||||
match self {
|
||||
Extension::V007(ext) => {
|
||||
ext.call_complete_slash_command_argument(store, command, query)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue