New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@codai/axiom-axm-lsp

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codai/axiom-axm-lsp

Language server for AXIOM `.axm` plans: diagnostics, completion, hover, document symbols, formatting and semantic tokens over LSP, reusing the @codai/axiom-axm Chevrotain parser (one grammar, zero drift)

latest
Source
npmnpm
Version
2.4.0
Version published
Maintainers
1
Created
Source

@codai/axiom-axm-lsp

Language server for AXIOM .axm plans (docs/reference/axm-syntax.md). Diagnostics, completion, hover, document symbols, formatting and semantic tokens over LSP 3.18 — built on the same Chevrotain parser that compiles .axm to a Plan (@codai/axiom-axm), so the editor and the gate can never disagree about what is valid.

npx axiom-axm-lsp --stdio        # generic editors (neovim, helix, zed, …)
node dist/main.js --node-ipc     # what the VS Code client (packages/vscode-axm) uses
import { computeCompletions, computeDiagnostics, formatDocument } from "@codai/axiom-axm-lsp";

Decision D-14: hand-written server over vscode-languageserver, not Langium (option B)

Two ways to get an LSP for a language already implemented in Chevrotain:

(A) Langium 4.4 .langium grammar + langium-cli(B) vscode-languageserver + reuse parseAxm
Completion / hover / scopinggenerated from the grammarhand-written (≈300 lines, features.ts)
Grammars in the repotwo — .langium and packages/axm/src/{lexer,parser}.tsone
Driftthe generated parser and the compile parser can accept different inputs; nothing detects itimpossible by construction: diagnostics come from the compile parser
Custom terminals (HereDoc with a named terminator, context-sensitive Json)need a custom TokenBuilder + Lexer service anyway — the generator does not express themalready implemented in packages/axm
Runtime weight in the editor processLangium runtime + its own Chevrotain parserparseAxm + vscode-languageserver

Langium 4.4 was checked (Context7 /eclipse-langium/langium, "Integrate Custom Parser", "Customize Langium Services"): its services module lets you replace Lexer, TokenBuilder, ValueConverter and even LangiumParser, but every service is derived from the Grammar AST loaded from a .langium file — the grammar is the input to the DI container, not an optional plugin. There is no supported path to hand Langium an existing CstParser and its token vocabulary without also writing the grammar, so option A always means a second grammar. The .axm grammar has 15 keywords, six statement kinds and no cross-references, so completion/hover/symbols are a few hundred lines by hand — cheaper than maintaining two grammars and a parity test between them. B it is.

Diagnostics and formatting call parseAxm / formatAxm directly. Everything that must also work on a broken document (completion context, hover word, symbols, semantic tokens) runs on a tolerant position-only scanner (scan.ts) that knows just enough (strings, comments, heredocs, JSON blocks) to never mis-nest braces; it never claims validity.

Features

LSP requestBehaviour
textDocument/publishDiagnosticsparseAxm diagnostics; 1-based {line,column} → 0-based LSP ranges, code = closed ERR_* enum, source: "axm"
textDocument/completionafter using → 15 built-in predicate ids (with docs; qualified prefix replaced as one edit) · inside capabilities [ → unused capability names · after mode → 0644/0755 · after op → create/overwrite/delete · after profile → default/strict/permissive · statement start → keywords valid at that nesting depth, as snippets
textDocument/hoverkeyword docs; predicate docs on using group.name
textDocument/documentSymbolplan (Module) → artifacts (File) + checks (Function, detail check using <predicate>)
textDocument/formattingone whole-document edit with formatAxm output — only when the document has zero diagnostics, otherwise [] (formatting a broken file would drop what the parser skipped)
textDocument/semanticTokens/fulllegend keyword, string, number, comment, property; multi-line tokens (heredoc, JSON, block comment) are split per line

The predicate list lives in vocabulary.ts and is asserted equal to builtinRegistry().list() from @codai/axiom-checks in the test suite (devDependency only — the server does not load the checks engine at runtime).

Build

tsdown emits dist/index.js (library, workspace deps external) and dist/main.js (bin; workspace packages + chevrotain + zod bundled, vscode-languageserver* left as runtime dependencies). Never writes to stdout except the JSON-RPC stream.

Keywords

axiom

FAQs

Package last updated on 27 Sep 2026

Related posts