Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic installation of haskell-language-server binaries and make haskell-langauge-server the default #236

Merged
merged 22 commits into from Jul 22, 2020

Conversation

bubba
Copy link
Collaborator

@bubba bubba commented Jun 14, 2020

  1. Add automatic download, installation and upgrade of haskell-language-server binaries
  2. Remove the insert type, show type, split case and HaRe commands as their corresponding commands no longer exist in HIE
  3. Bold, but make haskell-language-server the default, as it has the easiest installation process for newcomers. Ideally they should just be able to install the extension from the vscode marketplace and not have to do anything else

Fixes #237

Todo

  • Document how the downloading + installation works, and how to make releases on haskell-language-server
  • Document that GHC is a prerequisite! For now anyway
  • Real world testing

@jneira
Copy link
Member

jneira commented Jun 23, 2020

@bubba thanks a lot for working on this. The pr looks really good but, should the downloaded from your repo wrapper version responds to --project-ghc-version?
The wrapper was downloaded succesfully but then i got on hls itself:
Couldn't figure out what GHC version the project is using and then
haskell-language-server executable missing, please make sure it is installed, see https://github.com/haskell/haskell-language-server.

I will try to investigate why it does not return the project version, if it is a windows specific issue.

@bubba
Copy link
Collaborator Author

bubba commented Jun 23, 2020

Thanks for helping test this! It should be using that queried version, but indeed I’ve only tried it on Mac so far. Does hls-wrapper —project-ghc-version work ok from the command line on the project you’re opening?

@jneira
Copy link
Member

jneira commented Jun 23, 2020

Hi! i see you have added the exe extension for windows, maybe it was not working for that
Maybe it would be great to log with more details: location of downloaded binaries, what version has been downloaded, the output of http calls or from hls-wrapper --project-ghc-path, ...
It will help us to diagnose user problems within the process (and me to find where the hell is the downloaded hls-wrapper in windows :-P)

@jneira
Copy link
Member

jneira commented Jun 23, 2020

With the .exe fix the executables have been downloaded and run succesfully: 😄

[client] run command: "c:\Users\atrey\AppData\Roaming\Code\User\globalStorage\alanz.vscode-hie-server\haskell-language-server-test-release-27-win32-8.10.1.exe --lsp"
[client] debug command: "c:\Users\atrey\AppData\Roaming\Code\User\globalStorage\alanz.vscode-hie-server\haskell-language-server-test-release-27-win32-8.10.1.exe --lsp -d -l C:\TEMP\hls.log"
[client] server cwd: undefined
ghcide version: 0.1.0.0 (GHC: 8.10.1) (PATH: C:\Users\atrey\AppData\Roaming\Code\User\globalStorage\alanz.vscode-hie-server\haskell-language-server-test-release-27-win32-8.10.1.exe) (GIT hash: d0aa2fa0734d59148e46a4c0e15a52b9a2dca6f8)
Starting (haskell-language-server)LSP server...
  with arguments: Arguments {argLSP = True, argsCwd = Nothing, argFiles = [], argsVersion = False, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = True, argsLogFile = Just "C:\\TEMP\\hls.log", argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "floskell",PluginId "ghcide",PluginId "ormolu",PluginId "pragmas"]
  in directory: d:\dev\ws\haskell\hls
If you are seeing this in a terminal, you probably should have run ghcide WITHOUT the --lsp option!
 Started LSP server in 0.01s
