Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions autoload/lsp/lspserver.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1037,18 +1037,26 @@ def FindLocations(lspserver: dict<any>, peek: bool, method: string, args: dict<a
symbol.ShowLocations(lspserver, reply.result, peek, 'Symbol Locations')
enddef

# send a custom request to the server
# send a custom async request to the server
# Name: name of the server
# Request: any
# Params: any
def g:LspRequestCustom(name: string, msg: string, params: any): string
def g:LspRequestCustom(name: string, msg: string, params: any): void
g:LspRequestCustomCb(name, msg, params, WorkspaceExecuteReply)
enddef

# send a custom async request to the server with custom callback
# Name: name of the server
# Request: any
# Params: any
# Cbfunc: callback function
def g:LspRequestCustomCb(name: string, msg: string, params: any, Cbfunc: func): void
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the help text with some details about how to use this new function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yegappan @jclsn Sure I can. I actually did bit of investigation and learning and feel in my specific usecase this should not be needed and it is language server for which I do this being wrong and anything that edits workspace should be really code action and not custom request.

Anyway I think there's still some use for this and g:LspRequestCustom. As I got more familiar with codebase I now think that rather than making both these g: it would be actually better to export in lsp.vim as in case of other functions that are used by commands.

var lspserver: dict<any> = buf.CurbufGetServerByName(name)
if lspserver->empty()
return ''
return
endif

lspserver.rpc_a(msg, params, WorkspaceExecuteReply)
return ''
lspserver.rpc_a(msg, params, Cbfunc)
enddef

# process the 'textDocument/documentHighlight' reply from the LSP server
Expand Down