haskell / haskell/haskell-language-server

Sensitivity to symlinks in flags from hie-bios

Open
#3,510 3 comments 0 reactions 0 assignees View on GitHub
component: ghcide type: bug
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

For context, in [rules_haskell](https://github.com/tweag/rules_haskell) we output compilation options as described in the [hie-bios documentation](https://github.com/haskell/hie-bios#bios), and encountered a case where two different paths to the same directory (because of symlinks) are not equivalent.

See the following repro: https://github.com/ylecornec/hls-symlink-repro.

The repro was made on NixOS but we encountered the same thing on Ubuntu and Windows as well.

---

In this example ,`haskell-language-server` is setup using a `hie-bios` script which outputs the following flags:

```
-isubdir_alias
Main.hs
subdir/Lib.hs
```
where `subdir_alias` is a symbolic link to `subdir`.

Running the following command:

```
haskell-language-server-wrapper Main.hs
```

fails with error:

```
Message: Variable not in scope: val
```

whereas using either `subdir` or `subdir_alias` in both places works fine.

(running `ghci $(./hie-bios | tr '\n' ' ')` as indicated in [hie-bios documentation](https://github.com/haskell/hie-bios) also seems to work fine)

# Versions:

This behavior seems present since `haskell-language-server` version `1.6` as the following commands fail:

```
nix-shell shell_1_9_0_0.nix --run "haskell-language-server-wrapper Main.hs"
nix-shell shell_1_6_1_1.nix --run "haskell-language-server-wrapper Main.hs"
```

While this one succeeds:

```
nix-shell shell_1_5_0_1.nix --run "haskell-language-server-wrapper Main.hs"
````

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.