No description, website, or topics provided.
Clone or download
Latest commit bcb9e09 Aug 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src 0.12.0 build Aug 13, 2018
test Clean up warnings Mar 4, 2018
.gitignore Support addQualifiedImport Feb 12, 2018
.npmignore Add .npmignore Nov 22, 2017
.travis.yml Bump versions, build Mar 4, 2018
CHANGELOG.md Update CHANGELOG May 1, 2018
LICENSE.md Move code from vscode repo Sep 20, 2017
README.md Replace typed hole command Mar 11, 2018
cli.js Move code from vscode repo Sep 20, 2017
package-lock.json 0.12.0 Aug 13, 2018
package.json 0.12.0 Aug 13, 2018
psc-package.json 0.12.0 build Aug 13, 2018

README.md

PureScript language server

Node-based Language Server Protocol server for PureScript based on the PureScript IDE server (aka psc-ide / purs ide server). Used as the vscode plugin backend but should be compatible with other Language Server Client implementations.

The language server is a wrapper around the IDE server included as part of the compiler distribution, providing editing assistance and build features according to support available. This means that the server will start its own purs ide server instance to talk to for the project directory it is started in.

Features

  • Completion provider
  • Definition provider
  • Document & workspace symbol providers
  • Hover provider
  • Code action provider
    • Compiler fix suggestions for imports/missing types
  • Build on save (via IDE server "fast rebuild" facility, certain limitations apply)
    • Provides diagnostics
  • Commands
    • Build (full build via purs compile / configured build command) - provides diagnostics
    • Case split
    • Add clause
    • Replace suggestion
    • Add completion import
    • Start IDE server
    • Stop IDE server
    • Restart IDE server
  • Config
    • purescript.*

Commands

purescript.build

No arguments. Provides diagnostics.

purescript.startPscIde

No arguments. Start IDE server according to configuration.

purescript.stopPscIde

No arguments. Stop running IDE server.

purescript.restartPscIde

No arguments. Stop any running IDE server then start a new one according to configuration.

purescript.addCompletionImport

Arguments: identifier, module, document URI.

purescript.addModuleImport

Arguments: module, qualifier, document URI.

purescript.getAvailableModules

No arguments. Get list of available modules.

purescript.replaceSuggestion

Arguments: document URI, replacement, replacement range.

purescript.search

Flex search for identifier.

Arguments: search text.

purescript.fixTypo

Arguments: document URI, line, character.

purescript.caseSplit-explicit

(Used to back the case split command in VS Code UI).

Arguments: document URI, line, character, type.

purescript.addClause-explicit

(Used to back the add clause command in VS Code UI).

Arguments: document URI, line, character.

purescript.typedHole-explicit

(Used to back the purescript.typedHole code action triggered in the VS Code UI)

Arguments: hole name, document URI, hole range, PscIde.Command.TypeInfo of chosen replacement option

Usage

Use as a node module (as in vscode plugin) or via command line purescript-language-server. Protocol via command line option:

  • --stdio
  • --node-ipc
  • --socket={number}

Config

See config defined in vscode plugin.

Development

To develop (rather than use) this language server

  1. Clone this repo and npm install
  2. Make changes and npm run build
  3. Ensure the built module is picked up by your editor

For 3, if the editor integrates using the node module rather than standalone binary, I suggest using npm link - this will work for atom and vscode at least.

For atom, clone atom-ide-purescript and:

  1. In purescript-language-server run npm link, in atom-ide-purescript run npm link purescript-language-server
  2. In atom-ide-purescript run apm link to pick up local changes
  3. In atom-ide-purescript, run npm run bundle to build the plugin itself
  4. Reload any atom window to pick up changes

For vscode, clone vscode-ide-purescript and:

  1. In purescript-language-server run npm link, in vscode-ide-purescript run npm link purescript-language-server
  2. Open vscode-ide-purescript in vscode and hit F5 to "launch extension"
  3. Use the newly launched Extension Development Host to test language server changes

See vscode plugin repo, atom plugin. Common code via purescript-ide-purescript-core.