Install the language first

This commit is contained in:
Nick Krichevsky
2026-09-08 14:15:08 -04:00
parent bd5406e3f8
commit 3711862977
+3 -2
View File
@@ -954,11 +954,12 @@ do
---@param buf integer
---@param language string
local function treesitter_try_attach(buf, language)
-- Check if a parser exists and load it
if not vim.treesitter.language.add(language) then return end
-- Check if the buffer is valid (might not be after install completes)
if not vim.api.nvim_buf_is_valid(buf) then return end
-- Check if a parser exists and load it
if not vim.treesitter.language.add(language) then return end
-- Enable syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)