[go: up one dir, main page]

Skip to content

Commit

Permalink
feat(treesitter): show filetype associated with parser (#17633)
Browse files Browse the repository at this point in the history
to ease debug. At one point I had an empty filetype and the current message was not helpful enough
  • Loading branch information
teto authored Jan 22, 2023
1 parent 80bede1 commit 151b9fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/nvim/lua/treesitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ int tslua_add_language(lua_State *L)

uv_lib_t lib;
if (uv_dlopen(path, &lib)) {
snprintf(IObuff, IOSIZE, "Failed to load parser: uv_dlopen: %s",
uv_dlerror(&lib));
snprintf(IObuff, IOSIZE, "Failed to load parser for language '%s': uv_dlopen: %s",
lang_name, uv_dlerror(&lib));
uv_dlclose(&lib);
lua_pushstring(L, IObuff);
return lua_error(L);
Expand Down
2 changes: 1 addition & 1 deletion test/functional/treesitter/language_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('treesitter language API', function()
pcall_err(exec_lua, "parser = vim.treesitter.get_parser(0, 'borklang')"))

-- actual message depends on platform
matches("Failed to load parser: uv_dlopen: .+",
matches("Failed to load parser for language 'borklang': uv_dlopen: .+",
pcall_err(exec_lua, "parser = vim.treesitter.require_language('borklang', 'borkbork.so')"))

-- Should not throw an error when silent
Expand Down

0 comments on commit 151b9fc

Please sign in to comment.