Skip to content

Commit 4bc0c5b

Browse files
committed
feat: Add callback version of g:LspRequestCustom
This change adds g:LspRequestCustomCb with additional callback function parameter. Original g:LspRequestCustom calls to it with WorkspaceExecuteReply as callback function for backwards compatibility.
1 parent 50dc155 commit 4bc0c5b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

autoload/lsp/lspserver.vim

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,18 +1037,26 @@ def FindLocations(lspserver: dict<any>, peek: bool, method: string, args: dict<a
10371037
symbol.ShowLocations(lspserver, reply.result, peek, 'Symbol Locations')
10381038
enddef
10391039

1040-
# send a custom request to the server
1040+
# send a custom async request to the server
10411041
# Name: name of the server
10421042
# Request: any
10431043
# Params: any
1044-
def g:LspRequestCustom(name: string, msg: string, params: any): string
1044+
def g:LspRequestCustom(name: string, msg: string, params: any): void
1045+
g:LspRequestCustomCb(name, msg, params, WorkspaceExecuteReply)
1046+
enddef
1047+
1048+
# send a custom async request to the server with custom callback
1049+
# Name: name of the server
1050+
# Request: any
1051+
# Params: any
1052+
# Cbfunc: callback function
1053+
def g:LspRequestCustomCb(name: string, msg: string, params: any, Cbfunc: func): void
10451054
var lspserver: dict<any> = buf.CurbufGetServerByName(name)
10461055
if lspserver->empty()
1047-
return ''
1056+
return
10481057
endif
10491058

1050-
lspserver.rpc_a(msg, params, WorkspaceExecuteReply)
1051-
return ''
1059+
lspserver.rpc_a(msg, params, Cbfunc)
10521060
enddef
10531061

10541062
# process the 'textDocument/documentHighlight' reply from the LSP server

0 commit comments

Comments
 (0)