mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
fix(treesitter): don't spam query errors in the highlighter
**Problem:** An erroneous query in the treesitter highlighter gives a deluge of errors that makes the editor almost unusable. **Solution:** Detach the highlighter after an error is detected, so that it only gets displayed once (per highlighter instance).
This commit is contained in:
committed by
Christian Clason
parent
36f44b3121
commit
b0bbe25c48
@ -232,7 +232,12 @@ end
|
||||
---@return vim.treesitter.highlighter.Query
|
||||
function TSHighlighter:get_query(lang)
|
||||
if not self._queries[lang] then
|
||||
self._queries[lang] = TSHighlighterQuery.new(lang)
|
||||
local success, result = pcall(TSHighlighterQuery.new, lang)
|
||||
if not success then
|
||||
self:destroy()
|
||||
error(result)
|
||||
end
|
||||
self._queries[lang] = result
|
||||
end
|
||||
|
||||
return self._queries[lang]
|
||||
|
Reference in New Issue
Block a user