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 355 forks source link

No working feature using vscode and hls in wsl2, nix and devcontainer #2213

Open jneira opened 3 years ago

jneira commented 3 years ago

I don't understand what's I am missing. I am in WSL2, using nix, run nix-shell just to get GHC and cabal-install, ormolu, hlint, etc. Then I run vscode-insiders inside nix-shell. Run VSCode, and it downloaded haskell-language-server based on my GHC version.

imagen

2021-09-18 22:25:42.407052 [ThreadId 11] DEBUG hls:    Initializing exports map from hiedb
2021-09-18 22:25:42.4080647 [ThreadId 5] INFO hls:    Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 6384748390871118630 "file:///workspace"], clientSettings = hashed Nothing}
2021-09-18 22:25:44.2168109 [ThreadId 11] DEBUG hls:    Done initializing exports map from hiedb (0)

2021-09-18 22:25:44.2173156 [ThreadId 12] DEBUG hls:    Configuration changed: Object (fromList [("haskell",Object (fromList [("diagnosticsOnChange",Bool True),("formatOnImportOn",Bool True),("formattingProvider",String "ormolu"),("indentationRules",Object (fromList [("enabled",Bool True)])),("logFile",String "/workspace/hls.log"),("plugin",Object (fromList [("class",Object (fromList [("globalOn",Bool True)])),("eval",Object (fromList [("globalOn",Bool True)])),("ghcide-completions",Object (fromList [("config",Object (fromList [("autoExtendOn",Bool True),("snippetsOn",Bool True)]))])),("ghcide-hover-and-symbols",Object (fromList [("hoverOn",Bool True)])),("ghcide-type-lenses",Object (fromList [("config",Object (fromList [("mode",Bool True)])),("globalOn",Bool True)])),("haddockComments",Object (fromList [("globalOn",Bool False)])),("hlint",Object (fromList [("codeActionsOn",Bool True),("config",Object (fromList [("flags",Array [])])),("diagnosticsOn",Bool True)])),("importLens",Object (fromList [("codeActionsOn",Bool True),("codeLensOn",Bool True)])),("moduleName",Object (fromList [("globalOn",Bool True)])),("pragmas",Object (fromList [("codeActionsOn",Bool True),("completionOn",Bool True)])),("retrie",Object (fromList [("globalOn",Bool False)])),("splice",Object (fromList [("globalOn",Bool True)])),("tactics",Object (fromList [("config",Object (fromList [("auto_gas",Number 4.0),("hole_severity",Null),("max_use_ctor_actions",Number 5.0),("proofstate_styling",Bool True),("timeout_duration",Number 2.0)])),("globalOn",Bool True)]))])),("releasesURL",String ""),("serverExecutablePath",String ""),("trace",Object (fromList [("client",String "debug"),("server",String "messages")])),("updateBehavior",String "keep-up-to-date")]))])
2021-09-18 22:25:44.2182896

2021-09-18 22:25:44.2182896 [ThreadId 15] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:25:44.2186516 [ThreadId 12] DEBUG hls:    Restarting build session for keys [GetClientSettings; ] (aborting the previous one took 0.00s)
2021-09-18 22:25:44.2191108 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:25:44.219413 [ThreadId 21] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:25:44.2213507 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)
2021-09-18 22:25:44.2217856 [ThreadId 12] DEBUG hls:    Opened text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:25:56.6266243 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:25:56.6269688 [ThreadId 12] DEBUG hls:    Closed text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:26:07.6088759 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:26:07.6096783 [ThreadId 27] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:26:07.6100605 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)

