on master help sign in
feat: add cue support (#3262)
commit7e066814133c62ab76a2da8dd021b6001f3b70f9 authorBanst <bastyen.a@gmail.com> dateSun 31 Jul 2022, 14:04 (4 years ago) parent110eb73
3 files changed+126
book/src/generated/lang-support.md+1 languages.toml+15 runtime/queries/cue/highlights.scm+110
book/src/generated/lang-support.md+1
@@ -10,6 +10,7 @@
1010| cpon | ✓ | | ✓ | |
1111| cpp | ✓ | ✓ | ✓ | `clangd` |
1212| css | ✓ | | | `vscode-css-language-server` |
13+| cue | ✓ | | | `cuelsp` |
1314| dart | ✓ | | ✓ | `dart` |
1415| devicetree | ✓ | | ✓ | |
1516| dockerfile | ✓ | | | `docker-langserver` |
languages.toml+15
@@ -1584,3 +1584,18 @@ language-server = { command = "dot-language-server", args = ["--stdio"] }
15841584[[grammar]]
15851585name = "dot"
15861586source = { git = "https://github.com/rydesun/tree-sitter-dot", rev = "917230743aa10f45a408fea2ddb54bbbf5fbe7b7" }
1587+
1588+[[language]]
1589+name = "cue"
1590+scope = "source.cue"
1591+injection-regex = "cue"
1592+file-types = ["cue"]
1593+roots = ["cue.mod"]
1594+auto-format = true
1595+comment-token = "//"
1596+language-server = { command = "cuelsp" }
1597+indent = { tab-width = 4, unit = "\t" }
1598+
1599+[[grammar]]
1600+name = "cue"
1601+source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "61843e3beebf19417e4fede4e8be4df1084317ad" }
runtime/queries/cue/highlights.scmnew file+110
@@ -0,0 +1,110 @@
1+(package_clause "package" @keyword.control.import)
2+
3+(package_identifier) @variable
4+
5+(import_declaration "import" @keyword.control.import)
6+
7+[
8+ "!"
9+ "*"
10+ "|"
11+ "&"
12+ "||"
13+ "&&"
14+ "=="
15+ "!="
16+ "<"
17+ "<="
18+ ">"
19+ ">="
20+ "=~"
21+ "!~"
22+ "+"
23+ "-"
24+ "*"
25+ "/"
26+] @operator
27+
28+(unary_expression "*" @operator.default)
29+
30+(unary_expression "=~" @operator.regexp)
31+
32+(unary_expression "!~" @operator.regexp)
33+
34+(binary_expression _ "&" @operator.unify _)
35+
36+(binary_expression _ "|" @operator.disjunct _)
37+
38+(builtin) @function.builtin
39+
40+(qualified_identifier) @function.builtin
41+
42+(let_clause "let" @keyword.storage.type)
43+
44+(for_clause "for" @keyword.control.repeat)
45+(for_clause "in" @keyword.control.repeat)
46+
47+(guard_clause "if" @keyword.control.conditional)
48+
49+(comment) @comment
50+
51+[
52+ (string_type)
53+ (simple_string_lit)
54+ (multiline_string_lit)
55+ (bytes_type)
56+ (simple_bytes_lit)
57+ (multiline_bytes_lit)
58+] @string
59+
60+[
61+ (number_type)
62+ (int_lit)
63+ (int_type)
64+ (uint_type)
65+] @constant.numeric.integer
66+
67+[
68+ (float_lit)
69+ (float_type)
70+] @constant.numeric.float
71+
72+[
73+ (bool_type)
74+ (true)
75+ (false)
76+] @constant.builtin.boolean
77+
78+(null) @constant.builtin
79+
80+(ellipsis) @punctuation.bracket
81+
82+[
83+ ","
84+ ":"
85+] @punctuation.delimiter
86+
87+[
88+ "("
89+ ")"
90+ "["
91+ "]"
92+ "{"
93+ "}"
94+] @punctuation.bracket
95+
96+(interpolation "\\(" @punctuation.bracket (_) ")" @punctuation.bracket) @variable.other.member
97+
98+(field (label (identifier) @variable.other.member))
99+
100+(
101+ (identifier) @keyword.storage.type
102+ (#match? @keyword.storage.type "^#")
103+)
104+
105+(field (label alias: (identifier) @label))
106+
107+(let_clause left: (identifier) @label)
108+
109+
110+(attribute (identifier) @tag)