Add c++, js, css, html language definitions.

This commit is contained in:
Blaž Hrastnik 2021-04-07 13:40:20 +09:00
parent 463f58dfda
commit 3bab640491
4 changed files with 48 additions and 8 deletions

View file

@ -107,10 +107,7 @@ fn build_dir(dir: &str, language: &str) {
} }
fn main() { fn main() {
let ignore = vec![ let ignore = vec!["tree-sitter-typescript".to_string()];
"tree-sitter-typescript".to_string(),
"tree-sitter-cpp".to_string(),
];
let dirs = collect_tree_sitter_dirs(&ignore); let dirs = collect_tree_sitter_dirs(&ignore);
let mut n_jobs = 0; let mut n_jobs = 0;

View file

@ -70,7 +70,7 @@ mk_langs!(
(Bash, tree_sitter_bash), (Bash, tree_sitter_bash),
(C, tree_sitter_c), (C, tree_sitter_c),
(CSharp, tree_sitter_c_sharp), (CSharp, tree_sitter_c_sharp),
// (Cpp, tree_sitter_cpp), (Cpp, tree_sitter_cpp),
(Css, tree_sitter_css), (Css, tree_sitter_css),
(Go, tree_sitter_go), (Go, tree_sitter_go),
// (Haskell, tree_sitter_haskell), // (Haskell, tree_sitter_haskell),

View file

@ -18,3 +18,44 @@ roots = []
path = "../helix-syntax/languages/tree-sitter-toml" path = "../helix-syntax/languages/tree-sitter-toml"
indent = { tab-width = 2, unit = " " } indent = { tab-width = 2, unit = " " }
[[language]]
name = "cpp"
scope = "source.cpp"
injection-regex = "cpp"
file-types = ["cc", "cpp", "hpp", "h"]
roots = []
path = "../helix-syntax/languages/tree-sitter-cpp" # TODO: also C highlights
indent = { tab-width = 2, unit = " " }
[[language]]
name = "javascript"
scope = "source.js"
injection-regex = "^(js|javascript)$"
file-types = ["js"]
roots = []
path = "../helix-syntax/languages/tree-sitter-javascript"
# TODO: highlights-jsx, highlights-params
indent = { tab-width = 2, unit = " " }
[[language]]
name = "css"
scope = "source.css"
injection-regex = "css"
file-types = ["css"]
roots = []
path = "../helix-syntax/languages/tree-sitter-css"
indent = { tab-width = 2, unit = " " }
[[language]]
name = "html"
scope = "text.html.basic"
injection-regex = "html"
file-types = ["html"]
roots = []
path = "../helix-syntax/languages/tree-sitter-html"
indent = { tab-width = 2, unit = " " }

View file

@ -3,7 +3,8 @@
"punctuation" = "#a4a0e8" # lavender "punctuation" = "#a4a0e8" # lavender
"punctuation.delimiter" = "#a4a0e8" # lavender "punctuation.delimiter" = "#a4a0e8" # lavender
"operator" = "#dbbfef" # lilac "operator" = "#dbbfef" # lilac
"property" = "#a4a0e8" # lavender # "property" = "#a4a0e8" # lavender
"property" = "#ffffff" # white
"variable.parameter" = "#a4a0e8" # lavender "variable.parameter" = "#a4a0e8" # lavender
# TODO distinguish type from type.builtin? # TODO distinguish type from type.builtin?
"type" = "#ffffff" # white "type" = "#ffffff" # white
@ -16,6 +17,7 @@
"constant" = "#ffffff" # white "constant" = "#ffffff" # white
"constant.builtin" = "#ffffff" # white "constant.builtin" = "#ffffff" # white
"string" = "#cccccc" # silver "string" = "#cccccc" # silver
"number" = "#e8dca0" # chamois
"escape" = "#efba5d" # honey "escape" = "#efba5d" # honey
# used for lifetimes # used for lifetimes
"label" = "#efba5d" # honey "label" = "#efba5d" # honey
@ -24,13 +26,13 @@
# TODO: diferentiate doc comment # TODO: diferentiate doc comment
# TODO: variable as lilac # TODO: variable as lilac
# TODO: mod/use statements as white # TODO: mod/use statements as white
# TODO: mod stuff as chamoise # TODO: mod stuff as chamois
# TODO: add "(scoped_identifier) @path" for std::mem:: # TODO: add "(scoped_identifier) @path" for std::mem::
# #
# concat (ERROR) @syntax-error and "MISSING ;" selectors for errors # concat (ERROR) @syntax-error and "MISSING ;" selectors for errors
"module" = "#ff0000" "module" = "#ff0000"
"variable" = "#ff0000" "variable" = "#a4a0e8" # lavender
"function.builtin" = "#ff0000" "function.builtin" = "#ff0000"
"ui.background" = { bg = "#3b224c" } # midnight "ui.background" = { bg = "#3b224c" } # midnight