diff options
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 12 |
1 files changed, 7 insertions, 5 deletions
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<PathBuf>, } #[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 `{}` {{ {} }}", |