From 9fe3adcff9866ef18953a067fbc0b84e7eb968b5 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Fri, 31 Mar 2023 04:26:20 +0200 Subject: add option to enable/disable lsp snippets --- helix-view/src/editor.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'helix-view/src/editor.rs') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 727e1261..34c59b9b 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -352,6 +352,8 @@ pub struct LspConfig { pub display_signature_help_docs: bool, /// Display inlay hints pub display_inlay_hints: bool, + /// Whether to enable snippet support + pub snippets: bool, } impl Default for LspConfig { @@ -362,6 +364,7 @@ impl Default for LspConfig { auto_signature_help: true, display_signature_help_docs: true, display_inlay_hints: false, + snippets: true, } } } @@ -1092,12 +1095,13 @@ impl Editor { // if doc doesn't have a URL it's a scratch buffer, ignore it let doc = self.document(doc_id)?; let (lang, path) = (doc.language.clone(), doc.path().cloned()); - let root_dirs = &doc.config.load().workspace_lsp_roots; + let config = doc.config.load(); + let root_dirs = &config.workspace_lsp_roots; // try to find a language server based on the language name let language_server = lang.as_ref().and_then(|language| { self.language_servers - .get(language, path.as_ref(), root_dirs) + .get(language, path.as_ref(), root_dirs, config.lsp.snippets) .map_err(|e| { log::error!( "Failed to initialize the LSP for `{}` {{ {} }}", -- cgit v1.2.3-70-g09d2