2021-09-18 22:26:07.6106107 [ThreadId 12] DEBUG hls:    Opened text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:26:19.337648 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:26:19.3383706 [ThreadId 12] DEBUG hls:    Closed text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:27:30.7177598 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:27:30.7185928 [ThreadId 55] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:27:30.7189886 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)
2021-09-18 22:27:30.7192878 [ThreadId 12] DEBUG hls:    Opened text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:27:41.0161999 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList [(NormalizedFilePath "/workspace/backend/app/Main.hs",Modified {firstOpen = True})]
2021-09-18 22:27:41.0176708 [ThreadId 126] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:27:41.0183568 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)
2021-09-18 22:27:41.018961 [ThreadId 12] DEBUG hls:    Modified text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:32:50.938515 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList [(NormalizedFilePath "/workspace/backend/app/Main.hs",Modified {firstOpen = False})]
2021-09-18 22:32:50.9392128 

2021-09-18 22:32:50.9392128 [ThreadId 178] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:32:50.9396042 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)
2021-09-18 22:32:50.9401089 [ThreadId 12] DEBUG hls:    Saved text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:36:38.6770001 [ThreadId 11] DEBUG hls:    Initializing exports map from hiedb
2021-09-18 22:36:38.6779851 [ThreadId 5] INFO hls:    Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 6384748390871118630 "file:///workspace"], clientSettings = hashed Nothing}
2021-09-18 22:36:40.072473 [ThreadId 11] DEBUG hls:    Done initializing exports map from hiedb (0)

2021-09-18 22:36:40.0730674 [ThreadId 12] DEBUG hls:    Configuration changed: Object (fromList [("haskell",Object (fromList [("diagnosticsOnChange",Bool True),("formatOnImportOn",Bool True),("formattingProvider",String "ormolu"),("indentationRules",Object (fromList [("enabled",Bool True)])),("logFile",String "/workspace/hls.log"),("plugin",Object (fromList [("class",Object (fromList [("globalOn",Bool True)])),("eval",Object (fromList [("globalOn",Bool True)])),("ghcide-completions",Object (fromList [("config",Object (fromList [("autoExtendOn",Bool True),("snippetsOn",Bool True)]))])),("ghcide-hover-and-symbols",Object (fromList [("hoverOn",Bool True)])),("ghcide-type-lenses",Object (fromList [("config",Object (fromList [("mode",Bool True)])),("globalOn",Bool True)])),("haddockComments",Object (fromList [("globalOn",Bool False)])),("hlint",Object (fromList [("codeActionsOn",Bool True),("config",Object (fromList [("flags",Array [])])),("diagnosticsOn",Bool True)])),("importLens",Object (fromList [("codeActionsOn",Bool True),("codeLensOn",Bool True)])),("moduleName",Object (fromList [("globalOn",Bool True)])),("pragmas",Object (fromList [("codeActionsOn",Bool True),("completionOn",Bool True)])),("retrie",Object (fromList [("globalOn",Bool False)])),("splice",Object (fromList [("globalOn",Bool True)])),("tactics",Object (fromList [("config",Object (fromList [("auto_gas",Number 4.0),("hole_severity",Null),("max_use_ctor_actions",Number 5.0),("proofstate_styling",Bool True),("timeout_duration",Number 2.0)])),("globalOn",Bool True)]))])),("releasesURL",String ""),("serverExecutablePath",String ""),("trace",Object (fromList [("client",String "debug"),("server",String "messages")])),("updateBehavior",String "keep-up-to-date")]))])

2021-09-18 22:36:40.074375 [ThreadId 15] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:36:40.0747424 [ThreadId 12] DEBUG hls:    Restarting build session for keys [GetClientSettings; ] (aborting the previous one took 0.00s)
2021-09-18 22:36:40.0752283 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:36:40.0757163 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)
2021-09-18 22:36:40.0760422 [ThreadId 20] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-09-18 22:36:40.0763495 [ThreadId 12] DEBUG hls:    Opened text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:37:09.9746085 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:37:09.9750556 [ThreadId 12] DEBUG hls:    Closed text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:37:19.8294147 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:37:19.8304653 [ThreadId 26] DEBUG hls:    Finishing build session(exception: AsyncCancelled)

