From 3bab640491be6c065e7cf11672f49a1b41c15e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Wed, 7 Apr 2021 13:40:20 +0900 Subject: [PATCH] Add c++, js, css, html language definitions. --- helix-syntax/build.rs | 5 +---- helix-syntax/src/lib.rs | 2 +- languages.toml | 41 +++++++++++++++++++++++++++++++++++++++++ theme.toml | 8 +++++--- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/helix-syntax/build.rs b/helix-syntax/build.rs index ecf33dfe..009acbff 100644 --- a/helix-syntax/build.rs +++ b/helix-syntax/build.rs @@ -107,10 +107,7 @@ fn build_dir(dir: &str, language: &str) { } fn main() { - let ignore = vec![ - "tree-sitter-typescript".to_string(), - "tree-sitter-cpp".to_string(), - ]; + let ignore = vec!["tree-sitter-typescript".to_string()]; let dirs = collect_tree_sitter_dirs(&ignore); let mut n_jobs = 0; diff --git a/helix-syntax/src/lib.rs b/helix-syntax/src/lib.rs index 5d3e0d99..79c1c1f5 100644 --- a/helix-syntax/src/lib.rs +++ b/helix-syntax/src/lib.rs @@ -70,7 +70,7 @@ mk_langs!( (Bash, tree_sitter_bash), (C, tree_sitter_c), (CSharp, tree_sitter_c_sharp), - // (Cpp, tree_sitter_cpp), + (Cpp, tree_sitter_cpp), (Css, tree_sitter_css), (Go, tree_sitter_go), // (Haskell, tree_sitter_haskell), diff --git a/languages.toml b/languages.toml index eca55a13..981fca09 100644 --- a/languages.toml +++ b/languages.toml @@ -18,3 +18,44 @@ roots = [] path = "../helix-syntax/languages/tree-sitter-toml" 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 = " " } diff --git a/theme.toml b/theme.toml index 32ceb94b..6577544d 100644 --- a/theme.toml +++ b/theme.toml @@ -3,7 +3,8 @@ "punctuation" = "#a4a0e8" # lavender "punctuation.delimiter" = "#a4a0e8" # lavender "operator" = "#dbbfef" # lilac -"property" = "#a4a0e8" # lavender +# "property" = "#a4a0e8" # lavender +"property" = "#ffffff" # white "variable.parameter" = "#a4a0e8" # lavender # TODO distinguish type from type.builtin? "type" = "#ffffff" # white @@ -16,6 +17,7 @@ "constant" = "#ffffff" # white "constant.builtin" = "#ffffff" # white "string" = "#cccccc" # silver +"number" = "#e8dca0" # chamois "escape" = "#efba5d" # honey # used for lifetimes "label" = "#efba5d" # honey @@ -24,13 +26,13 @@ # TODO: diferentiate doc comment # TODO: variable as lilac # TODO: mod/use statements as white -# TODO: mod stuff as chamoise +# TODO: mod stuff as chamois # TODO: add "(scoped_identifier) @path" for std::mem:: # # concat (ERROR) @syntax-error and "MISSING ;" selectors for errors "module" = "#ff0000" -"variable" = "#ff0000" +"variable" = "#a4a0e8" # lavender "function.builtin" = "#ff0000" "ui.background" = { bg = "#3b224c" } # midnight