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
|
-- setup treesitter
|
||||||
TS.setup(opts)
|
TS.setup(opts)
|
||||||
|
|
||||||
|
LazyVim.treesitter.get_installed(true) -- initialize the installed langs
|
||||||
|
|
||||||
-- install missing parsers
|
-- install missing parsers
|
||||||
local install = vim.tbl_filter(function(lang)
|
local install = vim.tbl_filter(function(lang)
|
||||||
return not LazyVim.treesitter.have(lang)
|
return not LazyVim.treesitter.have(lang)
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,15 @@ local M = {}
|
||||||
|
|
||||||
M._installed = nil ---@type table<string,string>?
|
M._installed = nil ---@type table<string,string>?
|
||||||
|
|
||||||
---@param force boolean?
|
---@param update boolean?
|
||||||
function M.get_installed(force)
|
function M.get_installed(update)
|
||||||
if not M._installed or force then
|
if update then
|
||||||
M._installed = {}
|
M._installed = {}
|
||||||
for _, lang in ipairs(require("nvim-treesitter").get_installed("parsers")) do
|
for _, lang in ipairs(require("nvim-treesitter").get_installed("parsers")) do
|
||||||
M._installed[lang] = lang
|
M._installed[lang] = lang
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return M._installed
|
return M._installed or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param ft string
|
---@param ft string
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue