vscode-haskell icon indicating copy to clipboard operation
vscode-haskell copied to clipboard

HLS not starting if no HLS is installed in the system, even with "haskell.manageHLS": "GHCup" and ghcup installed

Open miguel-negrao opened this issue 2 years ago • 8 comments

Your environment

Which OS do you use:

Debian stable

Steps to reproduce

rm -r ~/.ghcup
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

In the installation I selected keep normal stack behaviour and I didn't install an hls. I assumed that haskell vscode would manage the installation of hls.

Open a stack haskell project, open a .hs file

Expected behaviour

start hls

Actual behaviour

hls doesn't start

Include debug information

vscode user preferences has

"haskell.manageHLS": "GHCup",

vscode workspace preferences doesn't exist.

Execute in the root of your project the command haskell-language-server-wrapper --debug . and paste the logs here (you can find the executable location here):

Debug output:
$ LANG=C; haskell-language-server-wrapper --debug .
bash: haskell-language-server-wrapper: command not found

Paste the contents of extension specific log, you can check instructions about how to find it here

Extension log:
2023-05-09 08:56:44.6390000 [client] INFO Finding haskell-language-server
2023-05-09 08:56:44.6510000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:44.6570000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:44.6580000 [client] INFO Executing 'ghcup --no-verbose upgrade' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:44.9610000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:44.9680000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:44.9690000 [client] INFO Executing 'ghcup --no-verbose list -t hls -c installed -r' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.0410000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:45.0480000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:45.0490000 [client] INFO Executing 'ghcup --no-verbose list -t hls -c available -r' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.1330000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:45.1400000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:45.1400000 [client] INFO Executing 'ghcup --no-verbose list -t cabal -c installed -r' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.2030000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:45.2080000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:45.2090000 [client] INFO Executing 'ghcup --no-verbose list -t stack -c installed -r' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.2710000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:45.2750000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:45.2760000 [client] INFO Executing 'ghcup --no-verbose whereis hls 1.10.0.0' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.2920000 [client] ERROR Error executing 'ghcup --no-verbose whereis hls 1.10.0.0' with error code 30
2023-05-09 08:56:45.2920000 [client] ERROR stderr: [1m[ Error ][0m []8;;https://errors.haskell.org/messages/GHCup-00130\GHCup-00130]8;;\] The version 1.10.0.0 of the tool hls is not installed.

2023-05-09 08:56:45.2920000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:45.2990000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:45.2990000 [client] INFO Executing 'ghcup --no-verbose whereis cabal 3.6.2.0' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.3150000 [client] INFO Checking for ghcup installation
2023-05-09 08:56:45.3210000 [client] INFO found ghcup at ghcup
2023-05-09 08:56:45.3210000 [client] INFO Executing 'ghcup --no-verbose whereis stack 2.9.3' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'
2023-05-09 08:56:45.3430000 [client] INFO Executing 'ghc --numeric-version' in cwd '/home/miguel/Development/Haskell/projects/SC/repos/essence-of-live-coding-gi-gtk'

I believe the cause of this problem is that haskell vscode requires at least a version of HLS to be installed. After installing at least one hls the error goes away. But the readme almost says the opposite: "so if you want your HLS installations to be managed by the Extension, you will have to follow the installation instructions for GHCup.". This does not say that an HLS has to be installed manually, or during the ghcup installation, and hints at the opposite, that haskell vscode will manage the installation of HLS. I suggest changing the readme to say that at least one hls must be installed when installing ghcup.

miguel-negrao avatar May 09 '23 09:05 miguel-negrao

Heyo, thank you for the bug report!

Please post the extension logs with debug info, step 3 from https://github.com/haskell/vscode-haskell#investigating-and-reporting-problems. The extension should work as advertised, no prior installation of HLS is necessary.

fendor avatar May 09 '23 10:05 fendor

I uninstalled all hls versions using ghcup tui then followed the instructions provided above for debug messages. The logs are bellow:

2023-05-10 08:47:50.1280000 [client] DEBUG Environment variables:
2023-05-10 08:47:50.1290000 [client] DEBUG   PATH: /home/miguel/.elan/bin:/home/miguel/.opam/default/bin:/home/miguel/.nix-profile/bin:/home/miguel/.nix-profile/sbin:/usr/local/cuda-10.1/bin/:/home/miguel/.npm/bin:/home/miguel/Documentos/IPLeiria/6_Scripts:/home/miguel/.local/bin:/home/miguel/Development/docker/docker-dei-ipleiria:/home/miguel/.cabal/bin:/bin:/usr/sbin:/media/miguel/internal2/bin:/home/miguel/.gem/ruby/2.2.0/bin:/home/miguel/.gem/ruby/2.1.0/bin:/home/miguel/bin:/home/miguel/.cabal/bin:/home/miguel/.ghcup/bin:/run/user/1000/fnm_multishells/920636_1683708435435/bin:/home/miguel/.fnm:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
2023-05-10 08:47:50.1290000 [client] INFO Finding haskell-language-server
2023-05-10 08:47:50.1300000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.1370000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.1380000 [client] INFO Executing 'ghcup --no-verbose upgrade' in cwd '/home/miguel'
2023-05-10 08:47:50.2430000 [client] DEBUG Execution of 'ghcup --no-verbose upgrade' terminated with code 0
2023-05-10 08:47:50.2440000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.2510000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.2520000 [client] INFO Executing 'ghcup --no-verbose list -t hls -c installed -r' in cwd '/home/miguel'
2023-05-10 08:47:50.3500000 [client] DEBUG Execution of 'ghcup --no-verbose list -t hls -c installed -r' terminated with code 0
2023-05-10 08:47:50.3500000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.3560000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.3570000 [client] INFO Executing 'ghcup --no-verbose list -t hls -c available -r' in cwd '/home/miguel'
2023-05-10 08:47:50.4230000 [client] DEBUG Execution of 'ghcup --no-verbose list -t hls -c available -r' terminated with code 0
2023-05-10 08:47:50.4240000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.4300000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.4310000 [client] INFO Executing 'ghcup --no-verbose list -t cabal -c installed -r' in cwd '/home/miguel'
2023-05-10 08:47:50.4890000 [client] DEBUG Execution of 'ghcup --no-verbose list -t cabal -c installed -r' terminated with code 0
2023-05-10 08:47:50.4890000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.4960000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.4970000 [client] INFO Executing 'ghcup --no-verbose list -t stack -c installed -r' in cwd '/home/miguel'
2023-05-10 08:47:50.5640000 [client] DEBUG Execution of 'ghcup --no-verbose list -t stack -c installed -r' terminated with code 0
2023-05-10 08:47:50.5710000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.5770000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.5780000 [client] INFO Executing 'ghcup --no-verbose whereis hls 1.10.0.0' in cwd '/home/miguel'
2023-05-10 08:47:50.5940000 [client] DEBUG Execution of 'ghcup --no-verbose whereis hls 1.10.0.0' terminated with code 30
2023-05-10 08:47:50.5950000 [client] ERROR Error executing 'ghcup --no-verbose whereis hls 1.10.0.0' with error code 30
2023-05-10 08:47:50.5950000 [client] ERROR stderr: [1m[ Error ][0m []8;;https://errors.haskell.org/messages/GHCup-00130\GHCup-00130]8;;\] The version 1.10.0.0 of the tool hls is not installed.

2023-05-10 08:47:50.5950000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.6030000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.6030000 [client] INFO Executing 'ghcup --no-verbose whereis cabal 3.6.2.0' in cwd '/home/miguel'
2023-05-10 08:47:50.6200000 [client] DEBUG Execution of 'ghcup --no-verbose whereis cabal 3.6.2.0' terminated with code 0
2023-05-10 08:47:50.6200000 [client] INFO Checking for ghcup installation
2023-05-10 08:47:50.6270000 [client] INFO found ghcup at ghcup
2023-05-10 08:47:50.6280000 [client] INFO Executing 'ghcup --no-verbose whereis stack 2.9.3' in cwd '/home/miguel'
2023-05-10 08:47:50.6480000 [client] DEBUG Execution of 'ghcup --no-verbose whereis stack 2.9.3' terminated with code 0
2023-05-10 08:47:50.6560000 [client] INFO Executing 'ghc --numeric-version' in cwd '/home/miguel'
2023-05-10 08:47:50.8140000 [client] DEBUG Execution of 'ghc --numeric-version' terminated with code 0

miguel-negrao avatar May 10 '23 08:05 miguel-negrao

VSCode should be asking you whether you want to install the HLS version: image

Is this pop-up not showing?

fendor avatar May 10 '23 09:05 fendor

There is no pop-up appearing...

miguel-negrao avatar May 10 '23 09:05 miguel-negrao

Ok, can you share your settings.json?

It is located at ~/.config/VSCodium/User/settings.json or ~/.config/VSCode/User/settings.json or something like that.

fendor avatar May 10 '23 11:05 fendor

{
    "code-runner.runInTerminal": true,
    "editor.minimap.enabled": false,
    "hoogle-vscode.url": "http://localhost:1080/",
    "terminal.integrated.fontFamily": "monospace, PowerlineSymbols",
    "breadcrumbs.enabled": true,
    "cmake.configureOnOpen": true,
    "ghcSimple.replCommand": "ghci",
    "markdown.marp.enableHtml": true,
    "latex-workshop.view.pdf.viewer": "tab",
    "zenMode.hideLineNumbers": false,
    "[latex]": {
        "editor.wordWrap": "on"
    },
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "C_Cpp.default.cStandard": "gnu11",
    "haskell.trace.server": "messages",
    "editor.wordWrap": "on",
    "jupyter.enableAutoMoveToNextCell": false,
    "jupyter.askForKernelRestart": false,
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter-notebook"
    },
    "git.confirmSync": false,
    "files.insertFinalNewline": true,
    "diffEditor.ignoreTrimWhitespace": false,
    "notebook.cellToolbarLocation": {
        "default": "right",
        "jupyter-notebook": "left"
    },
    "python.defaultInterpreterPath": "/usr/bin/python3",
    "workbench.colorTheme": "Default Light+",
    "coqtop.binPath": "/home/miguel/.opam/default/bin/",
    "debug.console.fontSize": 12,
    "editor.unicodeHighlight.nonBasicASCII": false,
    "editor.renderWhitespace": "none",
    "haskell.manageHLS": "GHCup",
    "agdaMode.connection.agdaPath": "/home/miguel/.local/bin/agda",
    "terminal.integrated.shellIntegration.enabled": true,
    "extensions.autoUpdate": "onlyEnabledExtensions",
    "latex-workshop.latex.autoBuild.run": "onSave",
    "[python]": {
        "editor.formatOnType": true
    },
    "haskell.formattingProvider": "fourmolu",
    "haskell.trace.client": "debug",
}

miguel-negrao avatar May 10 '23 14:05 miguel-negrao

Hm, unfortunately, I can't tell then, why the pop up isn't shown :(

fendor avatar May 10 '23 14:05 fendor

Yeah, I tried replicating in a vm and I didn't find this problem. It must be something very specific about my system... I guess you can close the issue.

miguel-negrao avatar May 11 '23 10:05 miguel-negrao