haskell / haskell/haskell-language-server

Renaming constructor makes undesirable whitespace changes / removal of .. from Record wildcard pattern matches {..}

Open
#4,636 2 comments 0 reactions 0 assignees View on GitHub
component: hls-rename-plugin type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
4d 3h
Merged PRs (30d)
12

Description

After fixing https://github.com/haskell/haskell-language-server/issues/2915 in https://github.com/haskell/haskell-language-server/pull/4635 I noticed the following issues when RecordWildcard pattern matches are used and record constructor is renamed.

This issue seems to only affect GHC 9.6 and 9.8 (in 9.10+ it works fine).

### Your environment

Which OS do you use?

Which version of GHC do you use and how did you install it?

How is your project built (alternative: link to the project)?

Which LSP client (editor/plugin) do you use?
VSCode

Which version of HLS do you use and how did you install it?
2.10.0.0 + latest changes from master

Have you configured HLS in any way (especially: a `hie.yaml` file)?
No

### Steps to reproduce

See reproducer marked as broken in https://github.com/haskell/haskell-language-server/pull/4635/files#diff-ecd5eff03edc6cac02343f9fe14aeb61fa616f9069e4b3db048d13affb648d17R29-R31

### Expected behaviour

When renaming constructor, wildcard pattern matches should not be touched:
```haskell
OriginalConstructor {..} -> RenamedConstructorToLongerName {..}
OriginalConstructor {..} -> ShortRenmd {..}
```

### Actual behaviour

2 cases of issues happen when renaming the constructor:
```haskell
OriginalConstructor {..} -> RenamedConstructorToLongerName{} -- notice that `..` are removed
OriginalConstructor {..} -> ShortRenmd { ..} -- undesirable whitespace is introduced
```

### Debug information

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.