Documentation channel: current development main at compiler checkpoint 1d7e15e. The latest tagged release is v0.0.3; pages identify APIs that are not yet released.

Editor & language server

Strut ships its language server with the compiler. Editors communicate with strut lsp over standard JSON-RPC/LSP on stdin and stdout, so editor support does not depend on a separate language-analysis implementation.

Start the language server

strut lsp

Diagnostics

The language server reuses Strut's lexer, parser, semantic analyser, and source spans. Syntax and type errors therefore match command-line diagnostics rather than being reimplemented by an editor plugin.

Navigation and assistance

The server provides diagnostics, project-aware go-to-definition, contextual completion, hover/type information, signature help, document symbols, and document formatting. Formatting uses the same canonical formatter as strut fmt.

Completion and imports

Expression completion includes visible declarations and free functions. Member completion after value. is filtered by the value's Strut type. Type positions offer types rather than unrelated values, while include <...> offers standard modules and manifest dependencies. A completion for a standard-module API can carry a standard LSP additional text edit that inserts its missing include; core arrays and JSON do not receive module edits.

Signatures and checked errors

Signature help tracks the active argument through nested calls and displays parameter names, canonical Strut types, return types, optional parameters, and checked errors. Hover and completion details use the same canonical API registry. User functions and declarations come from the compiler AST rather than a second editor grammar.

Incomplete files

Open files are analysed normally with the compiler lexer, parser, and semantic analyser. If a file is temporarily incomplete, a small recovery index preserves available declarations and registry-powered completion without weakening normal compilation.

Project discovery

Each document discovers its project from its own file path, using the same .strut/config.json and strut.json root rules as strut project. Definition lookup indexes sibling Strut sources, so launching the editor from another working directory does not change project navigation.

Editor integration

Configure an editor's generic LSP client to launch strut lsp for .p and .h files. A dedicated editor extension can add convenience later without changing the protocol.

Terminal diagnostics

Command-line diagnostics render the relevant source line with syntax highlighting and a highlighted caret/range. Semantic errors for standard modules, including missing collection includes and unsupported hash keys, are reported by Strut before backend compilation.