mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -182,8 +182,8 @@ int tslua_add_language(lua_State *L) | |||||||
|  |  | ||||||
|   uv_lib_t lib; |   uv_lib_t lib; | ||||||
|   if (uv_dlopen(path, &lib)) { |   if (uv_dlopen(path, &lib)) { | ||||||
|     snprintf(IObuff, IOSIZE, "Failed to load parser: uv_dlopen: %s", |     snprintf(IObuff, IOSIZE, "Failed to load parser for language '%s': uv_dlopen: %s", | ||||||
|              uv_dlerror(&lib)); |              lang_name, uv_dlerror(&lib)); | ||||||
|     uv_dlclose(&lib); |     uv_dlclose(&lib); | ||||||
|     lua_pushstring(L, IObuff); |     lua_pushstring(L, IObuff); | ||||||
|     return lua_error(L); |     return lua_error(L); | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ describe('treesitter language API', function() | |||||||
|        pcall_err(exec_lua, "parser = vim.treesitter.get_parser(0, 'borklang')")) |        pcall_err(exec_lua, "parser = vim.treesitter.get_parser(0, 'borklang')")) | ||||||
|  |  | ||||||
|     -- actual message depends on platform |     -- 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')")) |        pcall_err(exec_lua, "parser = vim.treesitter.require_language('borklang', 'borkbork.so')")) | ||||||
|  |  | ||||||
|     -- Should not throw an error when silent |     -- Should not throw an error when silent | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matthieu Coudron
					Matthieu Coudron