diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-24 01:45:34 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-24 01:45:34 +0100 |
commit | 7410cfad215d7ffe503566f08fce7164218201e2 (patch) | |
tree | cb11bd3002dd5bc2ecadb3449d4f5a5eb0d55aad /crates | |
parent | 3a0a7081f4db293599bce5fab124cf258a946cb2 (diff) | |
parent | 440cd05edbe917ac33d5290fb35aa06f2f90cea2 (diff) |
Merge #4117
4117: Honor snippet capability r=matklad a=matklad
closes #2518
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_ide/src/completion/completion_config.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/completion_config.rs b/crates/ra_ide/src/completion/completion_config.rs index 6cf7ed6e4..71b49ace8 100644 --- a/crates/ra_ide/src/completion/completion_config.rs +++ b/crates/ra_ide/src/completion/completion_config.rs | |||
@@ -12,6 +12,12 @@ pub struct CompletionConfig { | |||
12 | pub snippet_cap: Option<SnippetCap>, | 12 | pub snippet_cap: Option<SnippetCap>, |
13 | } | 13 | } |
14 | 14 | ||
15 | impl CompletionConfig { | ||
16 | pub fn allow_snippets(&mut self, yes: bool) { | ||
17 | self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None } | ||
18 | } | ||
19 | } | ||
20 | |||
15 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] | 21 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
16 | pub struct SnippetCap { | 22 | pub struct SnippetCap { |
17 | _private: (), | 23 | _private: (), |
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 33d7c95a8..715eddadb 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -215,5 +215,13 @@ impl Config { | |||
215 | if let Some(value) = caps.folding_range.as_ref().and_then(|it| it.line_folding_only) { | 215 | if let Some(value) = caps.folding_range.as_ref().and_then(|it| it.line_folding_only) { |
216 | self.client_caps.line_folding_only = value | 216 | self.client_caps.line_folding_only = value |
217 | } | 217 | } |
218 | self.completion.allow_snippets(false); | ||
219 | if let Some(completion) = &caps.completion { | ||
220 | if let Some(completion_item) = &completion.completion_item { | ||
221 | if let Some(value) = completion_item.snippet_support { | ||
222 | self.completion.allow_snippets(value); | ||
223 | } | ||
224 | } | ||
225 | } | ||
218 | } | 226 | } |
219 | } | 227 | } |