haskell / haskell/haskell-language-server

HLS deletes shebang line

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

Description

HLS deletes the shebang line in single file scripts when accepting a suggestion.

### Your environment

**Which OS do you use?**
Windows WSL2 running CentOS Stream 9

**Which version of GHC do you use and how did you install it?**
GHC 9.4.8 from ghcup

**Which LSP client (editor/plugin) do you use?**
vscode haskell

**Which version of HLS do you use and how did you install it?**
HLS 2.7.0.0 from ghcup

### Steps to reproduce

Use the following the code:
```
#!/usr/bin/env cabal

{- cabal:
default-language: GHC2021

build-depends:
base ^>=4.17.0.0,
-}

main :: IO ()
main = print $ fmap (\x -> x + 1) [1,2,3]
```
![image](https://github.com/haskell/haskell-language-server/assets/32042587/19dd6446-f4e2-4bef-98f1-976f58b75374)

Accept the suggestion.

### Expected behaviour

```
#!/usr/bin/env cabal

default-language: GHC2021

{- cabal:
default-language: GHC2021

build-depends:
base ^>=4.17.0.0,
-}

main :: IO ()
main = print $ fmap (+ 1) [1,2,3]
```

### Actual behaviour

```

{- cabal:
default-language: GHC2021

build-depends:
base ^>=4.17.0.0,
-}

main :: IO ()
main = print $ fmap (+ 1) [1,2,3]
```

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.