Description
combineResponses
is suspicious in two ways:
- It does more than combine responses
- For code actions it does a whole bunch of compatibility stuff and filters down to the requested code action kinds: https://github.com/haskell/haskell-language-server/blob/master/hls-plugin-api/src/Ide/Types.hs#L181
- For document symbols, it does some compatibility stuff: https://github.com/haskell/haskell-language-server/blob/master/hls-plugin-api/src/Ide/Types.hs#L227
These are important things to do, but doing them in combineResponses
is definitely the wrong place. If nothing else, it means that any handlers which don't go through PluginMethod
won't benefit from this logic!
I'm not sure where this stuff should live, maybe even upstream in lsp
somewhere. Perhaps we could provide a conformance/compatibility handler-transformer than does this stuff...
- it has no way to signal errors, so does some "arbitrary" choosing
For formatting providers and custom methods, there is no way to combine responses, so it just picks the first response! IMO this isn't great: if you do end up with multiple plugins which have handlers for those methods, one of them will just not work at random. Better to signal some kind of error ("you've enabled plugins A and B which both provide formatting, please disable one of them").
cc @wz1000 who wrote most of this originally.