diff options
author | Nathan Vegdahl | 2021-07-17 17:49:03 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-17 17:49:03 +0000 |
commit | a77274e8bb33ff08f5411ec4df168b576c0c8fa5 (patch) | |
tree | 1a1c3735e1f9ea46e87f7fe60b1f81fdb2e5df5b /helix-core | |
parent | b4c59b444cc4963f95a95fe10f166e58ef857288 (diff) | |
parent | 6cba62b49917fde7c5876a1cce9d3883c6bef6c9 (diff) |
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-core')
-rw-r--r-- | helix-core/Cargo.toml | 2 | ||||
-rw-r--r-- | helix-core/src/indent.rs | 4 | ||||
-rw-r--r-- | helix-core/src/syntax.rs | 16 |
3 files changed, 11 insertions, 11 deletions
diff --git a/helix-core/Cargo.toml b/helix-core/Cargo.toml index 80d559a9..634c4d9f 100644 --- a/helix-core/Cargo.toml +++ b/helix-core/Cargo.toml @@ -19,7 +19,7 @@ helix-syntax = { version = "0.3", path = "../helix-syntax" } ropey = "1.3" smallvec = "1.4" tendril = "0.4.2" -unicode-segmentation = "1.7" +unicode-segmentation = "1.8" unicode-width = "0.1" unicode-general-category = "0.4" # slab = "0.4.2" diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs index 81bdffc0..1b36db7b 100644 --- a/helix-core/src/indent.rs +++ b/helix-core/src/indent.rs @@ -253,14 +253,14 @@ where let doc = Rope::from(doc); use crate::syntax::{ - Configuration, IndentationConfiguration, Lang, LanguageConfiguration, Loader, + Configuration, IndentationConfiguration, LanguageConfiguration, Loader, }; use once_cell::sync::OnceCell; let loader = Loader::new(Configuration { language: vec![LanguageConfiguration { scope: "source.rust".to_string(), file_types: vec!["rs".to_string()], - language_id: Lang::Rust, + language_id: "Rust".to_string(), highlight_config: OnceCell::new(), // roots: vec![], diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 84a5f9bd..d9bfc16f 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -5,7 +5,7 @@ use crate::{ Rope, RopeSlice, Tendril, }; -pub use helix_syntax::{get_language, get_language_name, Lang}; +pub use helix_syntax::get_language; use arc_swap::ArcSwap; @@ -31,7 +31,7 @@ pub struct Configuration { #[serde(rename_all = "kebab-case")] pub struct LanguageConfiguration { #[serde(rename = "name")] - pub(crate) language_id: Lang, + pub(crate) language_id: String, pub scope: String, // source.rust pub file_types: Vec<String>, // filename ends_with? <Gemfile, rb, etc> pub roots: Vec<String>, // these indicate project roots <.git, Cargo.toml> @@ -153,7 +153,7 @@ fn read_query(language: &str, filename: &str) -> String { impl LanguageConfiguration { fn initialize_highlight(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> { - let language = get_language_name(self.language_id).to_ascii_lowercase(); + let language = self.language_id.to_ascii_lowercase(); let highlights_query = read_query(&language, "highlights.scm"); // always highlight syntax errors @@ -161,17 +161,17 @@ impl LanguageConfiguration { let injections_query = read_query(&language, "injections.scm"); - let locals_query = ""; + let locals_query = read_query(&language, "locals.scm"); if highlights_query.is_empty() { None } else { - let language = get_language(self.language_id); + let language = get_language(&crate::RUNTIME_DIR, &self.language_id).ok()?; let config = HighlightConfiguration::new( language, &highlights_query, &injections_query, - locals_query, + &locals_query, ) .unwrap(); // TODO: no unwrap config.configure(scopes); @@ -198,7 +198,7 @@ impl LanguageConfiguration { pub fn indent_query(&self) -> Option<&IndentQuery> { self.indent_query .get_or_init(|| { - let language = get_language_name(self.language_id).to_ascii_lowercase(); + let language = self.language_id.to_ascii_lowercase(); let toml = load_runtime_file(&language, "indents.toml").ok()?; toml::from_slice(toml.as_bytes()).ok() @@ -1812,7 +1812,7 @@ mod test { .map(String::from) .collect(); - let language = get_language(Lang::Rust); + let language = get_language(&crate::RUNTIME_DIR, "Rust").unwrap(); let config = HighlightConfiguration::new( language, &std::fs::read_to_string( |