From 2d10a429ebf7abe5af184b6227346377dc0523e8 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 31 Jan 2023 00:31:21 +0100 Subject: add workspace config and manual LSP root management fixup documentation Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> fixup typo Co-authored-by: LeoniePhiline <22329650+LeoniePhiline@users.noreply.github.com> --- helix-view/src/editor.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'helix-view/src') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index c939aa5c..727e1261 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -282,6 +282,8 @@ pub struct Config { /// Whether to color modes with different colors. Defaults to `false`. pub color_modes: bool, pub soft_wrap: SoftWrap, + /// Workspace specific lsp ceiling dirs + pub workspace_lsp_roots: Vec, } #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -747,6 +749,7 @@ impl Default for Config { soft_wrap: SoftWrap::default(), text_width: 80, completion_replace: false, + workspace_lsp_roots: Vec::new(), } } } @@ -1087,15 +1090,14 @@ impl Editor { } // if doc doesn't have a URL it's a scratch buffer, ignore it - let (lang, path) = { - let doc = self.document(doc_id)?; - (doc.language.clone(), doc.path().cloned()) - }; + let doc = self.document(doc_id)?; + let (lang, path) = (doc.language.clone(), doc.path().cloned()); + let root_dirs = &doc.config.load().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()) + .get(language, path.as_ref(), root_dirs) .map_err(|e| { log::error!( "Failed to initialize the LSP for `{}` {{ {} }}", -- cgit v1.2.3-70-g09d2