Skip to content

Commit

Permalink
fix(treesitter): do not map hl_group when no mapping is set
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theHamsta committed Aug 6, 2021
1 parent f22326e commit f489d98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/lua/vim/treesitter/highlighter.lua
Expand Up @@ -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

Expand Down

0 comments on commit f489d98

Please sign in to comment.