Simple GHC (Haskell) Integration for VSCode
Simple Haskell support using only GHCi.
(Icon derived from logo on http://haskell.org/.)
- Haskutil provides Quick Fix actions for tasks like missing/redundant imports that GHC reports. It works with this extension by reading the diagnostics it produces.
Get vscode-ghc-simple from the Visual Studio Marketplace or run the following in Quick Open:
ext install dramforever.vscode-ghc-simple
Alternatively, if you want the latest and greatest, you can download
vsix files from GitHub Actions. Pick the latest build, and check out the 'Artifacts' section.
This VSCode extension provides editing enhancements for Haskell development.
Currently implemented features:
Diagnostics: Basic squiggles and error messages. Automatic re-checking on save.
Completion: Crude completion with GHCi's
:complete command, with
:doc lookup. Works okay with imported and top level identifiers.
Hover: Hover to see
Type: View types by selecting in the code. The minimal expression covering the selection will have its type shown. Implemented with
Inline REPL: Add REPL blocks to your code with haddock syntax, either using no spaces before
>>> or put it in a comment like
-- >>>. Click on the code lens or type
Shift+Enter to run a single block, or type
Shift+Alt+Enter to run all blocks in a file.
If the first line of a block begins with
:set, it also applies to loading dependency modules. One use is to override
Definition and usages: See definitions amd references of identifiers. Supports both module level and local identifiers. Implemented with
uses. Does not yet support identifiers imported from packages.
Since around GHC 8, the compiler GHC and its interactive REPL GHCi has gained various tooling-related features. These allow for more tooling that communicate with the compiler using text IO and files, instead of a Haskell API. This project aims to explore the possibilities provided by said features, by implementing Haskell tooling within the editor VSCode.
Install the extension from the marketplace or using the Quick Open command
ext install dramforever.vscode-ghc-simple. Open individual Haskell source files or projects, and vscode-ghc-simple will try to use the appropriate way to start a GHCi session and communicate with it to provide editor tooling.
hie.yaml or the extension configuration to tweak vscode-ghc-simple's behavior. Check out the wiki page Project Configuration for more.
Checking the logs
The full log of interaction between GHCi and this extension can be found by clicking the 'GHC' item on the status bar:
When reporting an issue please also attach relevant log output, ideally (but not necessarily) from a fresh start (
Developer: Reload Window command) to reproduction of the bug. You can also check there when things go unexpectedly.
For the FAQ and more on configuring your project, configuring the extension, etc., please check out the wiki page on GitHub.