2021-09-18 22:37:19.8309545 [ThreadId 12] DEBUG hls:    Restarting build session for keys [IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ,GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs] (aborting the previous one took 0.00s)
2021-09-18 22:37:19.831567 [ThreadId 12] DEBUG hls:    Opened text document: file:///workspace/backend/app/Main.hs
2021-09-18 22:37:28.6524016 [ThreadId 12] DEBUG hls:    Set files of interest to: fromList []
2021-09-18 22:37:28.6537725 [ThreadId 12] DEBUG hls:    Closed text document: file:///workspace/backend/app/Main.hs
jneira commented 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.

Rizary commented 3 years ago

@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.

jneira commented 3 years ago

Did you have the chance to try in native windows, to compare the behaviour?

Rizary commented 3 years ago

Yes, I did. It is working fine in native windows. Here is the log that I got from windows:

[Info - 13:10:30] Stopping the server [Info - 13:10:30] Starting the server haskell-language-server version: 1.4.0.0 (GHC: 9.0.1) (PATH: C:\Users\Rizary\AppData\Roaming\Code - Insiders\User\globalStorage\haskell.haskell\haskell-language-server-1.4.0-win32-9.0.1.exe) (GIT hash: 253547816ee216c53ee7dacc0ad3cac43e863d30) Couldn't open log file /workspace/rizary-haskell/hls.log; falling back to stderr loggingStarting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/workspace/rizary-haskell/hls.log", argsThreads = 0, argsProjectGhcVersion = False} with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "ormolu",PluginId "retrie",PluginId "callHierarchy",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "moduleName",PluginId "hlint",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"] in directory: d:\Engineer\ubuntu2004\rizary\rizary-haskell Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! Started LSP server in 0.01s setInitialDynFlags cradle: Cradle {cradleRootDir = "d:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell", cradleOptsProg = CradleAction: Cabal} Currently, HLS supports GHC 9 only partially. See [issue #297](https://github.com/haskell/haskell-language-server/issues/297) for more detail. 2021-09-20 13:10:40.4654618 [ThreadId 10] DEBUG hls: Initializing exports map from hiedb 2021-09-20 13:10:40.4794606 [ThreadId 4] INFO hls: Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 3642845969073579259 "file:///D:/Engineer/ubuntu2004/rizary/rizary-haskell"], clientSettings = hashed Nothing} 2021-09-20 13:10:40.5164651 [ThreadId 13] DEBUG hls: Configuration changed: Object (fromList [("haskell",Object (fromList [("diagnosticsOnChange",Bool True),("formatOnImportOn",Bool True),("formattingProvider",String "ormolu"),("indentationRules",Object (fromList [("enabled",Bool True)])),("logFile",String "/workspace/rizary-haskell/hls.log"),("plugin",Object (fromList [("class",Object (fromList [("globalOn",Bool True)])),("eval",Object (fromList [("globalOn",Bool True)])),("ghcide-completions",Object (fromList [("config",Object (fromList [("autoExtendOn",Bool True),("snippetsOn",Bool True)]))])),("ghcide-type-lenses",Object (fromList [("config",Object (fromList [("mode",Bool True)])),("globalOn",Bool True)])),("haddockComments",Object (fromList [("globalOn",Bool True)])),("hlint",Object (fromList [("codeActionsOn",Bool True),("config",Object (fromList [("flags",Array [])])),("diagnosticsOn",Bool True)])),("importLens",Object (fromList [("codeActionsOn",Bool True),("codeLensOn",Bool True)])),("moduleName",Object (fromList [("globalOn",Bool True)])),("pragmas",Object (fromList [("codeActionsOn",Bool True),("completionOn",Bool True)])),("retrie",Object (fromList [("globalOn",Bool True)])),("splice",Object (fromList [("globalOn",Bool True)])),("tactics",Object (fromList [("config",Object (fromList [("auto_gas",Number 4.0),("hole_severity",Null),("max_use_ctor_actions",Number 5.0),("proofstate_styling",Bool True),("timeout_duration",Number 2.0)])),("globalOn",Bool True)]))])),("releasesURL",String ""),("serverExecutablePath",String ""),("trace",Object (fromList [("client",String "debug"),("server",String "messages")])),("updateBehavior",String "keep-up-to-date")]))]) 2021-09-20 13:10:40.5174635 [ThreadId 13] DEBUG hls: Restarting build session for keys [GetClientSettings; ] (aborting the previous one took 0.00s) 2021-09-20 13:10:40.5174635 [ThreadId 16] DEBUG hls: Finishing build session(exception: AsyncCancelled) 2021-09-20 13:10:40.5184627 [ThreadId 13] DEBUG hls: Set files of interest to: fromList [] 2021-09-20 13:10:40.5184627 [ThreadId 10] DEBUG hls: Done initializing exports map from hiedb (1) 2021-09-20 13:10:40.5184627 [ThreadId 20] DEBUG hls: Finishing build session(exception: AsyncCancelled) 2021-09-20 13:10:40.5184627 [ThreadId 13] DEBUG hls: Restarting build session for keys [GetModificationTime_ {missingFileDiagnostics = True}; D:\Engineer\ubuntu2004\rizary\rizary-haskell\backend\app\Main.hs,IsFileOfInterest; D:\Engineer\ubuntu2004\rizary\rizary-haskell\backend\app\Main.hs,GetClientSettings; ] (aborting the previous one took 0.00s) 2021-09-20 13:10:40.5184627 [ThreadId 13] DEBUG hls: Opened text document: file:///d%3A/Engineer/ubuntu2004/rizary/rizary-haskell/backend/app/Main.hs 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" 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:40.7414622 [ThreadId 84] DEBUG hls: src\\Ide\\Plugin\\Eval\\CodeLens.hs:192:15 "fp" "d:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs" 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.. 2021-09-20 13:10:49.0910971 [ThreadId 71] DEBUG hls: Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","C:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\backend-tmp","-odir","C:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\backend-tmp","-hidir","C:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\backend-tmp","-stubdir","C:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\backend-tmp","-i","-iC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\backend-tmp","-iapp","-iC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\autogen","-iC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\global-autogen","-IC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\autogen","-IC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\global-autogen","-IC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\backend-tmp","-IC:\\msys64\\mingw64\\include","-optP-include","-optPC:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\build\\backend\\autogen\\cabal_macros.h","-LC:\\msys64\\mingw64\\lib","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","D:\\cabal-store\\ghc-9.0.1\\package.db","-package-db","C:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\packagedb\\ghc-9.0.1","-package-db","C:\\Users\\Rizary\\AppData\\Local\\hie-bios\\dist-rizary-haskell-b4354c11d3fdf0c078a4f5a0e2054fdc\\build\\x86_64-windows\\ghc-9.0.1\\backend-0.1.0.0\\x\\backend\\package.conf.inplace","-package-id","base-4.15.0.0","-XHaskell2010","app\\Main.hs","-hide-all-packages"], componentRoot = "D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend", componentDependencies = ["backend\\backend.cabal","cabal.project","cabal.project.local"]},"C:\\tools\\ghc-9.0.1\\lib") 2021-09-20 13:10:49.1330932 [ThreadId 71] INFO hls: Using interface files cache dir: C:\Users\Rizary\AppData\Local\ghcide\main-79ad399095eec1d95e0c0b202dbfccd61d47beca 2021-09-20 13:10:49.1330932 [ThreadId 71] INFO hls: Making new HscEnv[main] 2021-09-20 13:10:49.1430946 [ThreadId 71] DEBUG hls: New Component Cache HscEnvEq: (([],Just HscEnvEq 17),fromList [("D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\hie.yaml",Just 2021-09-18 22:46:52.0818247 UTC),("backend\\backend.cabal",Just 2021-09-20 06:08:50.4273231 UTC),("cabal.project",Just 2021-09-20 06:08:50.4283162 UTC),("cabal.project.local",Nothing)]) 2021-09-20 13:10:49.1440946 [ThreadId 71] DEBUG hls: Known files updated: fromList [(TargetFile NormalizedFilePath "D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs",fromList ["D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs"])] 2021-09-20 13:10:49.1451074 [ThreadId 71] DEBUG hls: Restarting build session for keys [GetModificationTime_ {missingFileDiagnostics = True}; D:\Engineer\ubuntu2004\rizary\rizary-haskell\backend\app\Main.hs,IsFileOfInterest; D:\Engineer\ubuntu2004\rizary\rizary-haskell\backend\app\Main.hs,GhcSessionIO; ] (aborting the previous one took 0.00s) 2021-09-20 13:10:49.1451074 [ThreadId 32] DEBUG hls: Finishing build session(exception: AsyncCancelled) 2021-09-20 13:10:49.1480938 [ThreadId 110] DEBUG hls: hlint:getIdeas:file:NormalizedFilePath "D:\\Engineer\\ubuntu2004\\rizary\\rizary-haskell\\backend\\app\\Main.hs" 2021-09-20 13:10:49.1530931 [ThreadId 155] INFO hls: finish: ModuleName.ghcSession (took 0.01s) 2021-09-20 13:10:49.1541008 [ThreadId 175] INFO hls: finish: eval.GetParsedModuleWithComments (took 0.01s) 2021-09-20 13:10:49.1541008 [ThreadId 178] INFO hls: finish: GhcideCodeActions.getParsedModule (took 0.01s) 2021-09-20 13:10:49.1561039 [ThreadId 84] DEBUG hls: src\\Ide\\Plugin\\Eval\\CodeLens.hs:192:15 "excluded comments" "[]" 2021-09-20 13:10:49.1561039 [ThreadId 177] INFO hls: finish: Pragmas.GetParsedModule (took 0.01s) 2021-09-20 13:10:49.1571012 [ThreadId 178] INFO hls: finish: Outline (took 0.01s) 2021-09-20 13:10:49.1571012 [ThreadId 163] INFO hls: finish: importLens (took 0.01s) 2021-09-20 13:10:49.1571012 [ThreadId 179] INFO hls: finish: HaddockComments.GetAnnotatedParsedSource (took 0.01s) 2021-09-20 13:10:49.1571012 [ThreadId 84] DEBUG hls: src\\Ide\\Plugin\\Eval\\CodeLens.hs:192:15 "comments" "Comments {lineComments = fromList [], blockComments = fromList []}" 2021-09-20 13:10:49.1571012 [ThreadId 175] INFO hls: finish: Pragmas.GetFileContents (took 0.00s) 2021-09-20 13:10:49.1571012 [ThreadId 108] INFO hls: finish: ModuleName.GetParsedModule (took 0.00s) 2021-09-20 13:10:49.1571012 [ThreadId 84] DEBUG hls: src\\Ide\\Plugin\\Eval\\CodeLens.hs:192:15 "Tests" "0 tests in 0 sections 0 setups 0 lenses." 2021-09-20 13:10:49.1571012 [ThreadId 84] DEBUG hls: src\\Ide\\Plugin\\Eval\\CodeLens.hs:192:15 "tests" "0.00s" 2021-09-20 13:10:49.1571012 [ThreadId 84] DEBUG hls: src\\Ide\\Plugin\\Eval\\CodeLens.hs:192:15 "codeLens" "8.42s" 2021-09-20 13:10:49.4156578 [ThreadId 191] INFO hls: finish: codeLens.TypeCheck (took 0.27s) 2021-09-20 13:10:49.4156578 [ThreadId 192] INFO hls: finish: retrie (took 0.27s) 2021-09-20 13:10:49.4156578 [ThreadId 203] INFO hls: finish: (took 0.27s) 2021-09-20 13:10:49.4175965 [ThreadId 208] DEBUG hls: finish: InitialLoad (took 0.27s) 2021-09-20 13:10:49.4236209 [ThreadId 213] INFO hls: finish: codeLens.GetBindings (took 0.01s) 2021-09-20 13:10:49.4245955 [ThreadId 218] INFO hls: finish: codeLens.GetGlobalBindingTypeSigs (took 0.00s)

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.

Rizary commented 3 years ago

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:

[client][INFO] Searching for server executables haskell-language-server-wrapper,haskell-language-server in $PATH [client][INFO] Downloading haskell-language-server [client][INFO] Fetching the latest release from GitHub or from cache [client][INFO] The latest release is 1.4.0 [client][INFO] Figure out the ghc version to use or advertise an installation link for missing components [client][INFO] Working out the project GHC version. This might take a while... [client][INFO] Executing '/home/user/.vscode-server-insiders/data/User/globalStorage/haskell.haskell/haskell-language-server-wrapper-1.4.0-linux --project-ghc-version' in cwd '/workspace' to get the project or file ghc version [client][INFO] Execution of '/home/user/.vscode-server-insiders/data/User/globalStorage/haskell.haskell/haskell-language-server-wrapper-1.4.0-linux --project-ghc-version' terminated with code 0 [client][INFO] The GHC version for the project or file: 8.10.4 [client][INFO] Search for binary haskell-language-server-Linux-8.10.4 in release assests [client][INFO] Downloading haskell-language-server 1.4.0 for GHC 8.10.4 [client][INFO] Activating the language server in the workspace folder: /workspace [client][INFO] run command: /home/user/.vscode-server-insiders/data/User/globalStorage/haskell.haskell/haskell-language-server-1.4.0-linux-8.10.4 --lsp -d -l /workspace/rizary-haskell/hls.log [client][INFO] debug command: /home/user/.vscode-server-insiders/data/User/globalStorage/haskell.haskell/haskell-language-server-1.4.0-linux-8.10.4 --lsp -d -l /workspace/rizary-haskell/hls.log [client][INFO] document selector patten: /workspace/**/* [client][INFO] Starting language server haskell-language-server version: 1.4.0.0 (GHC: 8.10.4) (PATH: /home/user/.vscode-server-insiders/data/User/globalStorage/haskell.haskell/haskell-language-server-1.4.0-linux-8.10.4) (GIT hash: 253547816ee216c53ee7dacc0ad3cac43e863d30) Couldn't open log file /workspace/rizary-haskell/hls.log; falling back to stderr loggingStarting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "/workspace/rizary-haskell/hls.log", argsThreads = 0, argsProjectGhcVersion = False} with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "callHierarchy",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"] in directory: /workspace Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! Started LSP server in 0.00s setInitialDynFlags cradle: Cradle {cradleRootDir = "/workspace", cradleOptsProg = CradleAction: Cabal} 2021-09-20 11:24:00.8376266 [ThreadId 11] DEBUG hls: Initializing exports map from hiedb 2021-09-20 11:24:00.8390818 [ThreadId 5] INFO hls: Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-4668498412949811645) "file:///workspace"], clientSettings = hashed Nothing} 2021-09-20 11:24:02.2149161 [ThreadId 12] DEBUG hls: Configuration changed: Object (fromList [("haskell",Object (fromList [("diagnosticsOnChange",Bool True),("formatOnImportOn",Bool True),("formattingProvider",String "ormolu"),("indentationRules",Object (fromList [("enabled",Bool True)])),("logFile",String "/workspace/rizary-haskell/hls.log"),("plugin",Object (fromList [("class",Object (fromList [("globalOn",Bool True)])),("eval",Object (fromList [("globalOn",Bool True)])),("ghcide-completions",Object (fromList [("config",Object (fromList [("autoExtendOn",Bool True),("snippetsOn",Bool True)]))])),("ghcide-hover-and-symbols",Object (fromList [("hoverOn",Bool True)])),("ghcide-type-lenses",Object (fromList [("config",Object (fromList [("mode",Bool True)])),("globalOn",Bool True)])),("haddockComments",Object (fromList [("globalOn",Bool False)])),("hlint",Object (fromList [("codeActionsOn",Bool True),("config",Object (fromList [("flags",Array [])])),("diagnosticsOn",Bool True)])),("importLens",Object (fromList [("codeActionsOn",Bool True),("codeLensOn",Bool True)])),("moduleName",Object (fromList [("globalOn",Bool True)])),("pragmas",Object (fromList [("codeActionsOn",Bool True),("completionOn",Bool True)])),("retrie",Object (fromList [("globalOn",Bool False)])),("splice",Object (fromList [("globalOn",Bool True)])),("tactics",Object (fromList [("config",Object (fromList [("auto_gas",Number 4.0),("hole_severity",Null),("max_use_ctor_actions",Number 5.0),("proofstate_styling",Bool True),("timeout_duration",Number 2.0)])),("globalOn",Bool True)]))])),("releasesURL",String ""),("serverExecutablePath",String ""),("trace",Object (fromList [("client",String "debug"),("server",String "messages")])),("updateBehavior",String "keep-up-to-date")]))]) 2021-09-20 11:24:02.2153393 [ThreadId 11] DEBUG hls: Done initializing exports map from hiedb (0) 2021-09-20 11:24:02.2155443 [ThreadId 15] DEBUG hls: Finishing build session(exception: AsyncCancelled) 2021-09-20 11:24:02.2155927 [ThreadId 12] DEBUG hls: Restarting build session for keys [GetClientSettings; ] (aborting the previous one took 0.00s) 2021-09-20 11:24:02.2158358 [ThreadId 12] DEBUG hls: Set files of interest to: fromList [] 2021-09-20 11:24:02.2159924 [ThreadId 21] DEBUG hls: Finishing build session(exception: AsyncCancelled) 2021-09-20 11:24:02.216065 [ThreadId 12] DEBUG hls: Restarting build session for keys [GetModificationTime_ {missingFileDiagnostics = True}; /workspace/backend/app/Main.hs,IsFileOfInterest; /workspace/backend/app/Main.hs,GetClientSettings; ] (aborting the previous one took 0.00s) 2021-09-20 11:24:02.2161854 [ThreadId 12] DEBUG hls: Opened text document: file:///workspace/backend/app/Main.hs 2021-09-20 11:24:02.2171316 [ThreadId 52] DEBUG hls: src/Ide/Plugin/Eval/CodeLens.hs:192:15 "fp" "/workspace/backend/app/Main.hs" 2021-09-20 11:24:42.845486 [ThreadId 62] DEBUG hls: GhcIde.hover entered (ideLogger) 2021-09-20 11:24:42.8456523 [ThreadId 62] DEBUG hls: Hover request at position 3:12 in file: /workspace/backend/app/Main.hs 2021-09-20 11:24:42.8457411 [ThreadId 62] DEBUG hls: LOOKUP UP PERSISTENT FOR: GetHieAst 2021-09-20 11:24:43.1126763 [ThreadId 67] DEBUG hls: GhcIde.hover entered (ideLogger) 2021-09-20 11:24:43.1128345 [ThreadId 67] DEBUG hls: Hover request at position 5:13 in file: /workspace/backend/app/Main.hs

Edit: fix the log format.

Rizary commented 3 years ago

@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 commented 2 years ago

@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

Rizary commented 2 years ago

@jneira I did and it doesn't work either. One thing that I notices are (but need clarification):

  1. When registering ide configuration, hls that doesn't work has similar output: 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.

  1. There is no: 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.

  1. There is no:
    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}
  2. There is no:
    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..
jneira commented 2 years ago

What I understand is hls is hashing the filePath

yeah, just that, the code is in the library lsp:

https://github.com/haskell/lsp/blob/ab1aec745268afadcbfe4404d61e230e4c188e98/lsp-types/src/Language/LSP/Types/Uri.hs#L46

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.

Rizary commented 2 years ago

yeah, just that, the code is in the library lsp:

https://github.com/haskell/lsp/blob/ab1aec745268afadcbfe4404d61e230e4c188e98/lsp-types/src/Language/LSP/Types/Uri.hs#L46

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.

jneira commented 2 years ago

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

jneira commented 2 years ago

There is an issue with a similiar setup in the extension repo: https://github.com/haskell/vscode-haskell/issues/501