diff options
| -rw-r--r-- | CONTRIBUTING.md | 1 | ||||
| -rw-r--r-- | doc/nvim-treesitter.txt | 4 | ||||
| -rw-r--r-- | lua/nvim-treesitter/highlight.lua | 1 | ||||
| -rw-r--r-- | queries/html_tags/highlights.scm | 2 | ||||
| -rw-r--r-- | queries/jsx/highlights.scm | 1 |
5 files changed, 8 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b89e13ae1..b5e214386 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -185,6 +185,7 @@ Used for xml-like tags ``` @tag +@tag.attribute @tag.delimiter ``` diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt index 120831993..fc0ff6a29 100644 --- a/doc/nvim-treesitter.txt +++ b/doc/nvim-treesitter.txt @@ -616,6 +616,10 @@ For identifiers referring to symbols or atoms. `TSTag` Tags like html tag names. + *hl-TSTagAttribute* +`TSTagAttribute` +For html tag attributes. + *hl-TSTagDelimiter* `TSTagDelimiter` Tag delimiter like `<` `>` `/` diff --git a/lua/nvim-treesitter/highlight.lua b/lua/nvim-treesitter/highlight.lua index 345737a74..09ae9e1aa 100644 --- a/lua/nvim-treesitter/highlight.lua +++ b/lua/nvim-treesitter/highlight.lua @@ -77,6 +77,7 @@ hlmap["string.special"] = "TSStringSpecial" hlmap["symbol"] = "TSSymbol" hlmap["tag"] = "TSTag" +hlmap["tag.attribute"] = "TSTagAttribute" hlmap["tag.delimiter"] = "TSTagDelimiter" hlmap["text"] = "TSText" diff --git a/queries/html_tags/highlights.scm b/queries/html_tags/highlights.scm index f92881d27..09e7b3ddf 100644 --- a/queries/html_tags/highlights.scm +++ b/queries/html_tags/highlights.scm @@ -1,7 +1,7 @@ (tag_name) @tag (erroneous_end_tag_name) @error (comment) @comment -(attribute_name) @property +(attribute_name) @tag.attribute (attribute_value) @string (quoted_attribute_value) @string (text) @none diff --git a/queries/jsx/highlights.scm b/queries/jsx/highlights.scm index 78c251708..8904c86c4 100644 --- a/queries/jsx/highlights.scm +++ b/queries/jsx/highlights.scm @@ -4,6 +4,7 @@ close_tag: (jsx_closing_element ["<" "/" ">"] @tag.delimiter)) (jsx_self_closing_element ["/" ">" "<"] @tag.delimiter) (jsx_fragment [">" "<" "/"] @tag.delimiter) +(jsx_attribute (property_identifier) @tag.attribute) (jsx_opening_element name: (identifier) @tag) |
