haskell / haskell/haskell-language-server

Inline variable refactor doesn't work for let bindings inside do block

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

Description

### Your environment
Which OS do you use?
MacOS

Which version of GHC do you use and how did you install it?
Tested with GHC 9.4.8 installed with ghcup.

How is your project built (alternative: link to the project)?
Cabal (exe + lib + tests). Link: https://github.com/BogdanYarotsky/async-http-client/blob/main/app/Main.hs

Which LSP client (editor/plugin) do you use?
VS Code + Haskell extension

Which version of HLS do you use and how did you install it?
2.9.0.1 installed from ghcup.

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

### Steps to reproduce
1) Enter the following code
```
data Uri = Uri
{ host :: String,
path :: String
}

simpleHttpGet :: Uri -> IO String
simpleHttpGet uri' =
return "doesn't matter"

main :: IO ()
main = do
let path' = "/"
response <- simpleHttpGet (Uri "example.com" path')
putStrLn response
```
2) Try to inline the let binding inside a do block using a code action.

### Expected behavior
In the example path’ should be replaced with “/“ in the place of invocation (Uri constructor) like this:
```

main = do
response <- simpleHttpGet (Uri "example.com" "/")
putStrLn response

```
### Actual behavior
2 cryptic error messages from HLS and no changes to the code:
1) retrie: Internal Error: Retrie - inline produced no changes
2) Error condition, please check your setup and/or the [issue tracker](https://github.com/haskell/haskell-language-server/issues): retrie: Internal Error: Retrie - inline produced no changes

Please check the video below:

https://github.com/user-attachments/assets/60cf71b5-9814-42df-824f-48579ddf51c9

May be related to issue #4374

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.