1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 03:14:55 +02:00

nvim: php: set proper names for custom treesitter highligt tags

This commit is contained in:
Henrik Hautakoski 2024-12-31 09:53:41 +01:00
parent a01174218c
commit 7f81196612
2 changed files with 17 additions and 15 deletions

View file

@ -201,12 +201,14 @@ local options = {
-- PHP -- PHP
["@keyword.import.php"] = { link = "@keyword" }, ["@keyword.import.php"] = { link = "@keyword" },
["@class_name.php"] = { link = "@text" },
["@extend_name.php"] = { link = "@text" },
["@implement_name.php"] = { link = "@text" },
["@namespace_name.php"] = { link = "@text" },
["@namespace_alias.php"] = { link = "@text" },
["@function.builtin.php"] = { fg = colors.blue }, ["@function.builtin.php"] = { fg = colors.blue },
["@class.name.php"] = { link = "@text" },
["@class.inherit.name.php"] = { link = "@text" },
["@class.implements.name.php"] = { link = "@text" },
["@interface.name.php"] = { link = "@text" },
["@namespace.name.php"] = { link = "@text" },
["@namespace.alias.name.php"] = { link = "@text" },
["@use.trait.name.php"] = { link = "@text" },
-- Blade -- Blade
["@tag.blade"] = { fg = colors.mauve }, ["@tag.blade"] = { fg = colors.mauve },

View file

@ -3,22 +3,22 @@
; php tags should be tagged as preprocessor tokens ; php tags should be tagged as preprocessor tokens
(php_tag) @preproc (php_tag) @preproc
; Tag names in class definition as regular text. ; Tag names in class definition
(class_declaration [ (class_declaration [
name: (name) @class_name name: (name) @class.name
(base_clause (name) @extend_name) (base_clause (name) @class.inherit.name)
(class_interface_clause (name) @implement_name) (class_interface_clause (name) @class.implements.name)
]) ])
(interface_declaration (name) @class_name) (interface_declaration (name) @interface.name)
; tag "use" traits as text ; tag trait name in use declaration
(use_declaration (name) @text) (use_declaration (name) @use.trait.name)
; tag namespace classes in "use" as text ; tag name token in "use" use namespace declaration
(namespace_use_declaration (namespace_use_clause [ (namespace_use_declaration (namespace_use_clause [
(qualified_name [ (qualified_name [
(name) @namespace_name (name) @namespace.name
]) ])
alias: (name) @namespace_name alias: (name) @namespace.alias.name
])) ]))