mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(ts): check buffer is loaded when restoring options (#21419)
fix(treesitter): check buffer is loaded when restoring options Also restore spelloptions Fixes #21416
This commit is contained in:
@@ -89,6 +89,8 @@ function TSHighlighter.new(tree, opts)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.orig_syntax = vim.bo[self.bufnr].syntax
|
self.orig_syntax = vim.bo[self.bufnr].syntax
|
||||||
|
self.orig_spelloptions = vim.bo[self.bufnr].spelloptions
|
||||||
|
|
||||||
vim.bo[self.bufnr].syntax = ''
|
vim.bo[self.bufnr].syntax = ''
|
||||||
vim.b[self.bufnr].ts_highlight = true
|
vim.b[self.bufnr].ts_highlight = true
|
||||||
|
|
||||||
@@ -117,7 +119,10 @@ function TSHighlighter:destroy()
|
|||||||
TSHighlighter.active[self.bufnr] = nil
|
TSHighlighter.active[self.bufnr] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.bo[self.bufnr].syntax = self.orig_syntax
|
if vim.api.nvim_buf_is_loaded(self.bufnr) then
|
||||||
|
vim.bo[self.bufnr].syntax = self.orig_syntax
|
||||||
|
vim.bo[self.bufnr].spelloptions = self.orig_spelloptions
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@private
|
---@private
|
||||||
|
Reference in New Issue
Block a user