mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Addresses issue #892 Ruby and Dart literal symbols will now be highlighted by the new TSSymbol highlight group, which itself will, by default, link to the Vim Identifier highlight group. Vim theme authors can then set their TSSymbol colors. Symbol highlighting can apply to a number of languages as noted in the following Wikipedia page: https://en.wikipedia.org/wiki/Symbol_(programming) Not just for Ruby and Dart.
192 lines
2.6 KiB
Scheme
192 lines
2.6 KiB
Scheme
; Variables
|
|
(identifier) @variable
|
|
(interpolation
|
|
"#{" @punctuation.special
|
|
"}" @punctuation.special) @none
|
|
|
|
; Keywords
|
|
|
|
[
|
|
"alias"
|
|
"begin"
|
|
"break"
|
|
"class"
|
|
"def"
|
|
"do"
|
|
"end"
|
|
"ensure"
|
|
"module"
|
|
"next"
|
|
"rescue"
|
|
"retry"
|
|
"return"
|
|
"then"
|
|
"yield"
|
|
] @keyword
|
|
|
|
[
|
|
"and"
|
|
"or"
|
|
"in"
|
|
] @keyword.operator
|
|
|
|
[
|
|
"case"
|
|
"else"
|
|
"elsif"
|
|
"if"
|
|
"unless"
|
|
"when"
|
|
] @conditional
|
|
|
|
[
|
|
"for"
|
|
"until"
|
|
"while"
|
|
] @repeat
|
|
|
|
(constant) @type
|
|
|
|
((identifier) @keyword
|
|
(#vim-match? @keyword "^(private|protected|public)$"))
|
|
|
|
[
|
|
"rescue"
|
|
"ensure"
|
|
] @exception
|
|
|
|
((identifier) @exception
|
|
(#vim-match? @exception "^(fail|raise)$"))
|
|
|
|
; Function calls
|
|
|
|
"defined?" @function
|
|
|
|
(call
|
|
receiver: (constant)? @type
|
|
method: [
|
|
(identifier)
|
|
(constant)
|
|
] @function
|
|
)
|
|
|
|
(program
|
|
(call
|
|
(identifier) @include)
|
|
(#vim-match? @include "^(require|require_relative|load)$"))
|
|
|
|
; Function definitions
|
|
|
|
(alias (identifier) @function)
|
|
(setter (identifier) @function)
|
|
|
|
(method name: [
|
|
(identifier) @function
|
|
(constant) @type
|
|
])
|
|
|
|
(singleton_method name: [
|
|
(identifier) @function
|
|
(constant) @type
|
|
])
|
|
|
|
(class name: (constant) @type)
|
|
(module name: (constant) @type)
|
|
(superclass (constant) @type)
|
|
|
|
; Identifiers
|
|
[
|
|
(class_variable)
|
|
(instance_variable)
|
|
] @label
|
|
|
|
((identifier) @constant.builtin
|
|
(#vim-match? @constant.builtin "^__(callee|dir|id|method|send|ENCODING|FILE|LINE)__$"))
|
|
|
|
((constant) @type
|
|
(#vim-match? @type "^[A-Z\\d_]+$"))
|
|
|
|
[
|
|
(self)
|
|
(super)
|
|
] @variable.builtin
|
|
|
|
(method_parameters (identifier) @parameter)
|
|
(lambda_parameters (identifier) @parameter)
|
|
(block_parameters (identifier) @parameter)
|
|
(splat_parameter (identifier) @parameter)
|
|
(hash_splat_parameter (identifier) @parameter)
|
|
(optional_parameter (identifier) @parameter)
|
|
(destructured_parameter (identifier) @parameter)
|
|
(block_parameter (identifier) @parameter)
|
|
(keyword_parameter (identifier) @parameter)
|
|
|
|
; TODO: Re-enable this once it is supported
|
|
; ((identifier) @function
|
|
; (#is-not? local))
|
|
|
|
; Literals
|
|
|
|
[
|
|
(string)
|
|
(bare_string)
|
|
(subshell)
|
|
(heredoc_body)
|
|
] @string
|
|
|
|
[
|
|
(bare_symbol)
|
|
(heredoc_beginning)
|
|
(heredoc_end)
|
|
] @constant
|
|
|
|
[
|
|
(simple_symbol)
|
|
(delimited_symbol)
|
|
(hash_key_symbol)
|
|
] @symbol
|
|
|
|
(pair key: (hash_key_symbol) ":" @constant)
|
|
(regex) @string.regex
|
|
(escape_sequence) @string.escape
|
|
(integer) @number
|
|
(float) @float
|
|
|
|
[
|
|
(nil)
|
|
(true)
|
|
(false)
|
|
] @boolean
|
|
|
|
(comment) @comment
|
|
|
|
; Operators
|
|
|
|
[
|
|
"="
|
|
"=>"
|
|
"->"
|
|
"+"
|
|
"-"
|
|
"*"
|
|
"/"
|
|
] @operator
|
|
|
|
[
|
|
","
|
|
";"
|
|
"."
|
|
] @punctuation.delimiter
|
|
|
|
[
|
|
"("
|
|
")"
|
|
"["
|
|
"]"
|
|
"{"
|
|
"}"
|
|
"%w("
|
|
"%i("
|
|
] @punctuation.bracket
|
|
|
|
(ERROR) @error
|