diff options
| author | lmlorca <luismlorca@gmail.com> | 2021-07-13 20:21:47 -0400 |
|---|---|---|
| committer | Stephan Seitz <stephan.lauf@yahoo.de> | 2021-07-14 10:13:13 +0200 |
| commit | fb5d6e04a87863d01a45dab2cbafec4e2a74822b (patch) | |
| tree | 97de66c39a10594a2e064085ad254eda48ad0c23 | |
| parent | doc: be more explicit about additional_vim_regex_highlighting (#1561) (diff) | |
| download | nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.tar nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.tar.gz nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.tar.bz2 nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.tar.lz nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.tar.xz nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.tar.zst nvim-treesitter-fb5d6e04a87863d01a45dab2cbafec4e2a74822b.zip | |
add @tag.attribute for html like attributes
| -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) |
