mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 14:30:05 -04:00
Fix #167: Add custom_captures config key to set highlights for custom queries
This commit is contained in:
parent
f803c74ebc
commit
97ad374816
4 changed files with 33 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ local builtin_modules = {
|
|||
module_path = 'nvim-treesitter.highlight',
|
||||
enable = false,
|
||||
disable = {},
|
||||
custom_captures = {},
|
||||
is_supported = queries.has_highlights
|
||||
},
|
||||
incremental_selection = {
|
||||
|
|
@ -61,6 +62,8 @@ local builtin_modules = {
|
|||
}
|
||||
}
|
||||
|
||||
local special_config_keys = {'enable', 'disable', 'keymaps'}
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Resolves a module by requiring the `module_path` or using the module definition.
|
||||
|
|
@ -276,6 +279,12 @@ function M.setup_module(mod, data, mod_name)
|
|||
end
|
||||
end
|
||||
end
|
||||
for k, v in pairs(data) do
|
||||
-- Just copy all non-special configuration keys
|
||||
if not vim.tbl_contains(special_config_keys, k) then
|
||||
mod[k] = v
|
||||
end
|
||||
end
|
||||
elseif type(data) == 'table' and type(mod) == 'table' then
|
||||
for key, value in pairs(mod) do
|
||||
M.setup_module(value, data[key], key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue