mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
error reporting: say what query and language it was on query load failure
This is the bare minimum to not make it exceedingly painful to debug query load failures. Fixes: https://github.com/neovim/neovim/issues/33362
This commit is contained in:
parent
684eeac91e
commit
c3a3cd3139
1 changed files with 6 additions and 1 deletions
|
|
@ -105,7 +105,12 @@ do
|
|||
---@param query_name string
|
||||
function M.get_query(lang, query_name)
|
||||
if cache[lang][query_name] == nil then
|
||||
cache[lang][query_name] = ts.get_query(lang, query_name)
|
||||
local ok, err = pcall(function()
|
||||
cache[lang][query_name] = ts.get_query(lang, query_name)
|
||||
end)
|
||||
if not ok then
|
||||
error("Failed when loading query " .. query_name .. " for language " .. lang .. " error: \n" .. err)
|
||||
end
|
||||
end
|
||||
|
||||
return cache[lang][query_name]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue