PureScript Atom/VS Code editor plugins for 0.10
New releases of PureScript (0.10) and VS Code have enabled a few new features for their editor plugins (mostly for Code). Here I’ll cover a few.
Cool completion comes to Code
For a long time the Atom ide-purescript package has had the ability to add imports on auto-completion, and I really find it indispensible. The other half of the deal being the ability to apply the compiler suggestion to remove extraneous imports (alt+enter in Atom, cmd/ctrl+. on Code).
Now Code added the ability to trigger commands on completion, so here we have it:
Note that there are some kinks in this feature still, in some cases when a new import line is added the cursor position will be incorrect (possibly just on Windows).
Goto symbol
With some additions to psc-ide
, the VS Code extension is now able to include
providers for goto symbol / show symbols features, which let you navigate symbols
in the current file or workspace respectively.
Show symbols
lets you browse symbols in the current file (and note you can add :
to categorise).
Open symbol by name
lets you search for (and navigate to) symbols within the workspace. For PureScript projects
this means both your own modules and dependencies within bower_components
:
Pursuit search renewed
With the rewrite of Pursuit search, the JSON format backing the Pursuit search feature changed, breaking the in-editor search. With changes to Pursuit and also psc-ide (so 0.10 required) this should now be restored, with the addition of documentation summary:
npm bin
An option is added to include the npm bin directory in the PATH
used to resolve
executables. So if you like to npm install purescript
(or indeed pulp
) into your
project locally, you should be able to check this and not have to manually
fudge the path when launching the editor. Then psc-ide-server
and your build command
will have the npm bin under the project included in their PATH
.
Coming soon: PSCI in VS Code?
I didn’t think it was possible to integrate PSCI into Code, as the possible UI is restricted to that provided by the IDE. However with the addition of the terminal, which seems to be pretty good, you can already run PSCI inside the editor. Ionide shows us that integration with the terminal is possible too—we should be able to launch the terminal and send text to it (code to evaluate).