From 50e06ee95ab12bc204fdce557ab0fb7aa5e5ab2f Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Thu, 3 Dec 2020 00:13:32 +0200 Subject: Refactor the code --- crates/completion/src/config.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates/completion/src/config.rs') diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index e9a02aeb8..f2fa5c27b 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs @@ -15,9 +15,15 @@ pub struct CompletionConfig { pub add_call_argument_snippets: bool, pub snippet_cap: Option, pub merge: Option, + /// A set of capabilities, enabled on the cliend and supported on the server. pub resolve_capabilities: FxHashSet, } +/// A resolve capability, supported on a server. +/// If the client registers any of those in its completion resolve capabilities, +/// the server is able to render completion items' corresponding fields later, +/// not during an initial completion item request. +/// See https://github.com/rust-analyzer/rust-analyzer/issues/6366 for more details. #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] pub enum CompletionResolveCapability { Documentation, @@ -30,7 +36,8 @@ impl CompletionConfig { self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None } } - pub fn should_resolve_immediately(&self) -> bool { + /// Whether the completions' additional edits are calculated later, during a resolve request or not. + pub fn should_resolve_additional_edits_immediately(&self) -> bool { !self.resolve_capabilities.contains(&CompletionResolveCapability::AdditionalTextEdits) } } -- cgit v1.2.3