Consulting the cradle for "D:\\dev\\ws\\haskell\\hls\\ghcide\\src\\Development\\IDE\\Core\\Rules.hs"
> Resolving dependencies...
> Build profile: -w ghc-8.8.3 -O1
> In order, the following will be built (use -v for more details):
>  - ghcide-0.2.0 (lib) (ephemeral targets)
> Preprocessing library for ghcide-0.2.0..
Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","D:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build","-odir","D:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build","-hidir","D:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build","-stubdir","D:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build","-i","-iD:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build","-isrc","-isrc-ghc88","-iD:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build\\autogen","-iD:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build\\global-autogen","-ID:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build\\autogen","-ID:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build\\global-autogen","-ID:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build","-Iinclude","-ID:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build\\include","-optP-include","-optPD:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\build\\autogen\\cabal_macros.h","-this-unit-id","ghcide-0.2.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","C:\\sd\\ghc-8.8.3\\package.db","-package-db","D:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\packagedb\\ghc-8.8.3","-package-db","D:\\dev\\ws\\haskell\\hls\\ghcide\\dist-newstyle\\build\\x86_64-windows\\ghc-8.8.3\\ghcide-0.2.0\\package.conf.inplace","-package-id","Win32-2.6.1.0","-package-id","aeson-1.5.2.0-3e7a31f628dc17023fa599a7be5a4c3c55413057","-package-id","array-0.5.4.0","-package-id","async-2.2.2-05756a1172b8b4fad3f56c1edb02d7883d7f9090","-package-id","base-4.13.0.0","-package-id","binary-0.8.7.0","-package-id","bytestring-0.10.10.0","-package-id","containers-0.6.2.1","-package-id","data-default-0.7.1.1-033226fdb10d071ccb7a11bb006186d99a023015","-package-id","deepseq-1.4.4.0","-package-id","directory-1.3.6.0","-package-id","extra-1.7.3-713eadda819888407a3094ca03e8984f61512675","-package-id","filepath-1.4.2.1","-package-id","fuzzy-0.1.0.0-a1f9cd0533a12e3dbe4d55b4c07c91f9d8716a14","-package-id","ghc-8.8.3","-package-id","ghc-boot-8.8.3","-package-id","ghc-boot-th-8.8.3","-package-id","haddock-libra_-1.9.0-5e5c2696deffe76437e337dfd36e86409319d966","-package-id","hashable-1.3.0.0-270f4c47d6f231557da8f0cdcd265797c63e63c6","-package-id","haskell-lsp-0.22.0.0-507d6fbfe6ed9cd670a9b442375e2d3d4907ddb6","-package-id","haskell-lsp-t_-0.22.0.0-cbb891f150067c68a5c594da418740085d609e67","-package-id","hslogger-1.3.1.0-8dabf3b71c3b3aaa9a96a77dd1975ce0d4d016c2","-package-id","mtl-2.2.2","-package-id","network-uri-2.6.3.0-a8a129a5c09cabf0fed128f1c047ffb39c6b5a63","-package-id","opentelemetry-0.4.2-2b76bffa0c7aa9f4ff05c39dc8c2369589086b66","-package-id","prettyprinter-1.6.1-03e250dc83761c5a0aff39b1ca90c29f3c5358f7","-package-id","prettyprinter_-1.1.1.2-4de664b837e96ce6da22ecc0623dae8f8b6c946e","-package-id","regex-tdfa-1.3.1.0-2a0466af0a970ab30ce13d4cb622a321a4093834","-package-id","rope-utf16-sp_-0.3.1.0-01c54e16be7a151c53ebf982be90918616335230","-package-id","safe-exceptio_-0.1.7.0-4f8f1b72122469249d1c30e57885e8af762af26a","-package-id","shake-0.19.1-bc681ccb6823ad8269fdeb56795c2d8ac05f303c","-package-id","sorted-list-0.2.1.0-157fdbeba256c0005baba44094ddc60464f04ee6","-package-id","stm-2.5.0.0","-package-id","syb-0.7.1-862fb43c25f90dd34620c9c49501c18a592967da","-package-id","text-1.2.4.0","-package-id","time-1.9.3","-package-id","transformers-0.5.6.2","-package-id","unordered-con_-0.2.11.0-09d3bcadcbbc35431f4f2b870445379868b957e4","-package-id","utf8-string-1.0.1.1-20b315cdb7319b31a4a470d5ff5701f052c91fdd","-XHaskell2010","-XBangPatterns","-XDeriveFunctor","-XDeriveGeneric","-XGeneralizedNewtypeDeriving","-XLambdaCase","-XNamedFieldPuns","-XOverloadedStrings","-XRecordWildCards","-XScopedTypeVariables","-XStandaloneDeriving","-XTupleSections","-XTypeApplications","-XViewPatterns","Development.IDE.Compat","Development.IDE.Core.Debouncer","Development.IDE.Core.FileStore","Development.IDE.Core.IdeConfiguration","Development.IDE.Core.OfInterest","Development.IDE.Core.PositionMapping","Development.IDE.Core.Rules","Development.IDE.Core.RuleTypes","Development.IDE.Core.Service","Development.IDE.Core.Shake","Development.IDE.GHC.Error","Development.IDE.GHC.Util","Development.IDE.Import.DependencyInformation","Development.IDE.LSP.HoverDefinition","Development.IDE.LSP.LanguageServer","Development.IDE.LSP.Outline","Development.IDE.LSP.Protocol","Development.IDE.LSP.Server","Development.IDE.Spans.Common","Development.IDE.Types.Diagnostics","Development.IDE.Types.Location","Development.IDE.Types.Logger","Development.IDE.Types.Options","Development.IDE.Plugin","Development.IDE.Plugin.Completions","Development.IDE.Plugin.CodeAction","Development.IDE.Core.Compile","Development.IDE.Core.Preprocessor","Development.IDE.Core.FileExists","Development.IDE.GHC.Compat","Development.IDE.GHC.CPP","Development.IDE.GHC.Orphans","Development.IDE.GHC.Warnings","Development.IDE.GHC.WithDynFlags","Development.IDE.Import.FindImports","Development.IDE.LSP.Notifications","Development.IDE.Spans.AtPoint","Development.IDE.Spans.Documentation","Development.IDE.Plugin.CodeAction.PositionIndexed","Development.IDE.Plugin.CodeAction.Rules","Development.IDE.Plugin.CodeAction.RuleTypes","Development.IDE.Plugin.Completions.Logic","Development.IDE.Plugin.Completions.Types","Development.IDE.GHC.HieAst","Development.IDE.GHC.HieBin","-Wall","-Wno-name-shadowing","-hide-all-packages"], componentRoot = "D:\\dev\\ws\\haskell\\hls\\ghcide", componentDependencies = ["ghcide.cabal","cabal.project","cabal.project.local"]})

