Skip to main content

Crate bock_lsp

Crate bock_lsp 

Source
Expand description

Bock Language Server Protocol implementation.

Provides an LSP server over stdio that editors can connect to for diagnostics, hover, go-to-definition, find-references, rename, document symbols, inlay hints, and other Bock tooling features.

This crate exposes BockLanguageServer and a run_stdio entry point used by bock-cli to launch the server.

Structs§

BockLanguageServer
The Bock language server.
CheckResult
Result of running the check pipeline on a single document.
DefinitionResult
Result of a successful go-to-definition lookup.
DocumentSymbolsResult
Result of building the outline for one document.
HoverResult
Result of a successful hover lookup.
InlayHintsResult
Result of computing inlay hints for a document.
SymbolNode
One node in the buffer’s symbol outline, in source-span form.
SymbolOccurrences
All in-buffer occurrences of one symbol.
TypeHint
One inferred-type hint, ready for conversion to an LSP InlayHint.

Enums§

RenameError
Why a proposed rename target is not a usable Bock name.

Constants§

TYPE_RENDER_BUDGET
Maximum number of characters of a rendered type shown in a hint label. Longer renders are cut at the budget and terminated with .

Functions§

check_document
Run lex → parse → resolve → lower → type-check → analyze on a document.
document_symbols
Lex + parse content and build its symbol outline.
find_definition
Run the minimum pipeline needed to answer a definition query and return the declaration span at the cursor, or None if the cursor is not over a resolved identifier.
find_occurrences
Find every occurrence of the symbol at the cursor, or None if the cursor is not on a symbol whose references can be tracked.
format_type
Render a Type as a single-line Bock-syntax string suitable for hover.
hover
Run the minimum pipeline needed to answer a hover query and return the type of the innermost node at the cursor, or None if nothing useful can be said.
inlay_hints
Compute inferred-type inlay hints for the unannotated let bindings (and for binders) whose names end inside range.
position_to_offset
Convert a 0-indexed LSP (line, character) position to a byte offset into content. Column counts Unicode scalar values (matches the LSP UTF-16 default closely enough for Bock’s ASCII-dominant source, and exactly for pure-ASCII files).
run_stdio
Launch the Bock LSP server over stdio.
severity_to_lsp
Convert a Bock Severity to an LSP DiagnosticSeverity.
span_to_range
Convert a Bock Span to an LSP Range using the given source file for line/column lookup.
to_lsp_diagnostic
Convert a single Bock bock_errors::Diagnostic to its LSP representation.
to_lsp_symbols
Convert an outline tree into LSP DocumentSymbols using source for position lookup.
validate_new_name
Validate new_name as a replacement for old_name.