aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-09-27 18:08:05 -0700
committerChristian Clason <c.clason@uni-graz.at>2024-09-28 10:54:45 +0200
commit4349bdbd0bd0096b4f4bea0feda0961e3b03f3cc (patch)
tree6e5f3926f4ab2fe6b380f13bf5c951655653d708 /runtime/lua/vim
parent4f9311b759fff0371433fb5b5355fccb001d54e7 (diff)
downloadrneovim-4349bdbd0bd0096b4f4bea0feda0961e3b03f3cc.tar.gz
rneovim-4349bdbd0bd0096b4f4bea0feda0961e3b03f3cc.tar.bz2
rneovim-4349bdbd0bd0096b4f4bea0feda0961e3b03f3cc.zip
fix(treesitter): specify success status in edit_query return value
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/treesitter/dev.lua4
-rw-r--r--runtime/lua/vim/treesitter/query.lua6
2 files changed, 5 insertions, 5 deletions
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index dbf0e73250..6a2f7ae936 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -579,6 +579,8 @@ end
--- @private
--- @param lang? string language to open the query editor for.
+--- @return boolean? `true` on success, `nil` on failure
+--- @return string? error message, if applicable
function M.edit_query(lang)
local buf = api.nvim_get_current_buf()
local win = api.nvim_get_current_win()
@@ -678,6 +680,8 @@ function M.edit_query(lang)
})
vim.cmd('normal! G')
vim.cmd.startinsert()
+
+ return true
end
return M
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 758c8bb356..135250578e 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -1028,11 +1028,7 @@ end
---
--- @param lang? string language to open the query editor for. If omitted, inferred from the current buffer's filetype.
function M.edit(lang)
- -- TODO(ribru17): Make edit_query return true upon success so we can just assert here
- local _, err_msg = vim.treesitter.dev.edit_query(lang)
- if err_msg then
- error(err_msg)
- end
+ assert(vim.treesitter.dev.edit_query(lang))
end
return M