diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-08-30 21:06:09 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-08-31 21:34:57 +0200 |
| commit | 08f1a8561fcaad08930994c594d4f43944d07a26 (patch) | |
| tree | 4a2592663ef776a711be065e3c0a615420b5765d /lua | |
| parent | feat(refactor.navigation): add navigation.goto_{next,previous}_usage (diff) | |
| download | nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.tar nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.tar.gz nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.tar.bz2 nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.tar.lz nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.tar.xz nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.tar.zst nvim-treesitter-08f1a8561fcaad08930994c594d4f43944d07a26.zip | |
Avoid enabling disabled modules (even if they were disabled immediately)
This might be safer for the case that attach/detach are not inverse to
each other. Disabled modules shouldn't ever be activated.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/configs.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index 5fba72348..c66838d9b 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -151,7 +151,9 @@ local function enable_mod_conf_autocmd(mod, lang) end end -local function enable_all(mod, lang) +local function enable_all(mod, lang, blocklist) + blocklist = blocklist or {} + local config_mod = M.get_module(mod) if not config_mod then return end @@ -159,7 +161,9 @@ local function enable_all(mod, lang) for _, bufnr in pairs(api.nvim_list_bufs()) do local ft = api.nvim_buf_get_option(bufnr, 'ft') if not lang or parsers.lang_match_ft(lang, ft) then - enable_module(mod, bufnr, lang) + if not vim.tbl_contains(blocklist, lang) then + enable_module(mod, bufnr, lang) + end end end if lang then @@ -168,7 +172,7 @@ local function enable_all(mod, lang) end else for _, lang in pairs(parsers.available_parsers()) do - if parsers.has_parser(lang) then + if parsers.has_parser(lang) and not vim.tbl_contains(blocklist, lang) then enable_mod_conf_autocmd(mod, lang) end end @@ -306,12 +310,9 @@ function M.setup(user_data) recurse_modules(function(_, _, new_path) if data.enable then - enable_all(new_path) + enable_all(new_path, nil, data.disable) end - for _, lang in ipairs(data.disable or {}) do - disable_mod_conf_autocmd(new_path, lang) - end end, config.modules) end end |
