From 0f067cd34d09b38f9aaf2e1732d825e89b573077 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sat, 14 Sep 2024 12:57:33 -0700 Subject: fix(treesitter): suppress get_parser warnings via opts.error --- runtime/doc/treesitter.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index fea469e63b..21accda2a5 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -818,6 +818,11 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* If needed, this will create the parser. + If no parser can be created, an error is thrown. Set `opts.error = false` + to suppress this and return nil (and an error message) instead. WARNING: + This behavior will become default in Nvim 0.12 and the option will be + removed. + Parameters: ~ • {bufnr} (`integer?`) Buffer the parser should be tied to (default: current buffer) @@ -825,8 +830,9 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* filetype) • {opts} (`table?`) Options to pass to the created language tree - Return: ~ - (`vim.treesitter.LanguageTree`) object to use for parsing + Return (multiple): ~ + (`vim.treesitter.LanguageTree?`) object to use for parsing + (`string?`) error message, if applicable get_range({node}, {source}, {metadata}) *vim.treesitter.get_range()* Get the range of a |TSNode|. Can also supply {source} and {metadata} to -- cgit