mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(treesitter): really restore syntax
- also unset b:ts_highlight on stop() Fixes: #21836
This commit is contained in:
parent
0344bfad0f
commit
20b7be2d10
@ -88,7 +88,6 @@ function TSHighlighter.new(tree, opts)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.orig_syntax = vim.bo[self.bufnr].syntax
|
|
||||||
self.orig_spelloptions = vim.bo[self.bufnr].spelloptions
|
self.orig_spelloptions = vim.bo[self.bufnr].spelloptions
|
||||||
|
|
||||||
vim.bo[self.bufnr].syntax = ''
|
vim.bo[self.bufnr].syntax = ''
|
||||||
@ -120,8 +119,11 @@ function TSHighlighter:destroy()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if vim.api.nvim_buf_is_loaded(self.bufnr) then
|
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
|
vim.bo[self.bufnr].spelloptions = self.orig_spelloptions
|
||||||
|
vim.b[self.bufnr].ts_highlight = nil
|
||||||
|
if vim.g.syntax_on == 1 then
|
||||||
|
a.nvim_exec_autocmds('FileType', { group = 'syntaxset', buffer = self.bufnr })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user