Skip to content

peano88/StackVCodeServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StackVCodeServer

StackVCodeServer allows to have a ready-to-go development environment including Stack and the Haskell Language Server. It leverages on code-server to let the environment directly available from your browser.

How to use

Retrieve the image from the docker hub

$ docker pull peano88/stack-code

The default image will use a special created user alonzo. If this is not OK with you and you want to change the user name you can build the image yourself using the included Dockerfile and providing the username as build argument user .

Once the image downloaded use the stack_vcodeserver.sh script to start a container

$ ./stack_vcodeserver.sh exec

Check below for more information on this script.

Time to open your browser and point to localhost:8080 : your brand new environment is ready for you to develop. Fire up the terminal (you might need to change it to /bin/bash) and tap:

$ stack new hello-world

As expected you will have created a new project named hello-world

hello-world

Plugins workaround

Unfortunately, code-server can't use the same plugins market of the original visual studio code. And if you really want to unleash the true potential of hls you should use the latest version of the vscode-haskell plugin, which is not available in the code-server market. As a workaround, you can build the plugin from source and install it directly. You will need npm so let's start by install it:

$ sudo apt-get install npm

and then install vsce and plugin language-haskell which is a required dependency (and again not available):

$ sudo npm install -g vsce
$ git clone https://github.com/JustusAdam/language-haskell.git
$ cd language-haskell
$ npm ci
$ vsce package

This will create a .vsix file that you can install manually in code-server by selecting Extensions: Install from VSIX... from the command palette.

Once done that, you can install the vscode-haskell plugin:

$ git clone https://github.com/haskell/vscode-haskell.git
$ cd vscode-haskell
$ npm install
$ vsce package

and install it manually as described above.

Once installed all features, including autocomplete and on-hover will be available.

Persistency

The script will create a docker volume and use it in the container to share the whole /home/alonzo directory with the host. This will allow you to persist systematically every changes you will operate in the container. Thus, no need to re-download every plugin and dependency every time.

Customize code-server

You can increase security, change default options and so on. You can do it directly in the container: since we are using a volume, all changes are persisted and will stay after reboot of the container. You can refer to the documentation available directly in the code-server repository to discover all available options.

stack_vcodeserver.sh script

This script is used to easily launch the development container. Here the various options:

stack_vcodeserver 
USAGE: stack_vcodeserver [OPTIONS]... COMMAND where 
OPTIONS:
        -h|--help:                       show this help
        -v|--volume VOLUME:              use VOLUME as volume name. Default is "StackVCodeVol"
        -i|--image IMAGE:                use IMAGE as image name. Default is "peano88/stack-code"
        -c|--container CONTAINER:        use CONTAINER as container name. Default is "stack_vcode"
        -u|--container USER:             use USER as the running user. Default is "alonzo"
COMMAND:
        exec:                            run the container
        build:                           recreate the container (and run it)
        stop:                            stop the container

Releases

No releases published

Packages

No packages published