mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 05:00:16 +00:00
editor: Update insert_text_format based on resolved completion (#13041)
Fixes #12920 VTSLS does not mark snippet completions as such in the initial completion response - not until we resolve them; however, we do not touch initial contents of completion during resolution, which led to us not treating a snippet as such. Release Notes: - Fixed snippet completions sometimes being treated as plain text completions when using VTSLS
This commit is contained in:
parent
eb7a09b459
commit
dcb8dc16ca
1 changed files with 11 additions and 3 deletions
|
@ -59,9 +59,9 @@ use language::{
|
||||||
use log::error;
|
use log::error;
|
||||||
use lsp::{
|
use lsp::{
|
||||||
CompletionContext, DiagnosticSeverity, DiagnosticTag, DidChangeWatchedFilesRegistrationOptions,
|
CompletionContext, DiagnosticSeverity, DiagnosticTag, DidChangeWatchedFilesRegistrationOptions,
|
||||||
DocumentHighlightKind, Edit, FileSystemWatcher, LanguageServer, LanguageServerBinary,
|
DocumentHighlightKind, Edit, FileSystemWatcher, InsertTextFormat, LanguageServer,
|
||||||
LanguageServerId, LspRequestFuture, MessageActionItem, OneOf, ServerCapabilities,
|
LanguageServerBinary, LanguageServerId, LspRequestFuture, MessageActionItem, OneOf,
|
||||||
ServerHealthStatus, ServerStatus, TextEdit, Uri,
|
ServerCapabilities, ServerHealthStatus, ServerStatus, TextEdit, Uri,
|
||||||
};
|
};
|
||||||
use lsp_command::*;
|
use lsp_command::*;
|
||||||
use node_runtime::NodeRuntime;
|
use node_runtime::NodeRuntime;
|
||||||
|
@ -6134,6 +6134,14 @@ impl Project {
|
||||||
completion.old_range = old_range;
|
completion.old_range = old_range;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if completion_item.insert_text_format == Some(InsertTextFormat::SNIPPET) {
|
||||||
|
// vtsls might change the type of completion after resolution.
|
||||||
|
let mut completions = completions.write();
|
||||||
|
let completion = &mut completions[completion_index];
|
||||||
|
if completion_item.insert_text_format != completion.lsp_completion.insert_text_format {
|
||||||
|
completion.lsp_completion.insert_text_format = completion_item.insert_text_format;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
|
Loading…
Reference in a new issue