aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/language.lua
diff options
context:
space:
mode:
authorGuilherme Soares <48023091+guilhas07@users.noreply.github.com>2025-01-10 22:46:19 +0000
committerGitHub <noreply@github.com>2025-01-10 14:46:19 -0800
commitaa2b44fbb07f3ab4dd00ea4a3ae7c5d31bc20a9d (patch)
tree19937d9dc2206036b33a10838bb597bdff7f7246 /runtime/lua/vim/treesitter/language.lua
parent37c77ab46baaeadb7c3cc5f3b77bd8ca1d7cd0da (diff)
downloadrneovim-aa2b44fbb07f3ab4dd00ea4a3ae7c5d31bc20a9d.tar.gz
rneovim-aa2b44fbb07f3ab4dd00ea4a3ae7c5d31bc20a9d.tar.bz2
rneovim-aa2b44fbb07f3ab4dd00ea4a3ae7c5d31bc20a9d.zip
fix(treesitter): don't return error message on success #31955
Problem: The `vim.treesitter.language.add` function returns a error message even when it succeeds. Solution: Don't return error message on success.
Diffstat (limited to 'runtime/lua/vim/treesitter/language.lua')
-rw-r--r--runtime/lua/vim/treesitter/language.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index 446051dfd7..238a078703 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -133,8 +133,9 @@ function M.add(lang, opts)
path = paths[1]
end
- return loadparser(path, lang, symbol_name) or nil,
- string.format('Cannot load parser %s for language "%s"', path, lang)
+ local res = loadparser(path, lang, symbol_name)
+ return res,
+ res == nil and string.format('Cannot load parser %s for language "%s"', path, lang) or nil
end
--- @param x string|string[]