mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Merge #4117
4117: Honor snippet capability r=matklad a=matklad closes #2518 bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
7410cfad21
@ -12,6 +12,12 @@ pub struct CompletionConfig {
|
|||||||
pub snippet_cap: Option<SnippetCap>,
|
pub snippet_cap: Option<SnippetCap>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl CompletionConfig {
|
||||||
|
pub fn allow_snippets(&mut self, yes: bool) {
|
||||||
|
self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
pub struct SnippetCap {
|
pub struct SnippetCap {
|
||||||
_private: (),
|
_private: (),
|
||||||
|
@ -215,5 +215,13 @@ impl Config {
|
|||||||
if let Some(value) = caps.folding_range.as_ref().and_then(|it| it.line_folding_only) {
|
if let Some(value) = caps.folding_range.as_ref().and_then(|it| it.line_folding_only) {
|
||||||
self.client_caps.line_folding_only = value
|
self.client_caps.line_folding_only = value
|
||||||
}
|
}
|
||||||
|
self.completion.allow_snippets(false);
|
||||||
|
if let Some(completion) = &caps.completion {
|
||||||
|
if let Some(completion_item) = &completion.completion_item {
|
||||||
|
if let Some(value) = completion_item.snippet_support {
|
||||||
|
self.completion.allow_snippets(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user