From: Andreas Louv Date: Thu, 23 Mar 2023 14:28:22 +0000 (+0100) Subject: Disable default rpc error handler for GotoSymbolLoc X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=0b5594166ef56821289289a46e404816496f809b;p=vim-lsp.git Disable default rpc error handler for GotoSymbolLoc --- diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index e750c02..dc5a722 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -598,7 +598,7 @@ enddef # Send a sync RPC request message to the LSP server and return the received # reply. In case of an error, an empty Dict is returned. -def Rpc(lspserver: dict, method: string, params: any): dict +def Rpc(lspserver: dict, method: string, params: any, handleError: bool = true): dict var req = {} req.method = method req.params = {} @@ -622,7 +622,7 @@ def Rpc(lspserver: dict, method: string, params: any): dict return reply endif - if reply->has_key('error') + if handleError && reply->has_key('error') # request failed var emsg: string = reply.error.message emsg ..= $', code = {reply.error.code}' @@ -883,7 +883,7 @@ enddef # Result: Location | Location[] | LocationLink[] | null def GotoSymbolLoc(lspserver: dict, msg: string, peekSymbol: bool, cmdmods: string) - var reply = lspserver.rpc(msg, GetLspTextDocPosition(true)) + var reply = lspserver.rpc(msg, GetLspTextDocPosition(true), false) if reply->empty() || reply.result->empty() var emsg: string if msg ==# 'textDocument/declaration'