aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis B <bluz71@users.noreply.github.com>2021-02-28 15:24:16 +1100
committerStephan Seitz <stephan.lauf@yahoo.de>2021-03-04 06:19:40 +0100
commitaca33c0acac29b63c570f079cc06a5458e6ac94c (patch)
tree65ec21823217b252d13148a1c3ba86b409d10778
parent[docgen] Update README.md (diff)
downloadnvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.tar
nvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.tar.gz
nvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.tar.bz2
nvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.tar.lz
nvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.tar.xz
nvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.tar.zst
nvim-treesitter-aca33c0acac29b63c570f079cc06a5458e6ac94c.zip
[highlights] Add TSSymbol highlight group
Addresses issue #892 Ruby and Dart literal symbols will now be highlighted by the new TSSymbol highlight group, which itself will, by default, link to the Vim Identifier highlight group. Vim theme authors can then set their TSSymbol colors. Symbol highlighting can apply to a number of languages as noted in the following Wikipedia page: https://en.wikipedia.org/wiki/Symbol_(programming) Not just for Ruby and Dart.
-rw-r--r--CONTRIBUTING.md1
-rw-r--r--doc/nvim-treesitter.txt4
-rw-r--r--lua/nvim-treesitter/highlight.lua2
-rw-r--r--plugin/nvim-treesitter.vim1
-rw-r--r--queries/dart/highlights.scm2
-rw-r--r--queries/ruby/highlights.scm2
6 files changed, 10 insertions, 2 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e671b24da..1fbbb8bd4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -143,6 +143,7 @@ effect on highlighting. We will work on improving highlighting in the near futur
@type
@type.builtin
@namespace for identifiers referring to namespaces
+@symbol for identifiers referring to symbols
@attribute for e.g. Python decorators
```
diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt
index eb1573ef0..6ad57eef9 100644
--- a/doc/nvim-treesitter.txt
+++ b/doc/nvim-treesitter.txt
@@ -560,6 +560,10 @@ For regexes.
*hl-TSStringEscape*
For escape characters within a string.
+`TSSymbol`
+ *hl-TSSymbol*
+For identifiers referring to symbols or atoms.
+
`TSTag`
*hl-TSTag*
Tags like html tag names.
diff --git a/lua/nvim-treesitter/highlight.lua b/lua/nvim-treesitter/highlight.lua
index 753aeed7b..a0c6ee61b 100644
--- a/lua/nvim-treesitter/highlight.lua
+++ b/lua/nvim-treesitter/highlight.lua
@@ -71,6 +71,8 @@ hlmap["string"] = "TSString"
hlmap["string.regex"] = "TSStringRegex"
hlmap["string.escape"] = "TSStringEscape"
+hlmap["symbol"] = "TSSymbol"
+
hlmap["tag"] = "TSTag"
hlmap["tag.delimiter"] = "TSTagDelimiter"
diff --git a/plugin/nvim-treesitter.vim b/plugin/nvim-treesitter.vim
index 0bc3ae8d6..571f2945e 100644
--- a/plugin/nvim-treesitter.vim
+++ b/plugin/nvim-treesitter.vim
@@ -54,6 +54,7 @@ highlight default link TSConstructor Special
highlight default link TSAnnotation PreProc
highlight default link TSAttribute PreProc
highlight default link TSNamespace Include
+highlight default link TSSymbol Identifier
highlight default link TSConditional Conditional
highlight default link TSRepeat Repeat
diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm
index 9080f3f40..65c5d6e2d 100644
--- a/queries/dart/highlights.scm
+++ b/queries/dart/highlights.scm
@@ -144,7 +144,7 @@
; (hex_floating_point_literal)
] @number
-(symbol_literal) @string.special
+(symbol_literal) @symbol
(string_literal) @string
(true) @boolean
(false) @boolean
diff --git a/queries/ruby/highlights.scm b/queries/ruby/highlights.scm
index e77687920..3437605c1 100644
--- a/queries/ruby/highlights.scm
+++ b/queries/ruby/highlights.scm
@@ -144,7 +144,7 @@
(simple_symbol)
(delimited_symbol)
(hash_key_symbol)
- ] @property
+ ] @symbol
(pair key: (hash_key_symbol) ":" @constant)
(regex) @string.regex