Skip to content

vox-lsp API Reference (generated)

Crate: vox-lsp · Version: 0.6.0 · Target: Library (lib.rs)

Vox Language Server Protocol implementation (stdio JSON-RPC).

Language Server Protocol integration for Vox.

Shared validation helpers used by the LSP binary and MCP / orchestrator quality gates.

FeatureDefault / Enables
db—
default—
vox-gamifydep:vox-gamify
DependencyKind
vox-compilerNormal
vox-foundationNormal
vox-gamifyNormal
vox-secretsNormal
ModuleDescription
capabilities—
code_lens—
completions—
grammar—
server—
symbols—
FunctionDescription
byte_index_to_line_colConvert UTF-8 byte index to LSP line / column (character count per line, not UTF-16 code units).
validate_documentRun lexer → parser → typecheck and return LSP diagnostics (no side effects). Note: This does not run HIR structural validation. For parity with the CLI frontend (run_frontend_str), use [validate_document_with_hir].
validate_document_with_hirFull frontend validation: lexer → parser → typecheck → HIR lower → HIR validate. Matches the diagnostic shape produced by vox-cli run_frontend_str for type/HIR issues (parse errors are always surfaced as errors).
quickfixes_for_diagnosticsBuild quick-fix [CodeAction]s from diagnostics that carry structured data.fixes (parity with the stdio LSP textDocument/codeAction handler).
word_at_positionWord at LSP (line, character) using 0-based lines and character = column in Unicode scalars (same convention as [byte_index_to_line_col]).
line_has_speech_transcribeTrue if line contains a Speech.transcribe / Speech . transcribe call (word boundaries).
builtin_hover_markdown_in_lineMarkdown hover using the current line so transcribe only hovers in Speech.transcribe context.
builtin_hover_markdownShort markdown hovers for selected builtins (Oratio, HTTP, stdlib).
Dependency Topology, diagram 19 nodes, 8 edges: vox-lsp → vox-compiler; vox-lsp → vox-foundation; vox-lsp → vox-gamify; vox-lsp → vox-secrets; vox-integration-tests → vox-lsp; vox-langtool → vox-lsp; vox-orchestrator → vox-lsp; vox-orchestrator-mcp → vox-lspvox-lspvox-compilervox-foundationvox-gamifyvox-secretsvox-integration-testsvox-langtoolvox-orchestratorvox-orchestrator-mcp
Diagram source
graph {
direction: right
node vox_lsp: "vox-lsp"
node vox_compiler: "vox-compiler"
vox_lsp -> vox_compiler
node vox_foundation: "vox-foundation"
vox_lsp -> vox_foundation
node vox_gamify: "vox-gamify"
vox_lsp -> vox_gamify
node vox_secrets: "vox-secrets"
vox_lsp -> vox_secrets
node vox_integration_tests: "vox-integration-tests"
vox_integration_tests -> vox_lsp
node vox_langtool: "vox-langtool"
vox_langtool -> vox_lsp
node vox_orchestrator: "vox-orchestrator"
vox_orchestrator -> vox_lsp
node vox_orchestrator_mcp: "vox-orchestrator-mcp"
vox_orchestrator_mcp -> vox_lsp
}
Consumer CrateRole
vox-integration-testsDirect workspace dependent
vox-langtoolDirect workspace dependent
vox-orchestratorDirect workspace dependent
vox-orchestrator-mcpDirect workspace dependent
KindSymbolSignatureSourceDescription
fnbyte_index_to_line_colpub fn byte_index_to_line_col(text: &str, index: usize) -> (u32, u32)crates/vox-lsp/src/lib.rs#L25-L27Convert UTF-8 byte index to LSP line / column (character count per line, not UTF-16 code units).
fnvalidate_documentpub fn validate_document(text: &str) -> Vec<Diagnostic>crates/vox-lsp/src/lib.rs#L126-L128Run lexer → parser → typecheck and return LSP diagnostics (no side effects). Note: This does not run HIR structural validation. For parity with the CLI frontend (run_frontend_str), use [validate_document_with_hir].
fnvalidate_document_with_hirpub fn validate_document_with_hir(text: &str) -> Vec<Diagnostic>crates/vox-lsp/src/lib.rs#L135-L137Full frontend validation: lexer → parser → typecheck → HIR lower → HIR validate. Matches the diagnostic shape produced by vox-cli run_frontend_str for type/HIR issues (parse errors are always surfaced as errors).
fnquickfixes_for_diagnosticspub fn quickfixes_for_diagnostics(crates/vox-lsp/src/lib.rs#L142Build quick-fix [CodeAction]s from diagnostics that carry structured data.fixes (parity with the stdio LSP textDocument/codeAction handler).
fnword_at_positionpub fn word_at_position(text: &str, line: u32, character: u32) -> Option<String>crates/vox-lsp/src/lib.rs#L335-L354Word at LSP (line, character) using 0-based lines and character = column in Unicode scalars (same convention as [byte_index_to_line_col]).
fnline_has_speech_transcribepub fn line_has_speech_transcribe(line: &str) -> boolcrates/vox-lsp/src/lib.rs#L358-L386True if line contains a Speech.transcribe / Speech . transcribe call (word boundaries).
fnbuiltin_hover_markdown_in_linepub fn builtin_hover_markdown_in_line(line: &str, word: &str) -> Option<String>crates/vox-lsp/src/lib.rs#L390-L401Markdown hover using the current line so transcribe only hovers in Speech.transcribe context.
fnbuiltin_hover_markdownpub fn builtin_hover_markdown(word: &str) -> Option<String>crates/vox-lsp/src/lib.rs#L405-L433Short markdown hovers for selected builtins (Oratio, HTTP, stdlib).
fncapabilities::server_capabilitiespub fn server_capabilities() -> ServerCapabilitiescrates/vox-lsp/src/capabilities.rs#L7-L52Capabilities returned from initialize — keep in sync with [crate] request handlers.
fncode_lens::code_lenses_for_modulepub fn code_lenses_for_module(module: &Module, text: &str) -> Vec<CodeLens>crates/vox-lsp/src/code_lens.rs#L14-L77Build all code lenses for a parsed Vox module. Each @test declaration gets a ▶ Run test lens. Each @forall declaration gets a ▶ Run property lens. The command name is vox.runTest so VS Code extension can intercept it.
structcompletions::CompletionEnginepub struct CompletionEnginecrates/vox-lsp/src/completions.rs#L10—
fncompletions::completionspub fn completions(params: CompletionParams) -> CompletionListcrates/vox-lsp/src/completions.rs#L14-L16Returns a list of all completions at a given position.
fncompletions::completions_for_documentpub fn completions_for_document(crates/vox-lsp/src/completions.rs#L19Context-aware completions inspecting document text, cursor position, trigger character, and AST symbols.
fngrammar::token_to_semantic_typepub fn token_to_semantic_type(token: &Token) -> Option<u32>crates/vox-lsp/src/grammar.rs#L13-L76Maps a Vox lexer [Token] to an LSP semantic token type index, or None for tokens that do not need syntax highlighting (punctuation, whitespace, etc.). The returned index corresponds to the position in [SEMANTIC_TOKEN_TYPES].
fngrammar::encode_semantic_tokenspub fn encode_semantic_tokens(text: &str) -> Vec<SemanticToken>crates/vox-lsp/src/grammar.rs#L95-L127Encode semantic tokens for a full document (same encoding as the LSP semanticTokens/full handler).
fnserver::runpub async fn run()crates/vox-lsp/src/server.rs#L291-L303Start the LSP server loop over stdin/stdout.
fnsymbols::extract_symbolspub fn extract_symbols(module: &Module, text: &str) -> Vec<DocumentSymbol>crates/vox-lsp/src/symbols.rs#L10-L12Walk a parsed module and emit a list of LSP document symbols.
structsymbols::SymbolEnginepub struct SymbolEnginecrates/vox-lsp/src/symbols.rs#L14—
fnsymbols::symbolspub fn symbols(module: &Module, text: &str) -> Vec<DocumentSymbol>crates/vox-lsp/src/symbols.rs#L18-L28Walk a parsed module and emit a list of symbols.
fnsymbols::extract_symbols_from_sourcepub fn extract_symbols_from_source(crates/vox-lsp/src/symbols.rs#L175Extract symbols from source, attempting full parse, script parse, or blanking out incomplete lines, and falling back to line scanning if parsing fails.