fix(treesitter): de-duplicate langs in endure_installed. Fixes #628

This commit is contained in:
Folke Lemaitre 2023-04-19 16:44:57 +02:00
parent 0b8c799a7a
commit 1d2c97cbda
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -67,6 +67,17 @@ return {
}, },
---@param opts TSConfig ---@param opts TSConfig
config = function(_, opts) config = function(_, opts)
if type(opts.ensure_installed) == "table" then
---@type table<string, boolean>
local added = {}
opts.ensure_installed = vim.tbl_filter(function(lang)
if added[lang] then
return false
end
added[lang] = true
return true
end, opts.ensure_installed)
end
require("nvim-treesitter.configs").setup(opts) require("nvim-treesitter.configs").setup(opts)
end, end,
}, },