mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-21 20:11:06 +00:00
fix(treesitter): properly update installedd languages after setup
This commit is contained in:
parent
1c14d858e5
commit
c28f599d4f
2 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue