1use std::path::{Path, PathBuf};
4use helix_core::syntax::Configuration as LangConfig;
5use helix_term::health::TsFeature;
7/// Get the list of languages that support a particular tree-sitter
9pub fn ts_lang_support(feat: TsFeature) -> Vec<String> {
10 let queries_dir = path::ts_queries();
12 find_files(&queries_dir, feat.runtime_filename())
15 // .../helix/runtime/queries/python/highlights.scm
16 let tail = f.strip_prefix(&queries_dir).unwrap(); // python/highlights.scm
17 let lang = tail.components().next().unwrap(); // python
18 lang.as_os_str().to_string_lossy().to_string()
23// naive implementation, but suffices for our needs
24pub fn find_files(dir: &Path, filename: &str) -> Vec<PathBuf> {
25 std::fs::read_dir(dir)
28 let path = entry.ok()?.path();
30 Some(find_files(&path, filename))
31 } else if path.file_name()?.to_string_lossy() == filename {
41pub fn lang_config() -> LangConfig {
42 let text = std::fs::read_to_string(path::lang_config()).unwrap();
43 toml::from_str(&text).unwrap()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list