Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lua/astrocore/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ end
---@param bufnr? integer the buffer to enable treesitter in
function M.enable(bufnr)
if not bufnr then bufnr = vim.api.nvim_get_current_buf() end
-- Check if buffer is valid (may have been deleted during async operations)
if not vim.api.nvim_buf_is_valid(bufnr) then return end
local ft = vim.bo[bufnr].filetype
local lang = vim.treesitter.language.get_lang(ft)
if not M.has_parser(ft) or not lang then return end
Expand Down
Loading