From bb87b08fc9677ddf0f083a2297c23c17144470e2 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sun, 14 Mar 2021 17:13:55 +0900 Subject: Configure language servers via LanguageConfiguration. --- helix-core/src/syntax.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'helix-core/src') diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 54aa78cf..499d91d1 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -11,20 +11,27 @@ use once_cell::sync::{Lazy, OnceCell}; // largely based on tree-sitter/cli/src/loader.rs pub struct LanguageConfiguration { - pub(crate) scope: String, // source.rust - pub(crate) file_types: Vec, // filename ends_with? + pub scope: String, // source.rust + pub file_types: Vec, // filename ends_with? + pub roots: Vec, // these indicate project roots <.git, Cargo.toml> - pub(crate) path: PathBuf, + pub path: PathBuf, + // root_path for tree-sitter (^) // content_regex // injection_regex // first_line_regex // - // root_path // pub(crate) language_id: Lang, pub(crate) highlight_config: OnceCell>>, // tags_config OnceCell<> https://github.com/tree-sitter/tree-sitter/pull/583 + pub language_server_config: Option, +} + +pub struct LanguageServerConfiguration { + pub command: String, + pub args: Vec, } impl LanguageConfiguration { @@ -90,6 +97,11 @@ impl Loader { highlight_config: OnceCell::new(), // path: "../helix-syntax/languages/tree-sitter-rust".into(), + roots: vec![], + language_server_config: Some(LanguageServerConfiguration { + command: "rust-analyzer".to_string(), + args: vec![], + }), }, LanguageConfiguration { scope: "source.toml".to_string(), @@ -98,6 +110,8 @@ impl Loader { highlight_config: OnceCell::new(), // path: "../helix-syntax/languages/tree-sitter-toml".into(), + roots: vec![], + language_server_config: None, }, ]; -- cgit v1.2.3-70-g09d2