如何在使用带有文件监视的堆栈构建之前清除控制台

How can I clear console before build using stack with file watch

在使用 VSCode 进行重大重构时,我发现 运行:

stack build --file-watch

在集成的 Powershell 终端中非常宝贵。我想知道是否有办法以某种方式在前面加上一个清晰的终端命令,这样我只看到最后一批错误。

类似于:

stack build --exec-before "cmd cls" --file-watch

注意exe-before不是真正的堆栈命令

尝试直接在 IDE!

中运行的 ghcid. It's a program which does exactly what you want: run the appropriate command when a file changes, clearing the screen between changes. Have a look at this tutorial for more details. Plus, it looks like there's even a Visual Studio Code 扩展

VSCode 有一些扩展,可以即时编译打开的文件并在 PROBLEMS window 中填充错误和警告。根据我的个人经验,我推荐 Simple GHC,它开箱即用且非常稳定。