mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
case insensitivity support, grainular highlights
This commit is contained in:
parent
2088d0daf8
commit
7fb2377e96
2 changed files with 62 additions and 63 deletions
|
|
@ -54,7 +54,7 @@
|
|||
"revision": "16c43068ec30828c5aed11e87262c56f36782595"
|
||||
},
|
||||
"brightscript": {
|
||||
"revision": "a5a68f3e4215c866659df7939fc4a6617d04341b"
|
||||
"revision": "48ce1687125c6dfefcc7a1bef19fa0f0f00426cc"
|
||||
},
|
||||
"c": {
|
||||
"revision": "2a265d69a4caf57108a73ad2ed1e6922dd2f998c"
|
||||
|
|
|
|||
|
|
@ -9,10 +9,12 @@
|
|||
(sub_statement
|
||||
name: (identifier) @function)
|
||||
|
||||
; Function calls
|
||||
(function_call
|
||||
function: (prefix_exp
|
||||
(identifier) @function.call))
|
||||
[
|
||||
(sub_start)
|
||||
(function_start)
|
||||
(end_sub)
|
||||
(end_function)
|
||||
] @keyword.function
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
|
|
@ -22,7 +24,16 @@
|
|||
(type_specifier) @type
|
||||
|
||||
; Variables
|
||||
(variable_declarator) @variable
|
||||
; Base variable in variable declarator (immediate child of prefix_exp)
|
||||
(variable_declarator
|
||||
(prefix_exp
|
||||
(identifier) @variable
|
||||
(#not-has-ancestor? @variable prefix_exp)))
|
||||
|
||||
; Properties in variable declarator
|
||||
(variable_declarator
|
||||
(prefix_exp)
|
||||
(identifier) @property)
|
||||
|
||||
(multiplicative_expression
|
||||
operator: (_) @keyword.operator)
|
||||
|
|
@ -34,49 +45,61 @@
|
|||
operator: (_) @keyword.operator)
|
||||
|
||||
; Property access
|
||||
; First identifier in a chain (base variable)
|
||||
(prefix_exp
|
||||
(prefix_exp
|
||||
(identifier) @variable)
|
||||
.
|
||||
(identifier) @variable
|
||||
(#not-has-ancestor? @variable prefix_exp))
|
||||
|
||||
; All other identifiers in a chain (properties)
|
||||
(prefix_exp
|
||||
(prefix_exp)
|
||||
(identifier) @property)
|
||||
|
||||
; Function calls
|
||||
(function_call
|
||||
function: (prefix_exp
|
||||
(identifier) @function.call))
|
||||
|
||||
; Statements
|
||||
(if_statement) @keyword.conditional
|
||||
[
|
||||
(if_start)
|
||||
(else)
|
||||
(else_if)
|
||||
(end_if)
|
||||
(then)
|
||||
(conditional_compl_end_if)
|
||||
] @keyword.conditional
|
||||
|
||||
(conditional_compl) @keyword.conditional
|
||||
[
|
||||
(for_start)
|
||||
(while_start)
|
||||
(for_each)
|
||||
(for_in)
|
||||
(for_to)
|
||||
(for_step)
|
||||
(end_for)
|
||||
(end_while)
|
||||
(exit_while_statement)
|
||||
(exit_for_statement)
|
||||
] @keyword.repeat
|
||||
|
||||
(for_statement) @keyword.repeat
|
||||
; Statements
|
||||
[
|
||||
(try_start)
|
||||
(try_catch)
|
||||
(throw)
|
||||
(end_try)
|
||||
] @keyword.exception
|
||||
|
||||
(while_statement) @keyword.repeat
|
||||
(return) @keyword.return
|
||||
|
||||
(try_statement) @keyword.exception
|
||||
|
||||
(return_statement) @keyword.return
|
||||
|
||||
(throw_statement) @keyword.exception
|
||||
|
||||
(assignment_statement) @operator
|
||||
|
||||
(print_statement) @function.builtin
|
||||
(print) @function.builtin
|
||||
|
||||
(constant) @constant
|
||||
|
||||
; Keywords
|
||||
[
|
||||
(function_start)
|
||||
(sub_start)
|
||||
(if_start)
|
||||
(if_then)
|
||||
(if_else)
|
||||
(for_start)
|
||||
(for_to)
|
||||
(for_step)
|
||||
(for_each)
|
||||
(for_in)
|
||||
(while_start)
|
||||
(try_start)
|
||||
(try_catch)
|
||||
(as)
|
||||
] @keyword
|
||||
(as) @keyword
|
||||
|
||||
; Operators
|
||||
[
|
||||
|
|
@ -102,7 +125,7 @@
|
|||
(invalid) @constant.builtin
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
(comment) @comment
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
|
|
@ -151,28 +174,4 @@
|
|||
">="
|
||||
] @operator)
|
||||
|
||||
; End statements
|
||||
[
|
||||
(end_sub)
|
||||
(end_function)
|
||||
(end_if)
|
||||
(end_for)
|
||||
(end_while)
|
||||
(end_try)
|
||||
(conditional_compl_end_if)
|
||||
] @keyword
|
||||
|
||||
; Special keywords (these might still need to be strings if not defined as separate nodes)
|
||||
[
|
||||
"then"
|
||||
"else"
|
||||
"else if"
|
||||
"#else"
|
||||
"#else if"
|
||||
] @keyword
|
||||
|
||||
; Exit statements
|
||||
[
|
||||
(exit_while_statement)
|
||||
(exit_for_statement)
|
||||
] @keyword
|
||||
(as) @keyword
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue