aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-07-04 23:33:23 +0200
committerJustin M. Keyes <justinkz@gmail.com>2023-07-05 00:49:10 +0200
commite644e7ce0b36dd5e75770f3faa0a84f15e2561e8 (patch)
tree32a5501e84a465b5cd1b5c315b7795854ae73d78 /runtime/lua/vim/lsp/handlers.lua
parent67b2ed1004ae551c9fe1bbd29a86b5a301570800 (diff)
downloadrneovim-e644e7ce0b36dd5e75770f3faa0a84f15e2561e8.tar.gz
rneovim-e644e7ce0b36dd5e75770f3faa0a84f15e2561e8.tar.bz2
rneovim-e644e7ce0b36dd5e75770f3faa0a84f15e2561e8.zip
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.
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 79d3f7aab0..70781cb7a6 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -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