mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
fix(treesitter): properly update installedd languages after setup
This commit is contained in:
@@ -68,6 +68,8 @@ return {
|
||||
-- setup treesitter
|
||||
TS.setup(opts)
|
||||
|
||||
LazyVim.treesitter.get_installed(true) -- initialize the installed langs
|
||||
|
||||
-- install missing parsers
|
||||
local install = vim.tbl_filter(function(lang)
|
||||
return not LazyVim.treesitter.have(lang)
|
||||
|
||||
@@ -3,15 +3,15 @@ local M = {}
|
||||
|
||||
M._installed = nil ---@type table<string,string>?
|
||||
|
||||
---@param force boolean?
|
||||
function M.get_installed(force)
|
||||
if not M._installed or force then
|
||||
---@param update boolean?
|
||||
function M.get_installed(update)
|
||||
if update then
|
||||
M._installed = {}
|
||||
for _, lang in ipairs(require("nvim-treesitter").get_installed("parsers")) do
|
||||
M._installed[lang] = lang
|
||||
end
|
||||
end
|
||||
return M._installed
|
||||
return M._installed or {}
|
||||
end
|
||||
|
||||
---@param ft string
|
||||
|
||||
Reference in New Issue
Block a user