Description
We have multiple reports, where resolve
requests (such as completion/resolve
and codeAction/resolve
) are rejected by HLS since the _data
field of the respective LSP feature has not been populated by HLS. This makes sense, as we only support resolve
for certain kinds of CodeAction
/Completions
, when they contain particularly expensive properties, such as documentation or non-local type signatures.
In #4463, I added a plaster for completions, deciding to always add the _data
field, which allows our run-time system to resolve such requests to the completion plugin.
While this should work for completions, we have the same issue with completions provided by the hls-cabal-plugin
, which serves completions for .cabal
files.
Moreover, multiple plugins provide CodeAction
s but not necessarily CodeAction/resolve
handlers, causing HLS to reject such requests.
This behaviour is troublesome, as vim clients (maybe emacs as well) seemingly show such rejections prominently in the UI, perhaps even outright not applying already present Codefixes.
The solution might be something like this:
If the _data
field is Nothing
we do not try to resolve a */resolve
request to a specific plugin, but always return the request data unchanged. If the _data
field is provided, we try to thread the */resolve
request to the plugin which presumably handles the request.
We only reject the request, if the _data
field is given, but no plugin owner can be determined.
This behaviour differs from the current behaviour only regarding how to handle _data = Nothing
case, in which case we rejected the request.