Skip to content

Editors: the .olv language server

oliviadb-lsp (crate open/crates/oliviadb-lsp) is a language server of the schema language (spec/schema.md 7) over the Language Server Protocol 3.17, on stdin and stdout. Editor plugins start it as a separate process: the VS Code extension (repository oliviadb-vscode) and the IntelliJ plugin (oliviadb-intellij), both Apache-2.0, find it on PATH or at a configured path.

request what it gives
publishDiagnostics (on open and change) the syntax error, or every failed check, at the line and column oliviadb_schema::load reports (the token there is the range)
completion the statements the enclosing block takes (top level; aggregate/child; profile), the types after a field's :, the declared aggregates, node types and indexes; keywords carry their IMS equivalent
hover a keyword: what it declares and its IMS equivalent (the table of spec/schema.md 2); a declared name: its kind, path and declaration line
definition aggregates, node types, fields, indexes and profiles, at their declaration
formatting the layout of oliviadb schema fmt; a text with // comments is refused (RequestFailed), since the formatter writes the schema, not its comments

Positions are converted between the protocol's UTF-16 code units and the schema's characters with each line's text. Names stay known from the last text that parsed while a text is being edited.

Tests: open/crates/oliviadb-lsp/tests/protocol.rs (the binary spoken to as an editor does). Open: comments kept by the formatter; references and rename; completion of grant paths segment by segment.