Skip to content

Commit

Permalink
YAML support (#667)
Browse files Browse the repository at this point in the history
* added submodule

* remove wrong one

* added highlights

* use property

* add indents

* shallow
  • Loading branch information
oberblastmeister authored Sep 1, 2021
1 parent ce7ad2b commit 1586b0e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
path = helix-syntax/languages/tree-sitter-protobuf
url = https://github.com/yusdacra/tree-sitter-protobuf.git
shallow = true
[submodule "helix-syntax/languages/tree-sitter-yaml"]
path = helix-syntax/languages/tree-sitter-yaml
url = https://github.com/ikatyang/tree-sitter-yaml
shallow = true
[submodule "helix-syntax/languages/tree-sitter-zig"]
path = helix-syntax/languages/tree-sitter-zig
url = https://github.com/maxxnino/tree-sitter-zig
Expand Down
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-yaml
Submodule tree-sitter-yaml added at 0e36be
8 changes: 8 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ roots = []
comment-token = ";"
indent = { tab-width = 4, unit = " " }

[[language]]
name = "yaml"
scope = "source.yaml"
file-types = ["yml", "yaml"]
roots = []
comment-token = "#"
indent = { tab-width = 2, unit = " " }

# [[language]]
# name = "haskell"
# scope = "source.haskell"
Expand Down
33 changes: 33 additions & 0 deletions runtime/queries/yaml/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
(block_mapping_pair key: (_) @property)
(flow_mapping (_ key: (_) @property))
(boolean_scalar) @boolean
(null_scalar) @constant.builtin
(double_quote_scalar) @string
(single_quote_scalar) @string
(escape_sequence) @string.escape
(integer_scalar) @number
(float_scalar) @number
(comment) @comment
(anchor_name) @type
(alias_name) @type
(tag) @type
(yaml_directive) @keyword
(ERROR) @error

[
","
"-"
":"
">"
"?"
"|"
] @punctuation.delimiter

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

["*" "&"] @punctuation.special
3 changes: 3 additions & 0 deletions runtime/queries/yaml/indents.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
indent = [
"block_mapping_pair",
]

0 comments on commit 1586b0e

Please sign in to comment.