feat: Add custom callback variant of LspRequestCustom#663
feat: Add custom callback variant of LspRequestCustom#663blami wants to merge 1 commit intoyegappan:mainfrom
Conversation
|
I was wondering if it would be any useful to have also sync and async variant of RequestCustom (e.g. I was also thinking of providing noop Let me know what do you think and I can make those changes. |
46296f8 to
aa1775c
Compare
This change adds g:LspRequestCustomCb with additional callback function parameter. Original g:LspRequestCustom calls to it with WorkspaceExecuteReply as callback function for backwards compatibility.
aa1775c to
4bc0c5b
Compare
|
@jclsn Thanks for review, I agree with you. I like approach with The only other option I can think of is to have variadic argument and check for emptyness but that feels too fragile and obscure to me. Let me know what do you think now. |
|
Looks good to me, but in the end @yegappan needs to approve. |
| # Request: any | ||
| # Params: any | ||
| # Cbfunc: callback function | ||
| def g:LspRequestCustomCb(name: string, msg: string, params: any, Cbfunc: func): void |
There was a problem hiding this comment.
Can you update the help text with some details about how to use this new function?
There was a problem hiding this comment.
@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.
This change allows to provide callback function to custom requests.
Builds on #640 to accommodate scenarios where response is needed from server but cannot be handled by custom handler (as there's no
methodfield).