PureScript Editor & Tooling
# Editor and Tool Support
The PureScript ecosystem contains a number of editor plugins and tools to help you build libraries and applications. The set of available tools is growing continuously, but this documentation contains popular, stable tools that you can use today.
At minimum, almost all projects will use:
- The PureScript compiler
- The Spago build tool and package manager
These tools can be installed via NPM, among other installation methods.
# Editor support
The PureScript compiler includes an IDE server, purs ide, to supply tooling for editors. This server has been used to implement a PureScript language server, which implements the Language Server Protocol for PureScript. Major editor tooling either uses purs ide server directly or via the language server.
Most editor plugins which rely on PureScript’s IDE tooling have at least these features:
- Autocomplete (including auto-imports)
- Definitions and error reporting on hover
- Go-to-definition and local search
- REPL support
- Automatic builds
- Error suggestions and quick-fix actions for missing type signatures, imports, and more
- Case split for type-driven development
# General
Some tools are commonly used with several editors, as they are implemented to be editor-agnostic:
- psa is a pretty, flexible error/warning reporting frontend for the compiler featuring colours, original source spans in errors, warning filtering and persistence.
- pscid is a lightweight file-watcher and test runner which provides instant-rebuilds in an editor agnostic way.
To generate TAGS files, use purs docs --format etags (or --format ctags).
# Atom
- atom-language-purescript provides syntax highlighting for
.pursfiles. - atom-ide-purescript provides editor support via
purs ide.
# Emacs
- psc-ide-emacs provides editor support via
purs ide. - purescript-mode provides syntax highlighting and indentation rules for
.pursfiles. - psci-mode provides a minor mode for a PureScript REPL.
Spacemacs users can use the PureScript layer.
# Sublime Text 3
- purescript-ide-sublime provides editor support via
purs ideand syntax highlighting for.pursfiles.
# Vim
- psc-ide-vim provides editor support via
purs ide. - ale provides editor support via the PureScript language server.
- coc.nvim provides editor support via the PureScript language server.
- purescript-vim provides syntax highlighting and indentation rules for
.pursfiles.
# VSCode
- ide-purescript provides editor support via the PureScript language server.
- language-purescript provides syntax highlighting for
.pursfiles.
# Tooling support
There are many tools available to help you develop libraries and applications in PureScript. These include build tools, package managers, code formatters, dead code elimination tools, GitHub Actions, Nix tools, and more.
# Build tools and package managers
There are several build tools and package managers available for PureScript.
- spago is the standard package manager and build tool for Purescript, powered by Dhall and package-sets. ^0A033209-379B-4470-A628-6EA16EFC24FA
These build tools are maintained, but are no longer recommended for most projects (use Spago instead):
- psc-package is a package manager for PureScript based on package-sets and a precursor to Spago.
- pulp is a standalone build system for PureScript which relies on Bower for package management and a precursor to Spago.
# Development tools
- setup-purescript is a GitHub Action which sets up a PureScript toolchain with common tools including the compiler and Spago for continuous integration.
- purty is a formatter / pretty-printer for PureScript source code.
- zephyr is a dead code elimination tool for PureScript applications which can be used to reduce bundle sizes.
# For Nix users
There are some tools meant specifically for Nix users, who may not be able to use installation methods like NPM.
- easy-purescript-nix provides many common tools in the PureScript community like the compiler (
purs),spago,pscid,zephyr, and more for Nix environments. - spago2nix helps you generate Nix expressions for your Spago dependencies.
- yarn2nix helps you generate Nix expressions for your JavaScript dependencies.
# Backend-specific tooling
PureScript projects which use alternate backends may use tools from the ecosystem of the target language. This documentation is a non-exhaustive starting point for some tools you may find useful when working with particular backends for PureScript.
# JavaScript
PureScript projects which target JavaScript may find some tools from the JavaScript ecosystem. PureScript code which imports libraries from JavaScript will at least require a JavaScript package manager (to install dependencies) and a JavaScript bundling tool (to resolve JavaScript imports, among other things). You may also want to use a linter for any JavaScript code you are writing via the FFI.
- Some popular package managers in JavaScript include npm (recommended), yarn, and pnpm.
- Some popular bundlers in JavaScript include webpack (recommended) with the purs-loader PureScript loader, and parcel. Other JavaScript bundlers like rollup rely on ES Modules, which PureScript does not yet support.
- Some popular linters include eslint and jsconfig.
# Deprecated and unmaintained tools
These tools were previously mentioned in this documentation, but are no longer maintained or recommended:
- gulp-purescript was a Gulp task for Purescript
npm). - psvm-js was a version manager (like
nvmfor Node) for PureScript compiler versions. - psc-pane provided auto-reloading builds which formatted a single error to fit the window.
https://github.com/purescript/documentation/blob/master/ecosystem/Editor-and-tool-support.md