mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
fix(vim.ui.open): return (don't show) error message
Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
This commit is contained in:
@@ -573,15 +573,14 @@ M['window/showDocument'] = function(_, result, ctx, _)
|
||||
|
||||
if result.external then
|
||||
-- TODO(lvimuser): ask the user for confirmation
|
||||
|
||||
local ret = vim.ui.open(uri)
|
||||
local ret, err = vim.ui.open(uri)
|
||||
|
||||
if ret == nil or ret.code ~= 0 then
|
||||
return {
|
||||
success = false,
|
||||
error = {
|
||||
code = protocol.ErrorCodes.UnknownErrorCode,
|
||||
message = ret and ret.stderr or 'No handler found',
|
||||
message = ret and ret.stderr or err,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
Reference in New Issue
Block a user