diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-07-12 14:51:11 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-07-13 22:04:24 +0200 |
| commit | 97ad374816726661c3e5447fafd46264ad00409d (patch) | |
| tree | 24cb5de90e068c260994e10caaece5a849aa8207 /lua/nvim-treesitter/configs.lua | |
| parent | f803c74ebc1e30ae8d047c087d9b094134a667d5 (diff) | |
Fix #167: Add custom_captures config key to set highlights for custom queries
Diffstat (limited to 'lua/nvim-treesitter/configs.lua')
| -rw-r--r-- | lua/nvim-treesitter/configs.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index 85ce0f63..abf739dd 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -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) |
