on master help sign in
CMake support (#888)
787ba4fath3
.gitmodules+4
@@ -130,3 +130,7 @@
130 path = helix-syntax/languages/tree-sitter-tsq
130 path = helix-syntax/languages/tree-sitter-tsq
131 url = https://github.com/tree-sitter/tree-sitter-tsq
131 url = https://github.com/tree-sitter/tree-sitter-tsq
132 shallow = true
132 shallow = true
133+[submodule "helix-syntax/languages/tree-sitter-cmake"]
134+ path = helix-syntax/languages/tree-sitter-cmake
135+ url = https://github.com/uyha/tree-sitter-cmake
136+ shallow = true
helix-syntax/languages/tree-sitter-cmakenew file+1

Submodule changed.

languages.toml+8
@@ -346,3 +346,11 @@ file-types = ["scm"]
346roots = []
346roots = []
347comment-token = ";"
347comment-token = ";"
348indent = { tab-width = 2, unit = " " }
348indent = { tab-width = 2, unit = " " }
349+
350+[[language]]
351+name = "cmake"
352+scope = "source.cmake"
353+file-types = ["cmake", "CMakeLists.txt"]
354+roots = []
355+comment-token = "#"
356+indent = { tab-width = 2, unit = " " }
runtime/queries/cmake/highlights.scmnew file+97
@@ -0,0 +1,97 @@
1+[
2+ (quoted_argument)
3+ (bracket_argument)
4+ ] @string
5+
6+(variable) @variable
7+
8+[
9+ (bracket_comment)
10+ (line_comment)
11+ ] @comment
12+
13+(normal_command (identifier) @function)
14+
15+["ENV" "CACHE"] @string.special.symbol
16+["$" "{" "}" "<" ">"] @punctuation
17+["(" ")"] @punctuation.bracket
18+
19+[
20+ (function)
21+ (endfunction)
22+ (macro)
23+ (endmacro)
24+ ] @keyword.function
25+
26+[
27+ (if)
28+ (elseif)
29+ (else)
30+ (endif)
31+ ] @keyword.control.conditional
32+
33+[
34+ (foreach)
35+ (endforeach)
36+ (while)
37+ (endwhile)
38+ ] @keyword.control.repeat
39+
40+(function_command
41+ (function)
42+ . (argument) @function
43+ (argument)* @variable.parameter
44+ )
45+
46+(macro_command
47+ (macro)
48+ . (argument) @function.macro
49+ (argument)* @variable.parameter
50+ )
51+
52+(normal_command
53+ (identifier) @function.builtin
54+ . (argument) @variable
55+ (#match? @function.builtin "^(?i)(set)$"))
56+
57+(normal_command
58+ (identifier) @function.builtin
59+ . (argument)
60+ (argument) @constant
61+ (#match? @constant "^(?:PARENT_SCOPE|CACHE)$")
62+ (#match? @function.builtin "^(?i)(unset)$"))
63+
64+(normal_command
65+ (identifier) @function.builtin
66+ . (argument)
67+ . (argument)
68+ (argument) @constant
69+ (#match? @constant "^(?:PARENT_SCOPE|CACHE|FORCE)$")
70+ (#match? @function.builtin "^(?i)(set)$")
71+ )
72+
73+((argument) @constant.builtin.boolean
74+ (#match? @constant.builtin.boolean "^(?i)(?:1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")
75+ )
76+
77+(if_command
78+ (if)
79+ (argument) @operator
80+ (#match? @operator "^(?:NOT|AND|OR|COMMAND|POLICY|TARGET|TEST|DEFINED|IN_LIST|EXISTS|IS_NEWER_THAN|IS_DIRECTORY|IS_SYMLINK|IS_ABSOLUTE|MATCHES|LESS|GREATER|EQUAL|LESS_EQUAL|GREATER_EQUAL|STRLESS|STRGREATER|STREQUAL|STRLESS_EQUAL|STRGREATER_EQUAL|VERSION_LESS|VERSION_GREATER|VERSION_EQUAL|VERSION_LESS_EQUAL|VERSION_GREATER_EQUAL)$")
81+)
82+
83+(normal_command
84+ (identifier) @function.builtin
85+ . (argument)
86+ (argument) @constant
87+ (#match? @constant "^(?:ALL|COMMAND|DEPENDS|BYPRODUCTS|WORKING_DIRECTORY|COMMENT|JOB_POOL|VERBATIM|USES_TERMINAL|COMMAND_EXPAND_LISTS|SOURCES)$")
88+ (#match? @function.builtin "^(?i)(add_custom_target)$")
89+ )
90+
91+(normal_command
92+ (identifier) @function.builtin
93+ (argument) @constant
94+ (#match? @constant "^(?:OUTPUT|COMMAND|MAIN_DEPENDENCY|DEPENDS|BYPRODUCTS|IMPLICIT_DEPENDS|WORKING_DIRECTORY|COMMENT|DEPFILE|JOB_POOL|VERBATIM|APPEND|USES_TERMINAL|COMMAND_EXPAND_LISTS)$")
95+ (#match? @function.builtin "^(?i)(add_custom_command)$")
96+ )
97+