diff options
author | Jared Beller | 2023-02-13 02:04:31 +0000 |
---|---|---|
committer | GitHub | 2023-02-13 02:04:31 +0000 |
commit | 87518db1d12ea48a4d2fce7808e24852992b03ee (patch) | |
tree | 08037bc0a54c76f45de459bc02043fcb1359cee5 /runtime/queries | |
parent | c71b4c5579fdc753e62300f5ee6ca5e747a98e13 (diff) |
dhall: additional highlight queries (#5959)
Diffstat (limited to 'runtime/queries')
-rw-r--r-- | runtime/queries/dhall/highlights.scm | 108 | ||||
-rw-r--r-- | runtime/queries/dhall/injections.scm | 2 |
2 files changed, 85 insertions, 25 deletions
diff --git a/runtime/queries/dhall/highlights.scm b/runtime/queries/dhall/highlights.scm index 52ede310..0663bbd9 100644 --- a/runtime/queries/dhall/highlights.scm +++ b/runtime/queries/dhall/highlights.scm @@ -1,52 +1,110 @@ ;; Literals - (integer_literal) @constant.numeric.integer (natural_literal) @constant.numeric.integer (double_literal) @constant.numeric.float (boolean_literal) @constant.builtin.boolean +(builtin "None") @constant.builtin + +;; Text (text_literal) @string +(interpolation "}" @string) +(double_quote_escaped) @constant.character.escape +(single_quote_escaped) @constant.character.escape + +;; Imports (local_import) @string.special.path (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 -[ - (line_comment) - (block_comment) -] @comment +(block_comment) @comment.block +(line_comment) @comment.line + +;; 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 [ - ("let") - ("in") - (assign_operator) + "let" + "in" + "assert" +] @keyword +[ + "using" + "as" + "with" +] @keyword.operator + +;; Operators +[ (type_operator) + (assign_operator) (lambda_operator) (arrow_operator) (infix_operator) (completion_operator) - ("using") - ("assert") (assert_operator) - ("as") (forall_operator) - ("with") -] @keyword + (empty_record_literal) +] @operator ;; Builtins -[ - (builtin_function) - (missing_import) -] @function.builtin +(builtin_function) @function.builtin +(builtin [ + "Bool" + "Optional" + "Natural" + "Integer" + "Double" + "Text" + "Date" + "Time" + "TimeZone" + "List" + "Type" + "Kind" + "Sort" +] @type.builtin) -[ - (builtin) - (import_as_text) -] @type.builtin +;; Punctuation +[ "," "|" ] @punctuation.delimiter +(selector_dot) @punctuation.delimiter +[ + "(" + ")" + "{" + "}" + "[" + "]" + "<" + ">" +] @punctuation.bracket ;; Conditionals [ - ("if") - ("then") - ("else") + "if" + "then" + "else" ] @keyword.control.conditional diff --git a/runtime/queries/dhall/injections.scm b/runtime/queries/dhall/injections.scm new file mode 100644 index 00000000..0164f684 --- /dev/null +++ b/runtime/queries/dhall/injections.scm @@ -0,0 +1,2 @@ +([(block_comment) (line_comment)] @injection.content + (#set! injection.language "comment")) |