diff options
author | Kirill Bulatov <[email protected]> | 2020-12-02 22:13:32 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-12-07 21:41:08 +0000 |
commit | 50e06ee95ab12bc204fdce557ab0fb7aa5e5ab2f (patch) | |
tree | 84288818104bab46ac52a60e6e0d4ba4624ab817 /crates/completion/src/config.rs | |
parent | d9bd1f171dde11ff04f0619b14d8f25e5e4fc56e (diff) |
Refactor the code
Diffstat (limited to 'crates/completion/src/config.rs')
-rw-r--r-- | crates/completion/src/config.rs | 9 |
1 files changed, 8 insertions, 1 deletions
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 { | |||
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 | pub resolve_capabilities: FxHashSet<CompletionResolveCapability>, | 19 | pub resolve_capabilities: FxHashSet<CompletionResolveCapability>, |
19 | } | 20 | } |
20 | 21 | ||
22 | /// A resolve capability, supported on a server. | ||
23 | /// If the client registers any of those in its completion resolve capabilities, | ||
24 | /// the server is able to render completion items' corresponding fields later, | ||
25 | /// not during an initial completion item request. | ||
26 | /// See https://github.com/rust-analyzer/rust-analyzer/issues/6366 for more details. | ||
21 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] | 27 | #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] |
22 | pub enum CompletionResolveCapability { | 28 | pub enum CompletionResolveCapability { |
23 | Documentation, | 29 | Documentation, |
@@ -30,7 +36,8 @@ impl CompletionConfig { | |||
30 | self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None } | 36 | self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None } |
31 | } | 37 | } |
32 | 38 | ||
33 | pub fn should_resolve_immediately(&self) -> bool { | 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 { | ||
34 | !self.resolve_capabilities.contains(&CompletionResolveCapability::AdditionalTextEdits) | 41 | !self.resolve_capabilities.contains(&CompletionResolveCapability::AdditionalTextEdits) |
35 | } | 42 | } |
36 | } | 43 | } |