Skip to content

Plugins cannot define jump-to-definition handlers (responses are not combined) #3634

Closed
@jvanbruegge

Description

@jvanbruegge
Collaborator

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

Activity

added
type: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..
on Jun 10, 2023
michaelpj

michaelpj commented on Jun 10, 2023

@michaelpj
Collaborator

In fact, I think Location can be turned into LocationLink, which is the richer type:

  • uri -> targetUri
  • range -> targetRange
  • range -> targetSelectionRange
  • don't provide 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 translate Locations to LocationLinks or vice versa.

michaelpj

michaelpj commented on Jun 10, 2023

@michaelpj
Collaborator

... and then just concatenate the results

joyfulmantis

joyfulmantis commented on Jun 10, 2023

@joyfulmantis
Collaborator

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

michaelpj commented on Jun 10, 2023

@michaelpj
Collaborator

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

jvanbruegge commented on Nov 29, 2023

@jvanbruegge
CollaboratorAuthor

This was fixed by #3846

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

level: easyThe issue is suited for beginnerstype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @jvanbruegge@michaelpj@joyfulmantis@fendor

      Issue actions

        Plugins cannot define jump-to-definition handlers (responses are not combined) · Issue #3634 · haskell/haskell-language-server