Skip to content

Instantly share code, notes, and snippets.

@Wizek
Forked from lspitzner/a.txt
Created August 19, 2017 10:56
Show Gist options
  • Save Wizek/64a2956c47e5260beddd75e40181b4cd to your computer and use it in GitHub Desktop.
Save Wizek/64a2956c47e5260beddd75e40181b4cd to your computer and use it in GitHub Desktop.
sublime3+ghcid setup for quick haskell coding feedback
sublime3 and ghcid setup for quick haskell coding feedback
tested on sublime 3
(you can omit the SublimeOnSaveBuild steps, as the result is not
completely reliable anyways. i still find it useful, though.)
steps:
- install https://github.com/lspitzner/SublimeOnSaveBuild
(original from alexnj; in his/her version the build-window gets closed
immediately.)
(i recommend the direct clone-into-packages-dir method for installation;
package control was annoying the last times i tried to use it)
- put the `haskell-ghcid.sublime-build` into
`~/.config/sublime-text-3/Packages/User/` or equivalent.
- might need to restart sublime.
- ensure that you have saved the sublime project for the project you are
working on; the above custom build relies on the project's path to
get access to the output of ghcid.txt.
- switch to the newly added haskell-ghcid build system.
- run `ghcid -o=ghcid.txt` in the project directory.
- save or ctrl-b/f7 to start build (i.e. re-read ghcid.txt)
- make use of f4 to jump cursor to next error location
known issues (all in regards to SublimeOnSaveBuild):
- i added the custom delay of 0.5s to the build in order to let ghcid do its
part. i tried prettier solutions, but they performed worse. may need
adjustments.
- still, from time to time you get an empty build window after saving. you
can press ctrl-b to get the results.
- if you are unlucky, you may even get last build's results..
writing plugins for sublime seems straight-forward, it might be worth
enabling ghcid to push the results to some new plugin instead of this
weird semi-reliable file-based pulling.
{
"working_dir": "${project_path}",
"cmd": ["sleep 0.5; cat ghcid.txt"],
"shell": true,
"file_regex": "^(\\S*?):(\\d+):(\\d+):" // this matches the output of ghc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment