Hi there,
I'm experiencing weird problems while running hls on a library I'm working on. From vscode I'm not able to see any special problem. I've checked the output, everything seems to be right, but then nothing happens. Mouse over doesn't work, even though from the log I can't see errors:
2020-07-26 09:54:40.164255 [ThreadId 276] - Hover request at position 42:9 in file: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/Model.hs
2020-07-26 09:54:40.365894 [ThreadId 279] - GhcIde.hover entered (ideLogger)
What's the correct way to run HLS with --debug option? Didn't find any help from the documentation. Do I need to run a special wrapper, or is there a way from vscode to run hls in debug+verbose mode?
I forgot to mention that the haskell-ide-engine tool does work instead.
Thanks,
N.
Hi, can you paste the full log from the output window? It could be that the session didn't get set up correctly which doesn't always produce obvious errors. You can also get some more debugging information if you can find the path to the haskell-language-server binary, which should be in the output window somewhere, and running that in the terminal in the root directory of your project with no arguments
Hi bubba,
here's the log:
```[client] run command: "haskell-language-server-wrapper --lsp"
[client] debug command: "haskell-language-server-wrapper --lsp -d"
[client] server cwd: undefined
Module "/Users/admin/GitLab/vegoia-tree-lib/a" is loaded by Cradle: Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 0.2.2.0, Git revision cbdf0a4e5936cb17ac7f2d2df672c2fa1e23284d (393 commits) x86_64 ghc-8.8.4
Current directory: /Users/admin/GitLab/vegoia-tree-lib
Operating system: darwin
Arguments: ["--lsp"]
Cradle directory: /Users/admin/GitLab/vegoia-tree-lib
Cradle type: Stack
Consulting the cradle to get project GHC version...
Project GHC version: 8.8.2
haskell-language-server exe candidates: ["haskell-language-server-8.8.2","haskell-language-server-8.8","haskell-language-server"]
Launching haskell-language-server exe at:/Users/admin/.local/bin/haskell-language-server-8.8
haskell-language-server version: 0.2.2.0 (GHC: 8.8.4) (PATH: /Users/admin/.local/bin/haskell-language-server-8.8) (GIT hash: cbdf0a4e5936cb17ac7f2d2df672c2fa1e23284d)
Starting (haskell-language-server)LSP server...
with arguments: Arguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsVersion = False, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
with plugins: [PluginId "brittany",PluginId "eval",PluginId "floskell",PluginId "ghcide",PluginId "ormolu",PluginId "pragmas",PluginId "stylish-haskell"]
in directory: /Users/admin/GitLab/vegoia-tree-lib
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
Started LSP server in 0.02s
2020-07-27 08:58:24.418448 [ThreadId 21] - Opened text document: file:///Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/FlowSample.hs
Data.HashMap.Base.(!): key not found
CallStack (from HasCallStack):
error, called at ./Data/HashMap/Base.hs:631:16 in unordered-containers-0.2.10.0-L0UCiFV6BpAyFeQZxTEW6:Data.HashMap.Base
2020-07-27 08:58:24.422115 [ThreadId 61] - Consulting the cradle for "/Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/FlowSample.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: vegoia-tree-lib
/Users/admin/GitLab/vegoia-tree-lib/.stack-work/install/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/snapshots/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
2020-07-27 08:58:27.230905 [ThreadId 83] - finish: CodeAction (took 0.00s)
2020-07-27 08:58:27.231004 [ThreadId 83] - finish: CodeAction:PackageExports (took 0.00s)
2020-07-27 08:58:27.231096 [ThreadId 91] - Plugin.makeCodeLens (ideLogger)
2020-07-27 08:58:27.231621 [ThreadId 83] - finish: codeLens (took 0.00s)
2020-07-27 08:58:27.498947 [ThreadId 83] - finish: CodeAction (took 0.00s)
2020-07-27 08:58:27.499045 [ThreadId 83] - finish: CodeAction:PackageExports (took 0.00s)
2020-07-27 08:58:49.379481 [ThreadId 97] - GhcIde.hover entered (ideLogger)
2020-07-27 08:58:49.379653 [ThreadId 97] - Hover request at position 318:18 in file: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/FlowSample.hs
2020-07-27 08:58:50.34809 [ThreadId 100] - GhcIde.hover entered (ideLogger)
2020-07-27 08:58:50.348293 [ThreadId 100] - Hover request at position 319:19 in file: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/FlowSample.hs
2020-07-27 08:58:51.224645 [ThreadId 103] - GhcIde.hover entered (ideLogger)
2020-07-27 08:58:51.224864 [ThreadId 103] - Hover request at position 321:25 in file: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/FlowSample.hs
2020-07-27 08:58:53.31695 [ThreadId 106] - GhcIde.hover entered (ideLogger)
2020-07-27 08:58:53.317102 [ThreadId 106] - Hover request at position 331:16 in file: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/FlowSample.hs
Interestingly, by running manually hls wrapper without arguments I get:
haskell-language-server-wrapper
Module "/Users/admin/GitLab/vegoia-tree-lib/a" is loaded by Cradle: Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper) Version 0.2.2.0, Git revision cbdf0a4e5936cb17ac7f2d2df672c2fa1e23284d (393 commits) x86_64 ghc-8.8.4
Current directory: /Users/admin/GitLab/vegoia-tree-lib
Operating system: darwin
Arguments: []
Cradle directory: /Users/admin/GitLab/vegoia-tree-lib
Cradle type: Stack
Consulting the cradle to get project GHC version...
Project GHC version: 8.8.2
haskell-language-server exe candidates: ["haskell-language-server-8.8.2","haskell-language-server-8.8","haskell-language-server"]
Launching haskell-language-server exe at:/Users/admin/.local/bin/haskell-language-server-8.8
haskell-language-server version: 0.2.2.0 (GHC: 8.8.4) (PATH: /Users/admin/.local/bin/haskell-language-server-8.8) (GIT hash: cbdf0a4e5936cb17ac7f2d2df672c2fa1e23284d)
(haskell-language-server)Ghcide setup tester in /Users/admin/GitLab/vegoia-tree-lib.
Report bugs at https://github.com/haskell/haskell-language-server/issues
Step 1/4: Finding files to test in /Users/admin/GitLab/vegoia-tree-lib
Found 6 files
Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
Step 3/4: Initializing the IDE
Step 4/4: Type checking the files
[INFO] Consulting the cradle for "/Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/UserAgentSample.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: vegoia-tree-lib
/Users/admin/GitLab/vegoia-tree-lib/.stack-work/install/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/snapshots/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
File: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/UserAgentSample.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
ghcide compiled against GHC 8.8.4 but currently using 8.8.2
This is unsupported, ghcide must be compiled with the same GHC version as the project.
[INFO] Consulting the cradle for "/Users/admin/GitLab/vegoia-tree-lib/Setup.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: vegoia-tree-lib
/Users/admin/GitLab/vegoia-tree-lib/.stack-work/install/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/snapshots/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
File: /Users/admin/GitLab/vegoia-tree-lib/Setup.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
ghcide compiled against GHC 8.8.4 but currently using 8.8.2
This is unsupported, ghcide must be compiled with the same GHC version as the project.
[INFO] Consulting the cradle for "/Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/Feature.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: vegoia-tree-lib
/Users/admin/GitLab/vegoia-tree-lib/.stack-work/install/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/snapshots/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
File: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/Feature.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
ghcide compiled against GHC 8.8.4 but currently using 8.8.2
This is unsupported, ghcide must be compiled with the same GHC version as the project.
[INFO] Consulting the cradle for "/Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: vegoia-tree-lib
/Users/admin/GitLab/vegoia-tree-lib/.stack-work/install/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/snapshots/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
File: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree.hs
Hidden: no
Range: 1:0-2:0
Source: cradle
Severity: DsError
Message:
ghcide compiled against GHC 8.8.4 but currently using 8.8.2
This is unsupported, ghcide must be compiled with the same GHC version as the project.
[INFO] Consulting the cradle for "/Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/Model.hs"
Output from setting up the cradle Cradle {cradleRootDir = "/Users/admin/GitLab/vegoia-tree-lib", cradleOptsProg = CradleAction: Stack}
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: vegoia-tree-lib
/Users/admin/GitLab/vegoia-tree-lib/.stack-work/install/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/snapshots/x86_64-osx/48f6e8c3aa2666127717add4dde2ccf130aec2c609be78e4f501d7766e16a5f7/8.8.2/pkgdb:/Users/admin/.stack/programs/x86_64-osx/ghc-8.8.2/lib/ghc-8.8.2/package.conf.d
File: /Users/admin/GitLab/vegoia-tree-lib/src/Vegoia/DecisionTree/Model.hs
...
```
Looks like the error is:
*
ghcide compiled against GHC 8.8.4 but currently using 8.8.2
This is unsupported, ghcide must be compiled with the same GHC version as the project.
*
How can this be possible? I have just compiled the tool with stack ./install.hs hls. Do I need to manually build for each compiler?
Yes, if you are using GHC 8.8.2, you should build hls-8.8.2 to use HLS with the compiler.
Ref: https://github.com/haskell/haskell-language-server#install-specific-ghc-version
My fault! Issue resolved. Thanks
With that said, should we maybe get rid of the haskell-language-server-8.8 symlinks since they're not guaranteed to work? I.e. only symlink haskell-language-server and haskell-language-server-8.x.y, not haskell-language-server-8.x
I think another thing that could be really helpful would be having such an error reported in vscode (output).
Most helpful comment
I think another thing that could be really helpful would be having such an error reported in vscode (output).