PureScript Analyzer Public Alpha

Hello, I’m happy to announce the first public alpha for the PureScript Analyzer! The analyzer can now be installed as a language server executable, with initial support for Visual Studio Code and Neovim.

Features (so far)

  1. Auto-completion

completion

  1. Hover information

hover

  1. Jump to definition

jump

Installation

You can find pre-built binaries in the v0.0.5 release, alternatively, you may also build from source if you have Rust tooling installed:

cargo install --git https://github.com/purefunctor/purescript-analyzer --bin purescript-analyzer

Visual Studio Code

I’ve published an initial extension for Visual Studio Code, it should also work for Visual Studio Code forks (e.g. Cursor etc) but I’m not familiar with how they pull in extensions from Microsoft’s marketplace.

Neovim

You’ll need to add the following configuration to your init file (or similar)

vim.lsp.config("purescript_analyzer", {
  cmd = { "purescript-analyzer" },
  filetypes = { "purescript" },
  root_markers = { "output", "spago.lock" },
})

vim.lsp.enable("purescript_analyzer")

Additional information

For now, the analyzer relies on spago.lock files produced by spago@next to determine package locations and where to find modules from. If there’s enough interest, I can develop the following:

  1. The ability to provide custom source locations
  2. Compatibility with legacy spago (spago.dhall)

Support / Bugs

The analyzer is in its early alpha stages, so bugs will occur! Please report them through the repository.

7 Likes

Thanks for making this!

Now we’re talking!
Great achievement!
Does it have autocomplete on records yet :smirk:?

Btw, the extension doesn’t install on Cursor and throws this error:

Error: Unable to install extension ‘purefunctor.purescript-analyzer’ as it is not compatible with VS Code ‘1.99.3’.

2 Likes

Not until it can do type inference, which is probably a little while from now…

I think should be able to bump the version down to support at least 1.98