haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Go to definition for OverloadedRecordDot

Open theobat opened this issue 1 year ago • 5 comments

First of all thanks everyone for all the good work, it's of tremendous help.

The project on which I encountered this issue is stack.

Your environment

Which OS do you use? MacOS Which version of GHC do you use and how did you install it? Tool versions found on the $PATH cabal: 3.8.1.0 stack: 2.13.1 ghc: 9.6.3 How is your project built (alternative: link to the project)? stack

Which LSP client (editor/plugin) do you use? vscode Which version of HLS do you use and how did you install it? 2.5.0.0, through ghcup Have you configured HLS in any way (especially: a hie.yaml file)? nope

What's wrong?

When using the overloaded record dot syntax for records, I have the correct type information but I can't click on the field to be redirected to the record it concerns. I'm not sure it's possible for hls to do that, but I'd be interested to implement it if it is.

I suppose it all amounts to being able to redirect to the correct record when the HasField instance is unified to a known symbol & record type.

theobat avatar Jan 15 '24 10:01 theobat

Huh, I really thought we had this. Was this not part of the work you did @coltenwebb ?

michaelpj avatar Jan 15 '24 16:01 michaelpj

No, linking to the definition wasn't part of my work. I remember looking into it but I think it would've required some significant work in ghc at the time. At least according to this comment I wrote, ghc doesn't give the location of the definition in HieAST.

coltenwebb avatar Jan 16 '24 17:01 coltenwebb

Okay, that's good to know. Did we ever have an upstream GHC ticket for that?

michaelpj avatar Jan 16 '24 17:01 michaelpj

Don't think so, a quick search didn't turn up anything

coltenwebb avatar Jan 16 '24 20:01 coltenwebb

My understanding @coltenwebb is that your comment refers to missing information for the code completion extension. I suppose we have more information at the "reading" site as opposed to the writing site ?

I think a pretty good fallback behavior for now would be to go to the definition site of the overall type ? I'm not sure where I should start looking for implementing this fallback though

theobat avatar Jan 18 '24 13:01 theobat