Skip to content

Distributable binaries and install-less VS Code extension #158

Closed
@lukel97

Description

@lukel97

It's becoming increasingly obvious that one of the major turnoffs for newcomers is the manual installation. Since we're pulling in so many dependencies, and for a complete install of all the different versions this can take multiple hours. It's a problem that we've had in haskell-ide-engine, and has carried over to haskell-language-server.

One of the most promising solutions was the idea of static binaries. Much work has already been carried out to make haskell-ide-engine more portable, by removing data files in hlint and libexec runtime executables in cabal-helper. And now with haskell-language-server and ghcide, I am not aware of any major blockers.

I've started working on a GitHub Actions workflow to generate binaries of haskell-language-server, building across Linux, macOS and Windows for GHC 8.6 through to 8.10. It gets triggered whenever a new release is created, then after building the binaries uploads them to the release as assets.

My aim is to have the vscode-hie-server VS Code extension automatically download these binaries for the appropriate platform and GHC version on an ad-hoc basis. This way newcomers can simply just install the extension from the VS Code marketplace, create a .hs file and start coding – without the need to build ghcide/haskell-language-server from source, or even having to install Stack or Cabal.

The only prerequisite is that GHC still needs to be installed, for the GHC libdir that the GHC API uses. And more importantly, this libdir (usually /usr/local/lib/ghc-8.10.1/ or something like that) needs to be fetched on the fly for static binaries – currently (in the non-nix scenario) it is obtained via ghc-paths, which bakes the path the libdir at compile time. Unfortunately this path will be different on the GitHub Actions runners than it will be on the users machine, so we will have to go back to how haskell-ide-engine called ghc --print-libdir to get this on the fly:

https://github.com/haskell/haskell-ide-engine/blob/aca3241eb0ea00de171f791d48a4861820327132/hie-plugin-api/Haskell/Ide/Engine/Cradle.hs#L99-L131

ghc is cradle specific however – on Stack, it will be the ghc that it downloaded, whilst for Cabal it may depend on the --with-compiler flag. Therefore I thought it made sense to delegate this work to hie-bios. I have a patch for hie-bios which returns the libdir alongside the GHC flags, calling stack exec ghc and cabal v2-exec ghc as needed. Or just ghc --print-libdir if a direct cradle is being used

One last crazy idea might be to actually start shipping and downloading the GHC libraries, so that there are zero dependencies entirely. How feasible this actually is, I'm not sure.

HLS downloading binaries

Metadata

Metadata

Assignees

Labels

CIContinuous integrationtype: enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions