feat(treesitter)!: remove silent option from language.add()

Simply use `pcall` if you want to silence an error.
This commit is contained in:
Lewis Russell
2023-02-24 09:50:59 +00:00
committed by GitHub
parent 306e673583
commit c57af5d41c
4 changed files with 14 additions and 30 deletions

View File

@@ -20,10 +20,9 @@ describe('treesitter language API', function()
matches("Failed to load parser for language 'borklang': uv_dlopen: .+",
pcall_err(exec_lua, "parser = vim.treesitter.add('borklang', { path = 'borkbork.so' })"))
-- Should not throw an error when silent
eq(false, exec_lua("return vim.treesitter.add('borklang', { silent = true })"))
eq(false, exec_lua("return pcall(vim.treesitter.add, 'borklang')"))
eq(false, exec_lua("return vim.treesitter.add('borklang', { path = 'borkbork.so', silent = true })"))
eq(false, exec_lua("return pcall(vim.treesitter.add, 'borklang', { path = 'borkbork.so' })"))
eq(".../language.lua:0: no parser for 'borklang' language, see :help treesitter-parsers",
pcall_err(exec_lua, "parser = vim.treesitter.inspect_language('borklang')"))