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

Fix renaming data constructors with fields (resolves #2915, resolves #4083)

Open jhrcek opened this issue 6 months ago • 3 comments

Attempt at resolving https://github.com/haskell/haskell-language-server/issues/2915 and https://github.com/haskell/haskell-language-server/issues/4083

jhrcek avatar Jun 16 '25 12:06 jhrcek

Wait, it will require some work. It doesn't work as is, yet :smile_cat:

jhrcek avatar Jun 16 '25 13:06 jhrcek

My bad, I saw all the tests have been passed and thought it is ready. Forget to check if the new test have been supplied😆 We can pick up the test from https://github.com/haskell/haskell-language-server/pull/4089/files, I think.

soulomoon avatar Jun 16 '25 13:06 soulomoon

Looks promising, but still not 100% done.

There's an issue with Record wildcards - the current impl. somehow removes the .. from record wildcard pattern matches, so renaming constructor does something like this:

OriginalConstructor {..} -> RenamedConstructor {}

jhrcek avatar Jun 16 '25 15:06 jhrcek

@jhrcek Just randomly found https://github.com/haskell/haskell-language-server/blob/master/ghcide/session-loader/Development/IDE/Session.hs#L226, do we need to increase this to invalidate existing hiedb databases?

fendor avatar Jun 20 '25 13:06 fendor

Good catch. I wasn't aware that hls has its own schema version. I thought that that would be handled solely by hiedb, which has its own "schema version check" https://github.com/wz1000/HieDb/blob/524bb3c2e4f00269591760a83f90405a8f7e9fc9/src/HieDb/Create.hs#L51-L66

jhrcek avatar Jun 24 '25 04:06 jhrcek