haskell-language-server
haskell-language-server copied to clipboard
subtle component caching issue when there is a symlink in the path of the repo
Your environment
Which OS do you use: Nixos Which LSP client (editor/plugin) do you use: VSCodium/coc-nvim Describe your project (alternative: link to the project): various, e.g. https://github.com/maralorn/nix-output-monitor
Steps to reproduce
My ~/git
folder is a symlink (onto another filesystem).
I run haskell-language-server -d
in ~/git/nix-output-monitor
I get this log: https://termbin.com/pkk4
When I copy the project to ~/nix-output-monitor
I get the expected behavior.
When I manually resolve the symlink and run hls in /disk/persist/git/nix-output-monitor
I get the expected behavior.
Expected behaviour
hls should load the project normally, which means loading the library component once, when it encounters a file from the library.
Actual behaviour
hls loads the component/cradle new for every file in the library. Crucially files first get listed in
2022-03-26 12:51:30.50850162 [ThreadId 113] DEBUG hls: Known files updated:
but then shortly after a new cradle get’s created for a supposedly known file:
2022-03-26 12:51:30.60907107 [ThreadId 399] INFO hls: Consulting the cradle for "lib/NOM/State/Sorting.hs"
2022-03-26 12:51:30.60915896 [ThreadId 399] WARNING hls: No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for lib/NOM/State/Sorting.hs.
Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2022-03-26 12:51:30.611110962 [ThreadId 399] DEBUG hls: Output from setting up the cradle Cradle {cradleRootDir = "/disk/persist/maralorn/git/nix-output-monitor", cradleOptsProg = CradleAction: Cabal}
Include debug information
- I tried different hls versions I think I am seeing this with hls 1.4 and 1.6 e.g.
- I tried with different projects, they all have the issue.
- I tried a variety of different positions in my filesystem, the issue happened whenever I "cded" into the directory via a symlink.
- I tried with ghc 8.10 and ghc 9.0.
I tried to falsify my assumptions, and sure enough I could. I’ll update the issue accordingly.
I am starting to doubt my sanity here. I think the issue I am describing exists somehow, though the actual symptom, i.e. the need to regularly restart the language-server I can‘t reproduce anymore …
I have edited the issue accordingly.
Maybe this PR is related if the issue is truly related to symlinks: https://github.com/haskell/haskell-language-server/pull/2359
@maralorn do you still see this?
Oh, phew. I have no clue. I can say that I have developed fine one the directory in question for the last year, so no need to chase ghosts here.