Skip to main content

scrii_ls — language server

scrii_ls is a Language Server Protocol implementation for Scrii. It brings real IDE features — not just regex syntax coloring — to any editor that speaks LSP over stdio.

Feature matrix

CapabilityNotes
textDocument/completionScope-aware symbol + std-module completion (trigger chars . and :)
textDocument/definitionJump to declaration (works across import)
textDocument/hoverDeclared type, const/fn classification, -> descriptions
textDocument/documentSymbolDocument outline
textDocument/diagnosticParse errors, undefined variables, member-access checks; //DECLARE name comments suppress undefined-variable errors
textDocument/semanticTokens/fullLegend: namespace, function, variable, parameter, property, constant

Semantic tokens come from real analysis, not text matching: call positions are function, parameters are parameter, const declarations and SCREAMING_CASE identifiers are constant — consistent with the tree-sitter highlighting (see tree-sitter-scrii).

Declaration suppression

Undefined-variable diagnostics are suppressed on a per-name basis with a //DECLARE name comment:

//DECLARE external_fn // defined by a native plugin, not this file
external_fn("hi")

This is useful for globals injected by a host embedder or plugin that the analyzer can't see.

Build

From the repository root:

cmake -S . -B build && cmake --build build --target scrii_ls

Or standalone (FetchContent pulls the LSP protocol framework):

cmake -S scrii_lsp -B scrii_lsp/build
cmake --build scrii_lsp/build
cmake --build language_server/build

Editor setup

The server speaks generic stdio LSP. Neovim (nvim-lspconfig style):

require'lspconfig'.scrii_ls = {
cmd = { '/path/to/scrii_ls' },
filetypes = { 'scrii' },
}

Other editors that support LSP over stdio configure the same command + filetype pair. Point cmd at the scrii_ls binary produced by the build.

Internals

  • analyzer.cpp/.hpp — symbol table, type inference, diagnostics
  • semantic.cpp — semantic-token extraction
  • document.cpp/.hpp — open-document tracking
  • features/ — one translation unit per LSP feature
  • server.cpp/.hpp — JSON-RPC dispatch and capabilities

Tests live in test/ (Catch2); they are skipped automatically when Catch2 is unavailable.