on master help sign in
Add c++, js, css, html language definitions.
commit3bab640491be6c065e7cf11672f49a1b41c15e99 authorBlaž Hrastnik <blaz@mxxn.io> dateWed 7 Apr 2021, 13:40 (6 years ago) parent463f58d
4 files changed+48−8
helix-syntax/build.rs+1−4 helix-syntax/src/lib.rs+1−1 languages.toml+41 theme.toml+5−3
helix-syntax/build.rs+1−4
@@ -107,10 +107,7 @@ fn build_dir(dir: &str, language: &str) {
107107}
108108
109109fn main() {
110− let ignore = vec![
111− "tree-sitter-typescript".to_string(),
112− "tree-sitter-cpp".to_string(),
113− ];
110+ let ignore = vec!["tree-sitter-typescript".to_string()];
114111 let dirs = collect_tree_sitter_dirs(&ignore);
115112
116113 let mut n_jobs = 0;
helix-syntax/src/lib.rs+1−1
@@ -70,7 +70,7 @@ mk_langs!(
7070 (Bash, tree_sitter_bash),
7171 (C, tree_sitter_c),
7272 (CSharp, tree_sitter_c_sharp),
73− // (Cpp, tree_sitter_cpp),
73+ (Cpp, tree_sitter_cpp),
7474 (Css, tree_sitter_css),
7575 (Go, tree_sitter_go),
7676 // (Haskell, tree_sitter_haskell),
languages.toml+41
@@ -18,3 +18,44 @@ roots = []
1818path = "../helix-syntax/languages/tree-sitter-toml"
1919
2020indent = { tab-width = 2, unit = " " }
21+
22+[[language]]
23+name = "cpp"
24+scope = "source.cpp"
25+injection-regex = "cpp"
26+file-types = ["cc", "cpp", "hpp", "h"]
27+roots = []
28+path = "../helix-syntax/languages/tree-sitter-cpp" # TODO: also C highlights
29+
30+indent = { tab-width = 2, unit = " " }
31+
32+[[language]]
33+name = "javascript"
34+scope = "source.js"
35+injection-regex = "^(js|javascript)$"
36+file-types = ["js"]
37+roots = []
38+path = "../helix-syntax/languages/tree-sitter-javascript"
39+# TODO: highlights-jsx, highlights-params
40+
41+indent = { tab-width = 2, unit = " " }
42+
43+[[language]]
44+name = "css"
45+scope = "source.css"
46+injection-regex = "css"
47+file-types = ["css"]
48+roots = []
49+path = "../helix-syntax/languages/tree-sitter-css"
50+
51+indent = { tab-width = 2, unit = " " }
52+
53+[[language]]
54+name = "html"
55+scope = "text.html.basic"
56+injection-regex = "html"
57+file-types = ["html"]
58+roots = []
59+path = "../helix-syntax/languages/tree-sitter-html"
60+
61+indent = { tab-width = 2, unit = " " }
theme.toml+5−3
@@ -3,7 +3,8 @@
33"punctuation" = "#a4a0e8" # lavender
44"punctuation.delimiter" = "#a4a0e8" # lavender
55"operator" = "#dbbfef" # lilac
6−"property" = "#a4a0e8" # lavender
6+# "property" = "#a4a0e8" # lavender
7+"property" = "#ffffff" # white
78"variable.parameter" = "#a4a0e8" # lavender
89# TODO distinguish type from type.builtin?
910"type" = "#ffffff" # white
@@ -16,6 +17,7 @@
1617"constant" = "#ffffff" # white
1718"constant.builtin" = "#ffffff" # white
1819"string" = "#cccccc" # silver
20+"number" = "#e8dca0" # chamois
1921"escape" = "#efba5d" # honey
2022# used for lifetimes
2123"label" = "#efba5d" # honey
@@ -24,13 +26,13 @@
2426# TODO: diferentiate doc comment
2527# TODO: variable as lilac
2628# TODO: mod/use statements as white
27−# TODO: mod stuff as chamoise
29+# TODO: mod stuff as chamois
2830# TODO: add "(scoped_identifier) @path" for std::mem::
2931#
3032# concat (ERROR) @syntax-error and "MISSING ;" selectors for errors
3133
3234"module" = "#ff0000"
33−"variable" = "#ff0000"
35+"variable" = "#a4a0e8" # lavender
3436"function.builtin" = "#ff0000"
3537
3638"ui.background" = { bg = "#3b224c" } # midnight