diff options
author | Stephan Seitz <stephan.seitz@fau.de> | 2021-06-10 21:34:45 +0200 |
---|---|---|
committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-08-06 22:04:28 +0200 |
commit | f489d98653845f0e7501434f8873bad6feccf19c (patch) | |
tree | ad803c425779d48b9bfe868ff43b8f77ccd7e565 /runtime/lua/vim/treesitter/highlighter.lua | |
parent | f22326ef0914b724440705cf8578c4146a6785bc (diff) | |
download | rneovim-f489d98653845f0e7501434f8873bad6feccf19c.tar.gz rneovim-f489d98653845f0e7501434f8873bad6feccf19c.tar.bz2 rneovim-f489d98653845f0e7501434f8873bad6feccf19c.zip |
fix(treesitter): do not map hl_group when no mapping is set
This changes the behavior of the hl_cache to the old one.
- when the capture exists as a hlgroup -> use it
- when hl_map contains a mapping -> use it
- else do nothing (before: map capture to non-existing capture)
Before also captures `@foo.bar` would intend to use the hlgroup `foo.bar`
which results in a confusing error since hlgroups can't contain dots.
Diffstat (limited to 'runtime/lua/vim/treesitter/highlighter.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/highlighter.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/highlighter.lua b/runtime/lua/vim/treesitter/highlighter.lua index cf3cdf4505..45eb941db7 100644 --- a/runtime/lua/vim/treesitter/highlighter.lua +++ b/runtime/lua/vim/treesitter/highlighter.lua @@ -116,7 +116,7 @@ function TSHighlighterQuery:_get_hl_from_capture(capture) -- From "Normal.left" only keep "Normal" return vim.split(name, '.', true)[1], true else - return TSHighlighter.hl_map[name] or name, false + return TSHighlighter.hl_map[name] or 0, false end end |