mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
docs(treesitter): improve 'no parser' error message for InspectTree
Improve error messages for `:InspectTree`, when no parsers are available for the current buffer and filetype. We can show more informative and helpful error message for users (e.g., which lang was searched for): ``` ... No parser available for the given buffer: +... no parser for 'custom_ft' language, see :help treesitter-parsers ``` Also improve the relevant docs for *treesitter-parsers*.
This commit is contained in:
committed by
Lewis Russell
parent
367e52cc79
commit
fbe40caa7c
@@ -75,7 +75,8 @@ end
|
||||
function TSTreeView:new(bufnr, lang)
|
||||
local ok, parser = pcall(vim.treesitter.get_parser, bufnr or 0, lang)
|
||||
if not ok then
|
||||
return nil, 'No parser available for the given buffer'
|
||||
local err = parser --[[ @as string ]]
|
||||
return nil, 'No parser available for the given buffer:\n' .. err
|
||||
end
|
||||
|
||||
-- For each child tree (injected language), find the root of the tree and locate the node within
|
||||
|
||||
Reference in New Issue
Block a user