diff options
Diffstat (limited to 'crates/completion/src/config.rs')
-rw-r--r-- | crates/completion/src/config.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index f2fa5c27b..eacdd3449 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs | |||
@@ -15,12 +15,12 @@ pub struct CompletionConfig { | |||
15 | pub add_call_argument_snippets: bool, | 15 | pub add_call_argument_snippets: bool, |
16 | pub snippet_cap: Option<SnippetCap>, | 16 | pub snippet_cap: Option<SnippetCap>, |
17 | pub merge: Option<MergeBehaviour>, | 17 | pub merge: Option<MergeBehaviour>, |
18 | /// A set of capabilities, enabled on the cliend and supported on the server. | 18 | /// A set of capabilities, enabled on the client and supported on the server. |
19 | pub resolve_capabilities: FxHashSet<CompletionResolveCapability>, | 19 | pub active_resolve_capabilities: FxHashSet<CompletionResolveCapability>, |
20 | } | 20 | } |
21 | 21 | ||
22 | /// A resolve capability, supported on a server. | 22 | /// A resolve capability, supported on the server. |
23 | /// If the client registers any of those in its completion resolve capabilities, | 23 | /// If the client registers any completion resolve capabilities, |
24 | /// the server is able to render completion items' corresponding fields later, | 24 | /// the server is able to render completion items' corresponding fields later, |
25 | /// not during an initial completion item request. | 25 | /// not during an initial completion item request. |
26 | /// See https://github.com/rust-analyzer/rust-analyzer/issues/6366 for more details. | 26 | /// See https://github.com/rust-analyzer/rust-analyzer/issues/6366 for more details. |
@@ -37,8 +37,11 @@ impl CompletionConfig { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | /// Whether the completions' additional edits are calculated later, during a resolve request or not. | 39 | /// Whether the completions' additional edits are calculated later, during a resolve request or not. |
40 | pub fn should_resolve_additional_edits_immediately(&self) -> bool { | 40 | /// See `CompletionResolveCapability` for the details. |
41 | !self.resolve_capabilities.contains(&CompletionResolveCapability::AdditionalTextEdits) | 41 | pub fn resolve_edits_immediately(&self) -> bool { |
42 | !self | ||
43 | .active_resolve_capabilities | ||
44 | .contains(&CompletionResolveCapability::AdditionalTextEdits) | ||
42 | } | 45 | } |
43 | } | 46 | } |
44 | 47 | ||
@@ -56,7 +59,7 @@ impl Default for CompletionConfig { | |||
56 | add_call_argument_snippets: true, | 59 | add_call_argument_snippets: true, |
57 | snippet_cap: Some(SnippetCap { _private: () }), | 60 | snippet_cap: Some(SnippetCap { _private: () }), |
58 | merge: Some(MergeBehaviour::Full), | 61 | merge: Some(MergeBehaviour::Full), |
59 | resolve_capabilities: FxHashSet::default(), | 62 | active_resolve_capabilities: FxHashSet::default(), |
60 | } | 63 | } |
61 | } | 64 | } |
62 | } | 65 | } |