haskell / docker-haskell

MIT License
63 stars 37 forks source link

Include language server #116

Closed prabhupraveen closed 10 months ago

prabhupraveen commented 11 months ago

One needs to install GHCup and HLS on the host environment to be able to use HLS on VSCode. Also, while the VSCode plugin can manage automatic installation of the HLS, mapping Haskell version to supported HLS version has to be done manually on each project.

It would be great to include supported and matching HLS version in the docker image itself. By using VSCode devcontainers one can then launch docker container and get HLS features out of the box.

Assuming HLS is available within the image, one can easily launch a devcontainer in VSCode following these steps:

Pre-requisites:

Project setup:

Launch VSCode and open the project folder. VSCode will detect the devcontainer json and prompt reloading the project in devcontainer, and will launch it once accepted. One can now start developing in ghc with syntax highlighting and other HLS features.

I have managed to get this working on my ubuntu desktop. However, there are some observations:

I can submit a PR for Dockerfile, attached a working sample here

prabhupraveen commented 10 months ago

I can see that this was already discussed and closed in #76. Hence closing this.

prabhupraveen commented 10 months ago

... Although, this solution did not involve installing GHCup in the container, but followed similar steps as installing stack, cabal and Haskell by directly downloading and installing HLS, hence a much cleaner solution, and I am of the opinion that including HLS (without GHCup) in the container still a good idea.