Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textDocument/references on a record field in a definition returns way too many things #3731

Closed
googleson78 opened this issue Jul 26, 2023 · 4 comments
Labels
status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@googleson78
Copy link
Contributor

Is your enhancement request related to a problem? Please describe.

Currently, calling textDocument/references on the field of a record in a definition returns way too many things, including all of the other record fields, as well as the data type definition line, as well as some seemingly duplicate entries. Example:

For this file

{-# LANGUAGE RecordWildCards #-}
data Foo = MkFoo
  {
    bar :: Int,
    baz :: String
  }

fooUse0 :: Foo -> Int
fooUse0 MkFoo{bar} = 5

fooUse1 :: Foo -> Int
fooUse1 MkFoo{..} = 6

fooUse2 :: Int -> String -> Foo
fooUse2 bar baz =
  MkFoo{..}

Calling textDocument/references while my cursor is on bar on line 4 returns the following results:
2023-07-26-165942_636x284_scrot
A lot of these seem redundant:

  1. The constructor definition (the last result)
  2. Some of the lines are seemingly duplicated - fooUse1 and fooUse2 are both seemingly mentioned twice, which seems like a bug?
  3. (my biggest issue) baz :: String also comes up as a result, which also seems like a bug, and is a huge pain when dealing with Real World ™️ data types with loads of fields, as this happens for each field.

Describe the solution you'd like

I would like for only lines that mention the field in question to show up.

Describe alternatives you've considered

Maybe I'm just confused regarding what "references" means?

@michaelpj michaelpj added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. and removed type: enhancement New feature or request status: needs triage labels Jul 26, 2023
@michaelpj
Copy link
Collaborator

Seems like a definite bug. @wz1000 could this be a hiedb issue? is there a query @googleson78 can run to check if the db is wrong?

@wz1000
Copy link
Collaborator

wz1000 commented Jul 27, 2023

I think this is https://gitlab.haskell.org/ghc/ghc/-/issues/23492 which will be fixed in future releases of GHC starting with 9.4.6

@michaelpj michaelpj added the status: blocked Not actionable, because blocked by upstream/GHC etc. label Jul 27, 2023
@michaelpj
Copy link
Collaborator

Closing as it's fixed upstream

@googleson78
Copy link
Contributor Author

Note that this is still note fixed, I've "reopened" this issue in #4412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked Not actionable, because blocked by upstream/GHC etc. type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants