treesitter: add more highlight rules (#3036)

follow up to #2902
This commit is contained in:
mx42
2023-07-28 19:15:53 +00:00
committed by GitHub
parent 6cca85534f
commit fe49b1b2a6
2 changed files with 10 additions and 5 deletions
+4 -4
View File
@@ -151,7 +151,7 @@ module.exports = grammar({
$.struct_type_literal
),
_binding_lhs: ($) => choice($.ident, '_'),
binding_lhs: ($) => choice($.ident, '_'),
paren_pattern: ($) =>
seq(
@@ -163,9 +163,9 @@ module.exports = grammar({
_pattern_without_expression: ($) =>
choice(
'auto',
seq($._binding_lhs, ':', $._expression),
seq($._binding_lhs, ':!', $._expression),
seq('template', $._binding_lhs, ':!', $._expression),
seq($.binding_lhs, ':', $._expression),
seq($.binding_lhs, ':!', $._expression),
seq('template', $.binding_lhs, ':!', $._expression),
seq('var', $._pattern),
$.paren_pattern,
// alternative patterns
+6 -1
View File
@@ -16,7 +16,12 @@
(function_declaration (declared_name (ident) @function))
(call_expression (ident) @function)
; TODO: add more specific rules
(namespace_declaration (declared_name) @namespace)
(interface_declaration (declared_name) @type)
(constraint_declaration (declared_name) @type)
(class_declaration (declared_name) @type)
(choice_declaration (declared_name) @type)
(binding_lhs) @variable
; upper case => type
((ident) @type