Summary: New versions of Ghcid and the VS Code extension work even better together.
I've just released Ghcid v0.6.8 and the associated VS Code extension haskell-ghcid v0.2.0. Together they vastly simplify the Ghcid VS Code experience.
Ghcid reads .ghcid files
A new feature in Ghcid is that if there is a .ghcid
file in the current directory it will load it as additional arguments. For example, in the Shake repo I have a .ghcid
file:
-c "ghci -fno-code -ferror-spans"
Which tells ghcid
to not guess at the command (e.g. using stack
if you have a .stack-work
) but always run ghci -fno-code -ferror-spans
. This command works because I have a .ghci
file which loads all the necessary files, while -fno-code
speeds up compilation and -ferror-spans
gives better error highlighting.
Ghcid VS Code starts ghcid
A new feature in the VS Code extension is the action Start Ghcid
which starts a new ghcid
terminal, writes the output to a temporary file, and uses that output to populate the Problems pane. Importantly, the extension runs ghcid
with no command line arguments, so having a sensible .ghcid
lets you control what it does.
The effect of these changes is that to start ghcid
in VS Code is now a few key strokes, whereas before it required special flags, opening files, running commands etc.
13 comments:
> Importantly, it runs ghcid with no additional arguments, so having a sensible .ghcid file is important.
I'm not sure if I understand this sentence correctly. I think this means "VS Code extension ignores .ghcid file, so there's the case in which even if you want to pass arguments to ghcid, they won't be passed". Am I correct?
@hogetaroubig: VS Code doesn't let you pass command line arguments, so the .ghcid file is essential, as that's where you can control what ghcid does. I've updated the text in the post to try and make that clearer - thanks for letting me know.
I understand. Thank you!
I'm working on translating Haskellers' blog posts into Japanese. I translated your blog posts including this recently. I'd like to share them on the Internet. Is this alright?
@hogetaroubig: Certainly, I'd be delighted!
Only requirement is that you include a link to the original and acknowledge me as the author and you as the translator. I'd also suggest you comment with your translated version in the comments to my blog, so people can find it.
I'm glad to hear that!
All right, I will:)
Translated into Japanese: https://haskell.e-bigmoon.com/posts/2017-12-24-ghcid-with-vs-code
Thank you for your awesome blog posts!
how about standard Vim integration?
Unknown: If someone writes it, I'll host it in the ghcid repo if they want, similarly for Atom/Emacs/Yi/Nano or whatever people want.
This no longer works. I get the following error by following the instructions for .ghcid file:
```shell
Loading ghci -fno-code -ferror-spans ...
GHCi, version 8.6.4: http://www.haskell.org/ghc/ :? for help
No files loaded, GHCi is not working properly.
Command: ghci -fno-code -ferror-spans
```
Răzvan: Do you have both a .ghci and .ghcid file?
@Neil Mitchell No, I only have a .gchid file.
The .ghcid file says how to start ghci. The .ghci says what to load when ghci starts. If you don't have a .ghci file then nothing loads, and then ghcid exits because nothing is loaded, so it has nothing to watch for.
Post a Comment