Skip to content

Instantly share code, notes, and snippets.

@jbreckmckye
Created February 24, 2020 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbreckmckye/f63f69476b8f1c61e3c45e02a34b821a to your computer and use it in GitHub Desktop.
Save jbreckmckye/f63f69476b8f1c61e3c45e02a34b821a to your computer and use it in GitHub Desktop.
GHCIDE & VSCode setup

GHCIDE & VSCode setup

1. Install Stack

curl -sSL https://get.haskellstack.org/ | sh
stack upgrade

Then ensure ~/.local/bin is on your $PATH.

2. Install GHCIDE

  1. Check out the project source from git clone https://github.com/digital-asset/ghcide.git
  2. cd into the project you just checked out
  3. Run stack install to compile GHCIDE and make it available to all Stack projects

3. Set up VS Code

  1. Install VSCode for Mac
  2. Install the GHCIDE extension

4. Get GHCIDE working with your project

cd into your project and run stack build. This will make Stack artefacts available for GHCIDE to use.

You'll have to re-run this step every time dependencies change.

5. Restart VSCode and load the project

Note the 'processing' message in the bottom left of your IDE - this is GHCIDE working things out. Wait until it's finished.

6. Get using GHC IDE!

  • Syntax will be highlighted
  • You can hover over anything to see its type and where it's imported from
  • You can Ctrl+Click to go a definition (at least if it's local to the project)
@jbreckmckye
Copy link
Author

@jbreckmckye
Copy link
Author

For Windows, you'll usually need to put C:\Users\$NAME\AppData\Roaming\local\bin on the PATH, to make installed Stack packages available globally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment