refacto: expose a function to set custom capture for the higlighter

BREAKING: deprecate custom_captures from highlight config.
This allows plugin authors to extend the map. It also avoids settings
user configuration specific values during the highlighter
initialization (SOC).
Not sure how much value this brings, and might potentially break a lot
of people configurations. This is questionable.
This commit is contained in:
kiyan 2022-02-06 15:15:42 +01:00 committed by Stephan Seitz
parent af71c25edc
commit 560e8fb450
4 changed files with 31 additions and 19 deletions

View file

@ -22,8 +22,9 @@ local is_initialized = false
local builtin_modules = {
highlight = {
module_path = "nvim-treesitter.highlight",
enable = false,
-- @deprecated: use `highlight.set_custom_captures` instead
custom_captures = {},
enable = false,
is_supported = function(lang)
return queries.has_highlights(lang)
end,