dhall: additional highlight queries (#5959)

This commit is contained in:
Jared Beller 2023-02-12 21:04:31 -05:00 committed by GitHub
parent c71b4c5579
commit 87518db1d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 85 additions and 25 deletions

View file

@ -1,52 +1,110 @@
;; Literals ;; Literals
(integer_literal) @constant.numeric.integer (integer_literal) @constant.numeric.integer
(natural_literal) @constant.numeric.integer (natural_literal) @constant.numeric.integer
(double_literal) @constant.numeric.float (double_literal) @constant.numeric.float
(boolean_literal) @constant.builtin.boolean (boolean_literal) @constant.builtin.boolean
(builtin "None") @constant.builtin
;; Text
(text_literal) @string (text_literal) @string
(interpolation "}" @string)
(double_quote_escaped) @constant.character.escape
(single_quote_escaped) @constant.character.escape
;; Imports
(local_import) @string.special.path (local_import) @string.special.path
(http_import) @string.special.url (http_import) @string.special.url
(import_hash) @string (env_import) @keyword
(env_variable) @string.special
(import_hash) @string.special
(missing_import) @keyword.control.import
[ (import_as_location) (import_as_text) ] @type
;; Comments ;; Comments
[ (block_comment) @comment.block
(line_comment) (line_comment) @comment.line
(block_comment)
] @comment ;; Types
([
(let_binding (label) @type)
(union_type_entry (label) @type)
] (#match? @type "^[A-Z]"))
((primitive_expression
(identifier (label) @type)
(selector (label) @type)?) @whole_identifier
(#match? @whole_identifier "(?:^|\\.)[A-Z][^.]*$"))
;; Variables
(identifier [
(label) @variable
(de_bruijn_index) @operator
])
(let_binding label: (label) @variable)
(lambda_expression label: (label) @variable.parameter)
(record_literal_entry (label) @variable.other.member)
(record_type_entry (label) @variable.other.member)
(selector) @variable.other.member
;; Keywords ;; Keywords
[ [
("let") "let"
("in") "in"
(assign_operator) "assert"
] @keyword
[
"using"
"as"
"with"
] @keyword.operator
;; Operators
[
(type_operator) (type_operator)
(assign_operator)
(lambda_operator) (lambda_operator)
(arrow_operator) (arrow_operator)
(infix_operator) (infix_operator)
(completion_operator) (completion_operator)
("using")
("assert")
(assert_operator) (assert_operator)
("as")
(forall_operator) (forall_operator)
("with") (empty_record_literal)
] @keyword ] @operator
;; Builtins ;; Builtins
[ (builtin_function) @function.builtin
(builtin_function) (builtin [
(missing_import) "Bool"
] @function.builtin "Optional"
"Natural"
"Integer"
"Double"
"Text"
"Date"
"Time"
"TimeZone"
"List"
"Type"
"Kind"
"Sort"
] @type.builtin)
;; Punctuation
[ "," "|" ] @punctuation.delimiter
(selector_dot) @punctuation.delimiter
[ [
(builtin) "("
(import_as_text) ")"
] @type.builtin "{"
"}"
"["
"]"
"<"
">"
] @punctuation.bracket
;; Conditionals ;; Conditionals
[ [
("if") "if"
("then") "then"
("else") "else"
] @keyword.control.conditional ] @keyword.control.conditional

View file

@ -0,0 +1,2 @@
([(block_comment) (line_comment)] @injection.content
(#set! injection.language "comment"))