Skip to content

federicocarboni/scarpet-ls

Repository files navigation

Scarpet Language Server

An implementation of the Language Server Protocol for the Scarpet language.

Most popular editors support LSP but make sure to check the Language Server editor support table.

This project is work in progress and is not very stable at this time.

Most of the heavy lifting is done in FedericoCarboni/scarpet-parser. Documentation is provided by FedericoCarboni/scarpet-docs

Features

  • Documentation and signatures on hover for builtin functions and user-defined functions.
  • Autocomplete for builtin functions, constants and event callbacks.
  • Autocomplete for user-defined functions and variables (current file only).
  • Go-to definition for user-defined functions and variables (current file only).
  • Diagnostics for invalid Scarpet code (with limitations).
  • Rename for variables (current file only, var() not supported).
  • Rename for functions (current file only, var() not supported).

TODOs

  • Formatter
  • Inlay hints
  • Linting
  • Semantic highlighting
  • Signature help

Known Issues

Error reporting is still not very accurate and autocomplete depends on it in some places, making autocomplete not work sometimes.

Not all built-in functions can be autocompleted or show documentation. Shown signatures are sometimes incorrect (please contribute to FedericoCarboni/scarpet-docs to fix those as you find them).

Global variables are handled somewhat inconsistently and will not autocomplete some of the time.

Most of the language server protocol is not implemented, e.g. formatter, signature help...

Installation

If you use VSCode use FedericoCarboni/vscode-scarpet.

If you want to try it out and you're not afraid of bugs:

npm install -g FedericoCarboni/scarpet-ls

Running

scarpet-ls --stdio

Different editors configure LSPs differently, here is an example user config for Kate:

{
    "servers": {
        "scarpet": {
            "command": ["scarpet-ls", "--stdio"],
            "url": "https://github.com/FedericoCarboni/scarpet-ls",
            "highlightingModeRegex": "^Scarpet$"
        }
    }
}

If you use Kate you might also need the syntax highlighting definitions.

Releases

No releases published

Packages

No packages published