Closed
Description
As can be seen here https://github.com/haskell/haskell-language-server/blob/master/hls-plugin-api/src/Ide/Types.hs#L555 HLS always returns the first response for jump-to-definition, which happens to be ghcide. Multiple responses could be combined into one, by turning LocationLink
into a Location
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
michaelpj commentedon Jun 10, 2023
In fact, I think
Location
can be turned intoLocationLink
, which is the richer type:uri
->targetUri
range
->targetRange
range
->targetSelectionRange
originSelectionRange
And the other direction:
targetRange
->range
targetUri
->uri
So I think what we would want to do is check the client capability for
LocationLink
support, and depending on whether it's set translateLocation
s toLocationLink
s or vice versa.michaelpj commentedon Jun 10, 2023
... and then just concatenate the results
joyfulmantis commentedon Jun 10, 2023
Currently the type the plugins provide for is the same as the ones lsp sends on to the client. I was thinking it would be nice to have a type the plugins need to provide that is separate from the actual method type the client accepts, specifically by being more specific. In this case only accepting locationlink for example, and then refactor the combine responses to convert that type into the client accepted type (ideally by querying capabilities) before combining. Separate types would allow us to enforce that the plugin is only returning our preferred type.
michaelpj commentedon Jun 10, 2023
Yeah, I agree that that would be nice, might be a bit of a pain to implement. But we could almost certainly provide types that are e.g. easier to combine.
jvanbruegge commentedon Nov 29, 2023
This was fixed by #3846