aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/completion/completion_config.rs6
-rw-r--r--crates/rust-analyzer/src/config.rs8
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
15impl 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)]
16pub struct SnippetCap { 22pub 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}