haskell / haskell-language-server

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

HLS crashes immediately in vscode #2117

Closed tscholak closed 3 years ago

tscholak commented 3 years ago

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/q3ydvvxiwj2m6c1y90n8mcqbx60ih0vp-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server)
Tool versions found on the $PATH
cabal:      3.4.0.0
stack:      2.7.3
ghc:        9.0.1

Which OS do you use: NixOS Which lsp-client do you use: vscode Describe your project (alternative: link to the project): https://github.com/hasktorch/hasktorch/tree/flakify-nix-derivations Contents of hie.yaml: https://github.com/hasktorch/hasktorch/blob/flakify-nix-derivations/hie.yaml Build configuration of HLS: https://github.com/hasktorch/hasktorch/blob/8697384718783151dd909809f1f79aaa3d7f1e09/flake.nix#L61-L194

Steps to reproduce

$ nix --version
nix (Nix) 2.4pre20210802_47e96bb
$ nix develop
$ code .

Expected behaviour

HLS should not crash in vscode.

Actual behaviour

HLS immediately crashes five times in vscode.

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Too much to post here. HLS run from the command line compiles the project just fine and exits normally.

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs: ``` [client] run command: "haskell-language-server --lsp -d" [client] debug command: "haskell-language-server --lsp -d" [client] server cwd: undefined haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/q3ydvvxiwj2m6c1y90n8mcqbx60ih0vp-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, 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: /home/tscholak/Projects/thirdParty/hasktorch Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! [Info - 7:18:27 PM] Connection to server got closed. Server will restart. haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/q3ydvvxiwj2m6c1y90n8mcqbx60ih0vp-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, 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: /home/tscholak/Projects/thirdParty/hasktorch Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! [Info - 7:18:29 PM] Connection to server got closed. Server will restart. haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/q3ydvvxiwj2m6c1y90n8mcqbx60ih0vp-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, 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: /home/tscholak/Projects/thirdParty/hasktorch Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! [Info - 7:18:32 PM] Connection to server got closed. Server will restart. haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/q3ydvvxiwj2m6c1y90n8mcqbx60ih0vp-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, 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: /home/tscholak/Projects/thirdParty/hasktorch Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! [Info - 7:18:33 PM] Connection to server got closed. Server will restart. haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/q3ydvvxiwj2m6c1y90n8mcqbx60ih0vp-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server) Starting (haskell-language-server)LSP server... with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Nothing, 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: /home/tscholak/Projects/thirdParty/hasktorch Starting LSP server... If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option! [Error - 7:18:34 PM] Connection to server got closed. Server will not be restarted. ```
isovector commented 3 years ago

Probably a duplicate of #2087

tscholak commented 3 years ago

Hmm, I've built hls from rev 790afc6b920ed82e10135014e4a4ab67348d7898 which was head in master yesterday.

What strikes me here is that I don't get any useful debug output at all, the log is almost empty.

Something else to note is that I'm building hls with dynamic linking, see the linked "build configuration" above for more details.

pepeiborra commented 3 years ago

2087 was fixed in the Haskell vscode extension, are you on the latest version?

tscholak commented 3 years ago

@pepeiborra I'm on 790afc6b920ed82e10135014e4a4ab67348d7898 which was the latest version until 5 minutes ago.

pepeiborra commented 3 years ago

@pepeiborra I'm on 790afc6 which was the latest version until 5 minutes ago.

I am talking about the vscode extension

tscholak commented 3 years ago

~I'm on v1.6.0~

tscholak commented 3 years ago

I was on v1.4.0 on the machine where I observed the problem. When I updated to v1.6.0, the problem went away.