Open jneira opened 3 years ago
Posting the issue as i dont have any clue where the problem could come from. The server log does not seem to be erroneous but it seems it is ignoring messages from the client other than close, open and edit the file (and the lsp configuration). Regular log from plugin activity is not shown. Weird.
@jneira thank you for opening an issue. I have created a minimum repro repository: https://github.com/Rizary/haskell-devcontainer.
I've tried it in my WSL2, Windows 10 (using haskell-language-server devcontainer from microsoft repo), and in my Ubuntu 20.04 Hyper-V machine without any positive result.
Is it because of my VSCode's user setting? But I doubt it.
Did you have the chance to try in native windows, to compare the behaviour?
Yes, I did. It is working fine in native windows. Here is the log that I got from windows:
One thing that I notice is hie-bios is not loaded and running. It also still detect hls version 1.2.0.0 while I already have 1.4.0.0.
Edit: fix the log format.
I have update my repo with just ubuntu (with hvr's ppa for cabal and ghc installation) and it still won't work. Here is the log:
Edit: fix the log format.
@jneira I think I'm done for now with devcontainer + haskell language server. It seems the problem reside somewhere inside the invocation of hie-bios, or the hls itself didn't know how to run inside vscode devcontainer.
@jneira I think I'm done for now with devcontainer + haskell language server. It seems the problem reside somewhere inside the invocation of hie-bios, or the hls itself didn't know how to run inside vscode devcontainer.
have you try the official devcontainer image? https://github.com/microsoft/vscode-dev-containers/tree/main/containers/haskell
@jneira I did and it doesn't work either. One thing that I notices are (but need clarification):
2021-09-21 07:11:47.9105421 [ThreadId 5] INFO hls: Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-4668498412949811645) "file:///workspace"], clientSettings = hashed Nothing}
Which is about normalizing uri. Turns out all has minus value. I've tried to read the source code, but I got lost. What I understand is hls
is hashing the filePath
. Maybe I'll have a look at the hls source again in the weekend.
2021-09-20 13:10:40.5194621 [ThreadId 59] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs"
in the error hls.In my understanding, the path doesn't get normalized. If it is, then it should be hlint:getIdeas:file:NormalizedFilePath "/workspace"
imo.
2021-09-20 13:10:40.5214636 [ThreadId 71] INFO hls: Consulting the cradle for "backend\\app\\Main.hs"
Output from setting up the cradle Cradle {cradleRootDir = "D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell", cradleOptsProg = CradleAction: Cabal}
2021-09-20 13:10:45.6334905 [ThreadId 80] INFO hie-bios: Resolving dependencies...
2021-09-20 13:10:45.9464895 [ThreadId 80] INFO hie-bios: Build profile: -w ghc-9.0.1 -O1
2021-09-20 13:10:45.9464895 [ThreadId 80] INFO hie-bios: In order, the following will be built (use -v for more details):
2021-09-20 13:10:45.9464895 [ThreadId 80] INFO hie-bios: - backend-0.1.0.0 (exe:backend) (first run)
2021-09-20 13:10:47.3255143 [ThreadId 80] INFO hie-bios: Preprocessing executable 'backend' for backend-0.1.0.0..
What I understand is
hls
is hashing thefilePath
yeah, just that, the code is in the library lsp:
In my understanding, the path doesn't get normalized. If it is, then it should be hlint:getIdeas:file:NormalizedFilePath "/workspace" imo.
When you say "There is no..", do you mean you see those entries in the log when using native windows but no when you use devcontainer?
D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs
looks like a normalized file path (it has the drive in upper case, no .
nor ..
, etc (see the code in lsp linked above to analyze what normalize does)
But i think you got the possible root cause, the workspace folder uri is not well handled and it seems hls thinks there is no haskell source code.
yeah, just that, the code is in the library lsp:
Does hashing into negative value matter?
When you say "There is no..", do you mean you see those entries in the log when using native windows but no when you use devcontainer?
correct.
D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs
looks like a normalized file path (it has the drive in upper case, no.
nor..
, etc (see the code in lsp linked above to analyze what normalize does)
The above is the working one. In devcontainer, there is no such thing.
But i think you got the possible root cause, the workspace folder uri is not well handled and it seems hls thinks there is no haskell source code.
Yeah, but they somehow got the hie.yaml
.
Does hashing into negative value matter?
No, it is fine
Yeah, but they somehow got the hie.yaml.
Hmm, you are right, unfortunately i have not used devcontainers so i cant confirm if they even work, will try to check it
There is an issue with a similiar setup in the extension repo: https://github.com/haskell/vscode-haskell/issues/501