diff options
author | Pascal Kuthe | 2023-01-30 23:31:21 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-03-29 03:57:30 +0000 |
commit | 2d10a429ebf7abe5af184b6227346377dc0523e8 (patch) | |
tree | 114b19f0031fc001d7798a31372675a94623262f /helix-view | |
parent | d59b80514e15d26f280a9b0dbd18afac08578638 (diff) |
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>
Diffstat (limited to 'helix-view')
-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 `{}` {{ {} }}", |