But the file load process is stuck after that line, it didn't happened with the last hls i installed from source 🤔

@jneira
Copy link
Member

jneira commented Jun 23, 2020

Oh, i just have seen that it downloaded hls for ghc-8.10.1 but the project is using ghc-8.8.3, cause i am using the cabal cradle and my default ghc on path is that one

EDIT:

PS D:\dev\ws\haskell\hls> C:\Users\atrey\AppData\Roaming\Code\User\globalStorage\alanz.vscode-hie-server\haskell-language-server-wrapper-test-release-27-win32.exe --project-ghc-version
8.10.1
PS D:\dev\ws\haskell\hls> ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3
PS D:\dev\ws\haskell\hls> cabal exec ghc -- --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3

I guess it comes from your hie-bios branch with getRuntimeGhcLib, i will chase it

@jneira
Copy link
Member

jneira commented Jun 23, 2020

@bubba your hie-bios version runtime ghc libdir seems to be correct for hls:

PS D:\dev\ws\haskell\hls> hie-bios debug .\ghcide\src\Development\IDE\Core\Rules.hs
Root directory:        D:\dev\ws\haskell\hls
Component directory:   D:\dev\ws\haskell\hls\ghcide
GHC options:           -fbuilding-cabal-package --lotofthem
GHC library directory: Just "D:\\bin\\stack\\x86_64-windows\\ghc-8.8.3\\lib"
Config Location:       D:\dev\ws\haskell\hls\ghcide\hie.yaml
Cradle:                Cradle {cradleRootDir = "D:\\dev\\ws\\haskell\\hls\\ghcide", cradleOptsProg = CradleAction: Cabal}
Dependencies:          haskell-language-server.cabal cabal.project cabal.project.local

@bubba
Copy link
Collaborator Author

bubba commented Jun 24, 2020

@jneira did you link the hie.yaml.cbl to hie.yaml in hls? That's definitely weird that ghc --version and cabal exec ghc -- --version return 8.8.3 but the wrapper is showing 8.10.1. I suspect the wrapper is returning 8.10.1 because that's what it was compiled with, but its even weirder that hie-bios debug is returning something else. Perhaps the wrapper didn't pick up the correct cradle?

@jneira
Copy link
Member

jneira commented Jun 24, 2020

I installed hie-bios with ghc-8.8.3 as well, i will try to install with other thsn default one to see what happens
Anyway it should return the ghc used at runtime, right?
I am using the hie.yaml.cbl.

@bubba bubba marked this pull request as ready for review Jul 22, 2020
bubba and others added 17 commits Jul 22, 2020
This removes the show type command, the insert type command, the HaRe
commands and the case split command – none of them have existed in HIE
for a while now, and none of them are in ghcide/hls either
It's a bit hairy passing about a map
Also rename a bunch of configuration paths so that they're server
agnostic. This will break people's configurations
Co-authored-by: Brian McKenna <bmckenna@atlassian.com>
Also update README and use throwing to propagate ghc version errors
So we know when it finished successfully
bubba added 2 commits Jul 22, 2020
Also some last minute renaming of things
Fix some conflicting rules about quotemarks too
@bubba bubba changed the title Automatic installation of haskell-language-server binaries Automatic installation of haskell-language-server binaries and make haskell-langauge-server the default Jul 22, 2020
Also clarify what exactly the extension does, and what the language
servers do. Closes haskell#178
@bubba bubba merged commit 940a29e into haskell:master Jul 22, 2020
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants