Skip to main content

Crate jlens_lsp

Crate jlens_lsp 

Source
Expand description

§jlens-lsp

A language server (LSP) for JSONata expressions, built on the jlens_schema::LanguageService: completion of fields, variables and functions, diagnostics (syntax errors, annotation problems, fields the schema does not have), hover and signature help.

Which schema, variables and host functions apply to which files is configured in a jlens.json at the root of each workspace folder, mapping path patterns to settings:

{
  "rules/**/*.jsonata": {
    "schema": "schemas/order.schema.json",
    "variables": {"minimum": {"type": "number"}},
    "functions": [{"name": "shipping", "signature": "<ns:n>", "summary": "Shipping cost"}]
  }
}

The config module reads these files; jlens check uses it too. The jlens lsp command of jlens-cli runs run_stdio. Embedders can run run on another lsp_server::Connection, such as an in-memory one.

Modules§

config
The jlens.json configuration: which schema, variables and host functions apply to which expression files. jlens check reads it too, so that the command line and the editors check files alike.

Functions§

run
Runs the server on connection until the client asks it to exit: answers initialize, then handles requests and notifications.
run_stdio
Runs the server over standard input and output, until the client asks it to exit.

Type Aliases§

Error
The error type of the server.