haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.65k stars 354 forks source link

Reaching path length limit in Windows #4365

Open ThereIsNoPie opened 1 month ago

ThereIsNoPie commented 1 month ago

Your environment

Which OS do you use? Windows

Which version of GHC do you use and how did you install it? ghcup, ghc 9.4.8

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

Which LSP client (editor/plugin) do you use? VS code

Which version of HLS do you use and how did you install it? ghcup is set to 2.7.0.0, however in my logs it says 2.9.0.1

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

What's wrong?

I'm running into this issue when navigating to a file in my projects executable directory (in this case Main.hs).

C:\Users\user1\AppData\Local\hie-bios\dist-super-duper-long-project-name-api-8be09479ad30bccd6705fcb1123451\build\x86_64-windows\ghc-9.4.8\super-duper-long-project-name-api-0.1.0.0\x\super-duper-long-project-name-api\build\super-duper-long-project-name-api\autogen\: openBinaryTempFileWithDefaultPermissions: invalid argument (invalid argument)Error: cabal-3.10.3.0.exe: repl failed for exe:super-duper-long-project-name-api super-duper-long-project-name-api-0.1.0.0.

This removes syntax highlighting in VSCode

Debug information

When I change the project name to "short-name" it works fine.

I have enabled long paths on Windows (Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem c. Enable "Enable Win32 long paths")

Fix long paths issue on windows In the hie-bios 0.1.1 changelog https://hackage.haskell.org/package/hie-bios-0.4.0/candidate/changelog

If I run cabal build and cabal run from terminal it seems to work fine (90% sure). Only fails in VS Code.

fendor commented 1 month ago

Hi, thank you for your bug report!

It is amazing that this issue keeps biting us. I'd be curious whether cabal build is seriously fine. Since this directory (C:\Users\user1\AppData\Local\hie-bios\dist-super-duper-long-project-name-api-8be09479ad30bccd6705fcb1123451\) is only touched by cabal repl. I expect for example a project like super-duper-long-project-name-apisuper-duper-long-project-name-apisuper-duper-long-project-name-api.cabal to be broken as well.

EDIT: You are sure user1 doesn't contain any spaces or other special characters?

ThereIsNoPie commented 3 weeks ago

Yeah user1 doesn't contain any spaces or special characters.

I ended up switching to wsl and everything just worked immediately.