mirror of
https://github.com/nvim-lua/kickstart.nvim.git
synced 2026-09-25 13:31:16 -07:00
Check if the buffer is valid when trying to attach TS
This commit is contained in:
@@ -954,6 +954,9 @@ do
|
|||||||
---@param buf integer
|
---@param buf integer
|
||||||
---@param language string
|
---@param language string
|
||||||
local function treesitter_try_attach(buf, language)
|
local function treesitter_try_attach(buf, language)
|
||||||
|
-- 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
|
-- Check if a parser exists and load it
|
||||||
if not vim.treesitter.language.add(language) then return end
|
if not vim.treesitter.language.add(language) then return end
|
||||||
-- Enable syntax highlighting and other treesitter features
|
-- Enable syntax highlighting and other treesitter features
|
||||||
|
|||||||
Reference in New Issue
Block a user