Skip to content

SPARQL Studio API / SparqlUtils / LanguageServerDef

Interface: LanguageServerDef<Y>

Defined in: sparql-utils/src/languageServers/types.ts:59

A SPARQL language server the consumer makes available to an editor. Defined ONCE and usable in BOTH editors. Generic over the editor instance type Y so the hooks get a precisely typed yasqe argument without this module depending on either editor package.

Type Parameters

Y

Y = any

Properties

label

label: string

Defined in: sparql-utils/src/languageServers/types.ts:61

Short name shown in the switcher (e.g. "Qlue-ls").


description?

optional description?: string

Defined in: sparql-utils/src/languageServers/types.ts:63

Optional longer description, shown dimmed next to the label.


worker

worker: Worker | (() => Worker | Promise<Worker>)

Defined in: sparql-utils/src/languageServers/types.ts:69

The language server as an LSP Worker, or a factory returning one (optionally async, e.g. after WASM init). This is the universal transport: Monaco connects a MonacoLanguageClient to it, CodeMirror builds an LSPClient from it internally.


languageId?

optional languageId?: string

Defined in: sparql-utils/src/languageServers/types.ts:71

LSP language id sent to the server. Defaults to "sparql".


documentUri?

optional documentUri?: string | ((yasqe) => string)

Defined in: sparql-utils/src/languageServers/types.ts:76

Document URI for this editor. Provide a function to derive a unique URI per editor (e.g. one per SparqlStudio tab). Defaults to an auto-generated unique URI.


onReady?

optional onReady?: (connection, yasqe) => void

Defined in: sparql-utils/src/languageServers/types.ts:82

Called when this server becomes active (on load or when switched to), with an editor-agnostic LspConnection. Use it for server-specific setup, e.g. pushing settings and registering the SPARQL backend for the current endpoint.

Parameters

connection

LspConnection

yasqe

Y

Returns

void


onEndpointChange?

optional onEndpointChange?: (connection, endpoint, yasqe) => void

Defined in: sparql-utils/src/languageServers/types.ts:88

Called when the active endpoint changes, but only for the currently active server, with its LspConnection and the new endpoint. Use it for server-specific endpoint handling, e.g. re-registering the SPARQL backend.

Parameters

connection

LspConnection

endpoint

string

yasqe

Y

Returns

void


configSchema?

optional configSchema?: LanguageServerSettingsSchema

Defined in: sparql-utils/src/languageServers/types.ts:94

Describes the server's tunable settings (a small JSON-schema subset). When present (together with configCallback), a "Configure …" entry appears in the editor's language-server menu and opens a modal rendered from this schema.


configCallback?

optional configCallback?: (connection, config) => void

Defined in: sparql-utils/src/languageServers/types.ts:101

Applies the settings collected from the configSchema panel to the running server. The config is a nested object: dotted schema keys (e.g. format.tabSize) become nested fields ({ format: { tabSize: 2 } }). For qlue-ls this is typically (conn, settings) => qlueLs.configureSettings(conn, settings).

Parameters

connection

LspConnection

config

any

Returns

void