Skip to content

Commit

Permalink
feat: add cue support
Browse files Browse the repository at this point in the history
  • Loading branch information
b4nst committed Jul 30, 2022
1 parent a8b123f commit 7a6f654
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| cpon || || |
| cpp |||| `clangd` |
| css || | | `vscode-css-language-server` |
| cue || | | `cuelsp` |
| dart || || `dart` |
| devicetree || || |
| dockerfile || | | `docker-langserver` |
Expand Down
15 changes: 15 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1570,3 +1570,18 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "ungrammar"
source = { git = "https://github.com/Philipp-M/tree-sitter-ungrammar", rev = "0113de880a58ea14f2a75802e9b99fcc25003d9c" }

[[language]]
name = "cue"
scope = "source.cue"
injection-regex = "cue"
file-types = ["cue"]
roots = ["cue.mod"]
auto-format = true
comment-token = "//"
language-server = { command = "cuelsp" }
indent = { tab-width = 4, unit = "\t" }

[[grammar]]
name = "cue"
source = { git = "https://github.com/eonpatapon/tree-sitter-cue", rev = "61843e3beebf19417e4fede4e8be4df1084317ad" }
107 changes: 107 additions & 0 deletions runtime/queries/cue/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
(package_clause "package" @include)

(package_identifier) @variable

(import_declaration "import" @include)

[
"!"
"*"
"|"
"&"
"||"
"&&"
"=="
"!="
"<"
"<="
">"
">="
"=~"
"!~"
"+"
"-"
"*"
"/"
] @operator

(unary_expression "*" @operator.default)

(unary_expression "=~" @operator.regexp)

(unary_expression "!~" @operator.regexp)

(binary_expression _ "&" @operator.unify _)

(binary_expression _ "|" @operator.disjunct _)

(builtin) @function.builtin

(qualified_identifier) @function.builtin

(let_clause "let" @keyword)

(for_clause "for" @repeat)
(for_clause "in" @repeat)

(guard_clause "if" @conditional)

(comment) @comment

[
(string_type)
(simple_string_lit)
(multiline_string_lit)
(bytes_type)
(simple_bytes_lit)
(multiline_bytes_lit)
] @string

[
(number_type)
(int_lit)
(int_type)
(uint_type)
(float_lit)
(float_type)
] @number

[
(bool_type)
(true)
(false)
] @boolean

(null) @constant.builtin

(ellipsis) @punctuation.special

[
","
":"
] @punctuation.delimiter

[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket

(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none

(field (label (identifier) @field))

(
(identifier) @definition
(#match? @definition "^#")
)

(field (label alias: (identifier) @label))

(let_clause left: (identifier) @label)


(attribute (identifier) @attribute)

0 comments on commit 7a6f654

Please # to comment.