I am working on the following lang server functionality and would love some advice on implementation:
The language I’m implementing the language server for has a “typed hole” syntax construct represented as an underscore _, e.g., let a : int = _.
Currently the language server can offer several ways to fill up that hole, i.e., it can generate various constructs based on the values in the context that fill the hole in a well-typed manner; for the example above, the language server would offer 0, 1 , or say someStringVar.toInt() .
Now I would like to come up with a way to offer this functionality in a way that’d use only language server functionality, so that all editors would support this functionality without a manual lsp client manipulation. Is that possible? If yes, how’d you think? My idea was maybe to offer a code action Construct, if the user uses that code action, the client must send auto-completion request that would replace the hole with one of the values returned from the language server for that hole. If you think that’s a good idea, is it possible to ask a language client to send a particular request to the server so that this command is compatible with majority of editors?
Another way is of course just to use a code action and manually propose different values using a QuickPick but that'd be vscode-specific.
Thanks!