Skip to content

Commit

Permalink
Add HOCON language support (helix-editor#9203)
Browse files Browse the repository at this point in the history
* Add HOCON language support

* Remove error query

Co-authored-by: Michael Davis <[email protected]>

* Change include query

* Fix query error

---------

Co-authored-by: Michael Davis <[email protected]>
  • Loading branch information
2 people authored and dgkf committed Jan 30, 2024
1 parent 7bb0929 commit 9139149
Show file tree
Hide file tree
Showing 4 changed files with 54 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 @@ -68,6 +68,7 @@
| haskell-persistent || | | |
| hcl || || `terraform-ls` |
| heex ||| | `elixir-ls` |
| hocon || || |
| hosts || | | |
| html || | | `vscode-html-language-server` |
| hurl || || |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3013,3 +3013,15 @@ file-types = ["janet"]
comment-token = "#"
indent = { tab-width = 2, unit = " " }
grammar = "clojure"

[[language]]
name = "hocon"
scope = "source.conf"
file-types = ["conf"]
comment-token = "#"
auto-format = true
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "hocon"
source = { git = "https://github.com/antosha417/tree-sitter-hocon", rev = "c390f10519ae69fdb03b3e5764f5592fb6924bcc" }
31 changes: 31 additions & 0 deletions runtime/queries/hocon/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(comment) @comment

(null) @constant.builtin
[(true) (false)] @constant.builtin.boolean
(number) @constant.numeric
(string) @string
(multiline_string) @string
(string (escape_sequence) @constant.character.escape)
(unquoted_string) @string

(value [":" "=" "+=" ] @operator)

(substitution (_) @string)
(substitution ["${" "${?" "}"] @punctuation.special)

[
"url"
"file"
"classpath"
"required"
] @function.builtin

(include) @keyword.directive

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

(unit) @keyword
(path (_) @keyword)
(unquoted_path "." @punctuation.delimiter)
[ "," ] @punctuation.delimiter

10 changes: 10 additions & 0 deletions runtime/queries/hocon/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
(object)
(array)
] @indent

[
"]"
"}"
] @outdent

0 comments on commit 9139149

Please sign in to comment.