Skip to content

Commit

Permalink
Language support for dhall
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel authored and the-mikedavis committed Jan 13, 2023
1 parent 051cd78 commit 1f6809c
Show file tree
Hide file tree
Showing 4 changed files with 91 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 @@ -22,6 +22,7 @@
| d |||| `serve-d` |
| dart || || `dart` |
| devicetree || | | |
| dhall ||| | `dhall-lsp-server` |
| diff || | | |
| dockerfile || | | `docker-langserver` |
| dot || | | `dot-language-server` |
Expand Down
15 changes: 15 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2092,3 +2092,18 @@ comment-token = "//"
[[grammar]]
name = "ponylang"
source = { git = "https://github.com/mfelsche/tree-sitter-ponylang", rev = "ef66b151bc2604f431b5668fcec4747db4290e11" }

[[language]]
name = "dhall"
scope = "source.dhall"
injection-regex = "dhall"
file-types = ["dhall"]
roots = []
comment-token = "--"
indent = { tab-width = 2, unit = " " }
language-server = { command = "dhall-lsp-server" }
formatter = { command = "dhall" , args = ["format"] }

[[grammar]]
name = "dhall"
source = { git = "https://github.com/jbellerb/tree-sitter-dhall", rev = "affb6ee38d629c9296749767ab832d69bb0d9ea8" }
52 changes: 52 additions & 0 deletions runtime/queries/dhall/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
;; Literals

(integer_literal) @constant.numeric.integer
(natural_literal) @constant.numeric.integer
(double_literal) @constant.numeric.float
(boolean_literal) @constant.builtin.boolean
(text_literal) @string
(local_import) @string.special.path
(http_import) @string.special.url
(import_hash) @string

;; Comments
[
(line_comment)
(block_comment)
] @comment

;; Keywords
[
("let")
("in")
(assign_operator)
(type_operator)
(lambda_operator)
(arrow_operator)
(infix_operator)
(completion_operator)
("using")
("assert")
(assert_operator)
("as")
(forall_operator)
("with")
] @keyword

;; Builtins
[
(builtin_function)
(missing_import)
] @function.builtin

[
(builtin)
(import_as_text)
] @type.builtin

;; Conditionals
[
("if")
("then")
("else")
] @keyword.control.conditional
23 changes: 23 additions & 0 deletions runtime/queries/dhall/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(lambda_expression
(label) @parameter.inside
(expression) @function.inside
) @function.around

(forall_expression
(label) @parameter.inside
(expression) @function.inside
) @function.around

(assert_expression
(expression) @test.inside
) @test.around

[
(block_comment_content)
(line_comment_content)
] @comment.inside

[
(block_comment)
(line_comment)
] @comment.around

0 comments on commit 1f6809c

Please sign in to comment.