diff options
author | Blaž Hrastnik | 2021-06-04 01:50:03 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-04 02:03:40 +0000 |
commit | 06d8d3f55fbf02bb4d938ecbc479cd60309a0a5d (patch) | |
tree | c47d95747397d3b5e00a8b57717b3fc5093646df /helix-core/src/syntax.rs | |
parent | 8afd4e1bc21c244a4ed241630a0e845f4ab81f74 (diff) |
Try to detect language when document file path is set
Fixes #91
Diffstat (limited to 'helix-core/src/syntax.rs')
-rw-r--r-- | helix-core/src/syntax.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index febbf821..ec95708b 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -166,13 +166,15 @@ pub struct Loader { // highlight_names ? language_configs: Vec<Arc<LanguageConfiguration>>, language_config_ids_by_file_type: HashMap<String, usize>, // Vec<usize> + scopes: Vec<String>, } impl Loader { - pub fn new(config: Configuration) -> Self { + pub fn new(config: Configuration, scopes: Vec<String>) -> Self { let mut loader = Self { language_configs: Vec::new(), language_config_ids_by_file_type: HashMap::new(), + scopes, }; for config in config.language { @@ -192,6 +194,10 @@ impl Loader { loader } + pub fn scopes(&self) -> &[String] { + &self.scopes + } + pub fn language_config_for_file_name(&self, path: &Path) -> Option<Arc<LanguageConfiguration>> { // Find all the language configurations that match this file name // or a suffix of the file name. |