diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2023-07-05 00:30:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-05 00:30:05 -0700 |
commit | 5936a88f181e52e17484d4ae6dfaea7d50d43935 (patch) | |
tree | ef727393e94037e5a675f566b59b1014f8fe2a29 /runtime/lua/vim/lsp/handlers.lua | |
parent | b2e8c0df2062f765a4cf7d96379c5f0f19393dfd (diff) | |
parent | e644e7ce0b36dd5e75770f3faa0a84f15e2561e8 (diff) | |
download | rneovim-5936a88f181e52e17484d4ae6dfaea7d50d43935.tar.gz rneovim-5936a88f181e52e17484d4ae6dfaea7d50d43935.tar.bz2 rneovim-5936a88f181e52e17484d4ae6dfaea7d50d43935.zip |
Merge #23401 vim.ui.open: "gx" without netrw
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 625a2ed282..70781cb7a6 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -573,22 +573,14 @@ 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, err = vim.ui.open(uri) - local ret = vim.fn.system(cmd) - if vim.v.shell_error ~= 0 then + if ret == nil or ret.code ~= 0 then return { success = false, error = { code = protocol.ErrorCodes.UnknownErrorCode, - message = ret, + message = ret and ret.stderr or err, }, } end @@ -600,7 +592,7 @@ M['window/showDocument'] = function(_, result, ctx, _) local client = vim.lsp.get_client_by_id(client_id) local client_name = client and client.name or string.format('id=%d', client_id) if not client then - err_message({ 'LSP[', client_name, '] client has shut down after sending ', ctx.method }) + err_message('LSP[', client_name, '] client has shut down after sending ', ctx.method) return vim.NIL end |