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

Rename a constructor renames all record fields

Open deemp opened this issue 2 years ago • 10 comments

Your environment

Which OS do you use: Ubuntu 20.04 Which LSP client (editor/plugin) do you use: VS Code, Haskell extension v2.2.0, ghc 9.2.0, HLS 1.7.0.0 Describe your project (alternative: link to the project): A .yml parser.

Steps to reproduce

See commit 1 Next, try to rename Column using the Rename action- commit 2

Expected behaviour

Only the constructor name is updated

Actual behaviour

All fields of a record are renamed the same as the new consructor name

Include debug information

deemp avatar May 20 '22 12:05 deemp

Hi,

Thanks for the report!

Please could you update the link to the commit for the steps to reproduce? It looks like the repository might be private.

@br4ch1st0chr0n3

OliverMadine avatar May 20 '22 13:05 OliverMadine

Hi, sorry for that. Should be public now, @OliverMadine.

deemp avatar May 20 '22 18:05 deemp

It seems like the issue is hie files including record field names as references to the constructor. This is only happening with ghc >= 9.

@wz1000 maybe you have some more insight?

OliverMadine avatar May 22 '22 20:05 OliverMadine

It seems like the issue is hie files including record field names as references to the constructor. This is only happening with ghc >= 9.

Is this a bug or a feature?

If it is a bug, we will need to report it in the GHC bug tracker and ideally contribute a fix. And back port the fixes to hie-compat: https://github.com/haskell/haskell-language-server/tree/master/hie-compat

pepeiborra avatar Jul 06 '22 16:07 pepeiborra

Is this still a problem?

michaelpj avatar Jan 16 '24 17:01 michaelpj

Yes. I've gotten bitten by this yesterday at least with HLS 2.5.0.0.

konn avatar Jan 16 '24 23:01 konn

I've just tested and confirmed that it still occurs with HLS 2.6.0.0.

konn avatar Jan 17 '24 04:01 konn