ide-purescript package for VS Code
This package provides editor support for PureScript projects in Visual Studio Code, based on the PureScript language server.
The extension language-purescript provides basic syntax highlighting support - it is required but should be installed automatically as a dependency. This package will start on opening a
See troubleshooting in case of issues.
Installation and General Use
This package makes use of the
This package will launch a
Functionality provided by the IDE server won't work until you build your project. This can either be via the built-in
build command, or via an external tool - but if you do build externally, you should be sure to
You can configure building with
With Spago (default)
Note that prior to spago version
Watching directories like
The only key binding supplied out of the box is Shift+Ctrl+B (or Shift+Cmd+B) for the full "Build" command. Although this is only enabled inside PureScript-language text editors, it does conflict with the built-in Build command. This can be edited, and other keybinds added, in the VS Code Keyboard Shortcuts preferences.
The following default vscode bindings are helpful for processing build errors:
We will suggest you to add keyboard bindings for commands that you use frequently, which you can do through the menu item
Access to commands
To see all the commands provided by this package,
Build and error reporting
After you've added
Completions will be sourced from modules imported in the current file.
Hovering over an identifier will show a tooltip with its type. Over a qualifier of a qualified identifier it will show the associated module name.
This feature disregards a context where the word appears, which means you will get some false positives (eg doesn't see local definitions, just the globals that should be visible in a given module).
Go to symbol
'Go to symbol' locates definition of a symbol by its name.
Go to definition
Hyperclick goto-definition functionality is supported. This is available with
In case source positions are not up to date, they may not be updated on rebuild, try rebuilding or restarting psc-ide server.
The case split expands the case under the cursor. It allows you to auto-complete large case clauses.
The add clause reads the type declaration under the cursor and inserts an empty template.
Commands "Search Pursuit" and "Search Pursuit Modules" are available to search for identifiers or modules/packages on Pursuit.
No particular support. Suggest you open a PSCI in the integrated terminal.
Generally the Output pane ("IDE PureScript" option in the dropdown) may give useful information if something is going wrong. Useful concepts:
To ensure the latest information is available to the Language Server, rebuilding may be required. This can either be the "Build Command" in VS Code, or an external build followed by "Restart/Reconnect purs IDE server".
Module not found
This normally means either the code is not built, or there is a version mismatch. To rebuild, see above.
In some cases your build process and VS Code may be hitting different purs versions. The VS Code extension/language server will find purs in your PATH, but that includes the npm local path if the corresponding option is set, which may differ from an external build process. You may need to launch
Check the "Output" pane, at the very top after the Language Server starts it will list out the purs binary being used, you can check it's the one you expect.
To develop (rather than use) this extension, see the instructions in