summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/queries/c/highlights.scm2
-rw-r--r--runtime/queries/go/highlights.scm39
-rw-r--r--runtime/queries/go/locals.scm30
-rw-r--r--runtime/queries/haskell/highlights.scm14
-rw-r--r--runtime/queries/javascript/highlights.scm2
-rw-r--r--runtime/queries/julia/highlights.scm82
-rw-r--r--runtime/queries/latex/highlights.scm4
-rw-r--r--runtime/queries/lua/highlights.scm18
-rw-r--r--runtime/queries/ocaml/highlights.scm8
-rw-r--r--runtime/queries/ruby/highlights.scm2
-rw-r--r--runtime/queries/rust/highlights.scm4
-rw-r--r--runtime/queries/rust/locals.scm17
-rw-r--r--runtime/queries/tsx/highlights.scm1
-rw-r--r--runtime/queries/yaml/highlights.scm2
-rw-r--r--runtime/themes/dark_plus.toml1
-rw-r--r--runtime/themes/monokai.toml1
16 files changed, 157 insertions, 70 deletions
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm
index 258e07e7..2c42710f 100644
--- a/runtime/queries/c/highlights.scm
+++ b/runtime/queries/c/highlights.scm
@@ -61,7 +61,7 @@
(null) @constant
(number_literal) @number
-(char_literal) @number
+(char_literal) @string
(call_expression
function: (identifier) @function)
diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm
index 224c8b78..3129c4b2 100644
--- a/runtime/queries/go/highlights.scm
+++ b/runtime/queries/go/highlights.scm
@@ -17,9 +17,18 @@
; Identifiers
+((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$"))
+(const_spec
+ name: (identifier) @constant)
+
+(parameter_declaration (identifier) @variable.parameter)
+(variadic_parameter_declaration (identifier) @variable.parameter)
+
(type_identifier) @type
(field_identifier) @property
(identifier) @variable
+(package_identifier) @variable
+
; Operators
@@ -79,10 +88,8 @@
"go"
"goto"
"if"
- "import"
"interface"
"map"
- "package"
"range"
"return"
"select"
@@ -92,6 +99,29 @@
"var"
] @keyword
+[
+ "import"
+ "package"
+] @keyword.control.import
+
+; Delimiters
+
+[
+ ":"
+ "."
+ ","
+ ";"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
; Literals
[
@@ -111,7 +141,8 @@
[
(true)
(false)
- (nil)
-] @constant.builtin
+] @constant.builtin.boolean
+
+(nil) @constant.builtin
(comment) @comment
diff --git a/runtime/queries/go/locals.scm b/runtime/queries/go/locals.scm
new file mode 100644
index 00000000..d240e2b7
--- /dev/null
+++ b/runtime/queries/go/locals.scm
@@ -0,0 +1,30 @@
+; Scopes
+
+(block) @local.scope
+
+; Definitions
+
+(parameter_declaration (identifier) @local.definition)
+(variadic_parameter_declaration (identifier) @local.definition)
+
+(short_var_declaration
+ left: (expression_list
+ (identifier) @local.definition))
+
+(var_spec
+ name: (identifier) @local.definition)
+
+(for_statement
+ (range_clause
+ left: (expression_list
+ (identifier) @local.definition)))
+
+(const_declaration
+ (const_spec
+ name: (identifier) @local.definition))
+
+; References
+
+(identifier) @local.reference
+(field_identifier) @local.reference
+
diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm
index ecaa2d2c..dada80b6 100644
--- a/runtime/queries/haskell/highlights.scm
+++ b/runtime/queries/haskell/highlights.scm
@@ -2,19 +2,19 @@
(operator) @operator
(exp_name (constructor) @constructor)
(constructor_operator) @operator
-(module) @module_name
+(module) @namespace
(type) @type
(type) @class
(constructor) @constructor
(pragma) @pragma
(comment) @comment
(signature name: (variable) @fun_type_name)
-(function name: (variable) @fun_name)
+(function name: (variable) @function)
(constraint class: (class_name (type)) @class)
(class (class_head class: (class_name (type)) @class))
(instance (instance_head class: (class_name (type)) @class))
-(integer) @literal
-(exp_literal (float)) @literal
+(integer) @number
+(exp_literal (float)) @number
(char) @literal
(con_unit) @literal
(con_list) @literal
@@ -39,5 +39,7 @@
"do" @keyword
"mdo" @keyword
"rec" @keyword
-"(" @paren
-")" @paren
+[
+ "("
+ ")"
+] @punctuation.bracket
diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm
index a18c38d9..e29829bf 100644
--- a/runtime/queries/javascript/highlights.scm
+++ b/runtime/queries/javascript/highlights.scm
@@ -87,7 +87,7 @@
(template_string)
] @string
-(regex) @string.special
+(regex) @string.regexp
(number) @number
; Tokens
diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm
index a53dabe5..7b7d426c 100644
--- a/runtime/queries/julia/highlights.scm
+++ b/runtime/queries/julia/highlights.scm
@@ -1,9 +1,3 @@
-(identifier) @variable
-;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
-;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
- ;(match? @type "^[A-Z][^_]"))
-((identifier) @constant
- (match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))
[
(triple_string)
@@ -28,43 +22,43 @@
(call_expression
(identifier) @function)
(call_expression
- (field_expression (identifier) @method .))
+ (field_expression (identifier) @function.method .))
(broadcast_call_expression
(identifier) @function)
(broadcast_call_expression
- (field_expression (identifier) @method .))
+ (field_expression (identifier) @function.method .))
(parameter_list
- (identifier) @parameter)
+ (identifier) @variable.parameter)
(parameter_list
(optional_parameter .
- (identifier) @parameter))
+ (identifier) @variable.parameter))
(typed_parameter
- (identifier) @parameter
+ (identifier) @variable.parameter
(identifier) @type)
(type_parameter_list
(identifier) @type)
(typed_parameter
- (identifier) @parameter
+ (identifier) @variable.parameter
(parameterized_identifier) @type)
(function_expression
- . (identifier) @parameter)
-(spread_parameter) @parameter
+ . (identifier) @variable.parameter)
+(spread_parameter) @variable.parameter
(spread_parameter
- (identifier) @parameter)
+ (identifier) @variable.parameter)
(named_argument
- . (identifier) @parameter)
+ . (identifier) @variable.parameter)
(argument_list
(typed_expression
- (identifier) @parameter
+ (identifier) @variable.parameter
(identifier) @type))
(argument_list
(typed_expression
- (identifier) @parameter
+ (identifier) @variable.parameter
(parameterized_identifier) @type))
;; Symbol expressions (:my-wanna-be-lisp-keyword)
(quote_expression
- (identifier)) @symbol
+ (identifier)) @string.special.symbol
;; Parsing error! foo (::Type) get's parsed as two quote expressions
(argument_list
@@ -76,7 +70,7 @@
(identifier) @type)
(parameterized_identifier (_)) @type
(argument_list
- (typed_expression . (identifier) @parameter))
+ (typed_expression . (identifier) @variable.parameter))
(typed_expression
(identifier) @type .)
@@ -113,13 +107,13 @@
"end" @keyword
(if_statement
- ["if" "end"] @conditional)
+ ["if" "end"] @keyword.control.conditional)
(elseif_clause
- ["elseif"] @conditional)
+ ["elseif"] @keyword.control.conditional)
(else_clause
- ["else"] @conditional)
+ ["else"] @keyword.control.conditional)
(ternary_expression
- ["?" ":"] @conditional)
+ ["?" ":"] @keyword.control.conditional)
(function_definition ["function" "end"] @keyword.function)
@@ -134,47 +128,57 @@
"type"
] @keyword
-((identifier) @keyword (#any-of? @keyword "global" "local"))
+((identifier) @keyword (match? @keyword "global|local"))
(compound_expression
["begin" "end"] @keyword)
(try_statement
- ["try" "end" ] @exception)
+ ["try" "end" ] @keyword.control.exception)
(finally_clause
- "finally" @exception)
+ "finally" @keyword.control.exception)
(catch_clause
- "catch" @exception)
+ "catch" @keyword.control.exception)
(quote_statement
["quote" "end"] @keyword)
(let_statement
["let" "end"] @keyword)
(for_statement
- ["for" "end"] @repeat)
+ ["for" "end"] @keyword.control.repeat)
(while_statement
- ["while" "end"] @repeat)
-(break_statement) @repeat
-(continue_statement) @repeat
+ ["while" "end"] @keyword.control.repeat)
+(break_statement) @keyword.control.repeat
+(continue_statement) @keyword.control.repeat
(for_binding
- "in" @repeat)
+ "in" @keyword.control.repeat)
(for_clause
- "for" @repeat)
+ "for" @keyword.control.repeat)
(do_clause
["do" "end"] @keyword)
(export_statement
- ["export"] @include)
+ ["export"] @keyword.control.import)
[
"using"
"module"
"import"
-] @include
+] @keyword.control.import
-((identifier) @include (#eq? @include "baremodule"))
+((identifier) @keyword.control.import (#eq? @keyword.control.import "baremodule"))
(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|Inf|NaN)$"))
-(((identifier) @boolean) (eq? @boolean "true"))
-(((identifier) @boolean) (eq? @boolean "false"))
+(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true"))
+(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false"))
+
["::" ":" "." "," "..." "!"] @punctuation.delimiter
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
+
+["="] @operator
+
+(identifier) @variable
+;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
+;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
+ ;(match? @type "^[A-Z][^_]"))
+((identifier) @constant
+ (match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))
diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm
index cd04a62c..f045c82d 100644
--- a/runtime/queries/latex/highlights.scm
+++ b/runtime/queries/latex/highlights.scm
@@ -259,7 +259,7 @@
(comment) @comment
-(bracket_group) @parameter
+(bracket_group) @variable.parameter
[(math_operator) "="] @operator
@@ -312,7 +312,7 @@
key: (word) @text.reference)
(key_val_pair
- key: (_) @parameter
+ key: (_) @variable.parameter
value: (_))
["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX
diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm
index 8e27a39a..40c2be70 100644
--- a/runtime/queries/lua/highlights.scm
+++ b/runtime/queries/lua/highlights.scm
@@ -23,27 +23,27 @@
"for"
"do"
"end"
-] @keyword.control.loop)
+] @keyword.control.repeat)
(for_in_statement
[
"for"
"do"
"end"
-] @keyword.control.loop)
+] @keyword.control.repeat)
(while_statement
[
"while"
"do"
"end"
-] @keyword.control.loop)
+] @keyword.control.repeat)
(repeat_statement
[
"repeat"
"until"
-] @keyword.control.loop)
+] @keyword.control.repeat)
(do_statement
[
@@ -65,7 +65,7 @@
"not"
"and"
"or"
-] @keyword.operator
+] @operator
[
"="
@@ -108,7 +108,7 @@
[
(false)
(true)
-] @boolean
+] @constant.builtin.boolean
(nil) @constant.builtin
(spread) @constant ;; "..."
((identifier) @constant
@@ -116,7 +116,7 @@
;; Parameters
(parameters
- (identifier) @parameter)
+ (identifier) @variable.parameter)
; ;; Functions
(function [(function_name) (identifier)] @function)
@@ -139,8 +139,8 @@
(function_call
[
- ((identifier) @variable (method) @method)
- ((_) (method) @method)
+ ((identifier) @variable (method) @function.method)
+ ((_) (method) @function.method)
(identifier) @function
(field_expression (property_identifier) @function)
]
diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm
index 093b3cce..160f2cb4 100644
--- a/runtime/queries/ocaml/highlights.scm
+++ b/runtime/queries/ocaml/highlights.scm
@@ -25,12 +25,12 @@
(external (value_name) @function)
-(method_name) @method
+(method_name) @function.method
; Variables
;----------
-(value_pattern) @parameter
+(value_pattern) @variable.parameter
; Application
;------------
@@ -60,7 +60,7 @@
[(number) (signed_number)] @number
-(character) @character
+(character) @constant.character
(string) @string
@@ -92,7 +92,7 @@
["include" "open"] @include
-["for" "to" "downto" "while" "do" "done"] @keyword.control.loop
+["for" "to" "downto" "while" "do" "done"] @keyword.control.repeat
; Macros
;-------
diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm
index 7f296f3b..8617d6f0 100644
--- a/runtime/queries/ruby/highlights.scm
+++ b/runtime/queries/ruby/highlights.scm
@@ -100,7 +100,7 @@
(bare_symbol)
] @string.special.symbol
-(regex) @string.special.regex
+(regex) @string.regexp
(escape_sequence) @escape
[
diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm
index 6b14d74d..956a5dac 100644
--- a/runtime/queries/rust/highlights.scm
+++ b/runtime/queries/rust/highlights.scm
@@ -17,7 +17,7 @@
(escape_sequence) @escape
(primitive_type) @type.builtin
-(boolean_literal) @constant.builtin
+(boolean_literal) @constant.builtin.boolean
[
(integer_literal)
(float_literal)
@@ -149,7 +149,7 @@
(mutable_specifier) @keyword.mut
-
+; TODO: variable.mut to highlight mutable identifiers via locals.scm
; -------
; Guess Other Types
diff --git a/runtime/queries/rust/locals.scm b/runtime/queries/rust/locals.scm
new file mode 100644
index 00000000..6428f9b4
--- /dev/null
+++ b/runtime/queries/rust/locals.scm
@@ -0,0 +1,17 @@
+; Scopes
+
+(block) @local.scope
+
+; Definitions
+
+(parameter
+ (identifier) @local.definition)
+
+(let_declaration
+ pattern: (identifier) @local.definition)
+
+(closure_parameters (identifier)) @local.definition
+
+; References
+(identifier) @local.reference
+
diff --git a/runtime/queries/tsx/highlights.scm b/runtime/queries/tsx/highlights.scm
new file mode 100644
index 00000000..1b61e36d
--- /dev/null
+++ b/runtime/queries/tsx/highlights.scm
@@ -0,0 +1 @@
+; inherits: typescript
diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm
index 4ebb4440..2955a4ce 100644
--- a/runtime/queries/yaml/highlights.scm
+++ b/runtime/queries/yaml/highlights.scm
@@ -1,6 +1,6 @@
(block_mapping_pair key: (_) @property)
(flow_mapping (_ key: (_) @property))
-(boolean_scalar) @boolean
+(boolean_scalar) @constant.builtin.boolean
(null_scalar) @constant.builtin
(double_quote_scalar) @string
(single_quote_scalar) @string
diff --git a/runtime/themes/dark_plus.toml b/runtime/themes/dark_plus.toml
index c105d52b..7eeb3f95 100644
--- a/runtime/themes/dark_plus.toml
+++ b/runtime/themes/dark_plus.toml
@@ -34,6 +34,7 @@
"comment" = { fg = "#6A9955" }
"string" = { fg = "#ce9178" }
+"string.regexp" = { fg = "regex" }
"number" = { fg = "#b5cea8" }
"escape" = { fg = "#d7ba7d" }
diff --git a/runtime/themes/monokai.toml b/runtime/themes/monokai.toml
index 2407591a..a8f03ff3 100644
--- a/runtime/themes/monokai.toml
+++ b/runtime/themes/monokai.toml
@@ -34,6 +34,7 @@
"comment" = { fg = "#88846F" }
"string" = { fg = "#e6db74" }
+"string.regexp" = { fg = "regex" }
"number" = { fg = "#ae81ff" }
"escape" = { fg = "#ae81ff" }