haskell / haskell/haskell-language-server

Wrong rename type variables in type families

Open
#3,716 0 comments 0 reactions 1 assignee Claimed by @OliverMadine View on GitHub
component: hls-rename-plugin type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

### Your environment

Which OS do you use?
Ubuntu 20.04

Which version of GHC do you use and how did you install it?
9.2.8 from `github:NixOS/nixpkgs/ec322bf9e598a510995e7540f17af57ee0c8d5b9`

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

Which LSP client (editor/plugin) do you use?
VSCode + vscode-haskell

Which version of HLS do you use and how did you install it?
`haskell-language-server 2.0.0.0` from `github:NixOS/nixpkgs/ec322bf9e598a510995e7540f17af57ee0c8d5b9`

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

### Steps to reproduce

```hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}

module Data.Lens.Barlow.Rename () where

data MTag = A
data B a b c d e f

type family ClosedFamily s :: MTag where
-- before
ClosedFamily (B a b c d e f) = A

-- after rename 'a' to 'a1'
-- SelectTag (B a1b c d e f) = A

-- after rename 'a' to 'a12'
-- SelectTag (B a12bc d e f) = A

-- after rename 'a' to 'a123'
-- SelectTag (B a123bcd e f) = A

-- etc., I guess

-- after rename 'c' to 'c23'
-- ClosedFamily (B a b c23de f) = A

type family OpenFamily s :: MTag

-- before
type instance OpenFamily (B a b c d e f) = A

-- after rename 'a' to 'a1234'
-- type instance OpenFamily (B a1234bc d e f) = A
```

### Expected behaviour

Spaces between type variables are kept after a rename.

### Actual behaviour

Spaces between subsequent type variables are removed.
The number of removed spaces depends on the length of the name of a parameter.

### 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.