aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authormarshmallow <marshycity@gmail.com>2023-04-30 15:53:02 +1000
committerJustin M. Keyes <justinkz@gmail.com>2023-07-04 23:45:00 +0200
commitaf6e6ccf3dee815850639ec5613dda3442caa7d6 (patch)
tree8425b2b0dcf6592dd5f8a25d63187f337a047a2e /runtime/lua/vim/lsp/handlers.lua
parent3ecd45ded044c47efa76b74e9e3b720fbe27adc7 (diff)
downloadrneovim-af6e6ccf3dee815850639ec5613dda3442caa7d6.tar.gz
rneovim-af6e6ccf3dee815850639ec5613dda3442caa7d6.tar.bz2
rneovim-af6e6ccf3dee815850639ec5613dda3442caa7d6.zip
feat(vim.ui): vim.ui.open, "gx" without netrw
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com> Co-authored-by: ii14 <59243201+ii14@users.noreply.github.com>
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua15
1 files changed, 4 insertions, 11 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 625a2ed282..9b102c0f84 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -573,22 +573,15 @@ M['window/showDocument'] = function(_, result, ctx, _)
if result.external then
-- TODO(lvimuser): ask the user for confirmation
- local cmd
- if vim.fn.has('win32') == 1 then
- cmd = { 'cmd.exe', '/c', 'start', '""', uri }
- elseif vim.fn.has('macunix') == 1 then
- cmd = { 'open', uri }
- else
- cmd = { 'xdg-open', uri }
- end
- local ret = vim.fn.system(cmd)
- if vim.v.shell_error ~= 0 then
+ local ret = vim.ui.open(uri)
+
+ if ret.code ~= 0 or ret == nil then
return {
success = false,
error = {
code = protocol.ErrorCodes.UnknownErrorCode,
- message = ret,
+ message = ret and ret.stderr or 'No handler could be found',
},
}
end