I am writing an LSP server and vscode client and there is a server-side CodeAction that I wish the user to be able to invoke at any time when their cursor is in a text file.
I can see how I can define custom codeactions on the server side, but I just don't know how to expose them on the client side.
e.g. imagine I want the action "CrAzYcAsE at point", I want that to show up as an option in the menu when the user right-clicks anywhere in the file (and I want them to be able to bind this to a key combination if they wish, perhaps even having a default).
In many ways this is the reverse of Is there a way to execute a custom action through the CodeAction request?
I suspect that the answer may be to define a custom Command as per https://code.visualstudio.com/api/references/vscode-api#commands but that doesn't give any examples of a Command that calls the LSP's CodeAction endpoint.
Note that I cannot implement this as a CodeAction "quickfix", since only the user knows when it is relevant to call the action. Registering a quickfix would mean that the yellow question mark would show up on all lines for the user, which would be super distracting for the user.