neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 151b9fc52e3cd69b386eb2dc4e5a0d179667190b
parent 80bede1dfc6c2fcd5ec013045585802bb18d9fc9
Author: Matthieu Coudron <teto@users.noreply.github.com>
Date:   Sun, 22 Jan 2023 16:51:17 +0100

feat(treesitter): show filetype associated with parser (#17633)

to ease debug. At one point I had an empty filetype and the current message was not helpful enough
Diffstat:
Msrc/nvim/lua/treesitter.c | 4++--
Mtest/functional/treesitter/language_spec.lua | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c @@ -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); diff --git a/test/functional/treesitter/language_spec.lua b/test/functional/treesitter/language_spec.lua @@ -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