mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(treesitter): specify success status in edit_query return value
This commit is contained in:
parent
4f9311b759
commit
4349bdbd0b
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user