diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2022-08-01 22:28:36 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-08-26 13:35:17 -0700 |
| commit | d011532d737449dde60afe1cba37d57d9bea7c69 (patch) | |
| tree | d5b9ce7a0e73e3383ce4f88acf758e4157a5276f /lua | |
| parent | fix: add hint when there parser is still installed after TSUninstall (diff) | |
| download | nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.tar nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.tar.gz nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.tar.bz2 nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.tar.lz nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.tar.xz nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.tar.zst nvim-treesitter-d011532d737449dde60afe1cba37d57d9bea7c69.zip | |
fix: warn when user uninstalls parser than is in their ensure_installed
Fixes #2777
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/configs.lua | 5 | ||||
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index b720bdfd3..04099d32a 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -401,6 +401,7 @@ function M.setup(user_data) end config.modules.ensure_installed = nil + config.ensure_installed = ensure_installed recurse_modules(function(_, _, new_path) local data = utils.get_at_path(config.modules, new_path) @@ -578,4 +579,8 @@ function M.get_ignored_parser_installs() return config.ignore_install or {} end +function M.get_ensure_installed_parsers() + return config.ensure_installed or {} +end + return M diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 8e2e81468..271220db7 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -489,6 +489,16 @@ function M.uninstall(...) return api.nvim_err_writeln(err) end + if vim.tbl_contains(configs.get_ensure_installed_parsers(), lang) then + vim.notify( + "Uninstalling " + .. lang + .. '. But the parser is still configured in "ensure_installed" setting of nvim-treesitter.' + .. " Please consider updating your config!", + vim.log.levels.ERROR + ) + end + local parser_lib = utils.join_path(install_dir, lang) .. ".so" local all_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true) if vim.fn.filereadable(parser_lib) == 1 then |
