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§
- Bock
Language Server - The Bock language server.
- Check
Result - Result of running the check pipeline on a single document.
- Definition
Result - Result of a successful go-to-definition lookup.
- Document
Symbols Result - Result of building the outline for one document.
- Hover
Result - Result of a successful hover lookup.
- Inlay
Hints Result - Result of computing inlay hints for a document.
- Symbol
Node - One node in the buffer’s symbol outline, in source-span form.
- Symbol
Occurrences - All in-buffer occurrences of one symbol.
- Type
Hint - One inferred-type hint, ready for conversion to an LSP
InlayHint.
Enums§
- Rename
Error - 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
contentand 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
Noneif the cursor is not over a resolved identifier. - find_
occurrences - Find every occurrence of the symbol at the cursor, or
Noneif the cursor is not on a symbol whose references can be tracked. - format_
type - Render a
Typeas 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
Noneif nothing useful can be said. - inlay_
hints - Compute inferred-type inlay hints for the unannotated
letbindings (andforbinders) whose names end insiderange. - position_
to_ offset - Convert a 0-indexed LSP
(line, character)position to a byte offset intocontent. 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
Severityto an LSPDiagnosticSeverity. - span_
to_ range - Convert a Bock
Spanto an LSPRangeusing the given source file for line/column lookup. - to_
lsp_ diagnostic - Convert a single Bock
bock_errors::Diagnosticto its LSP representation. - to_
lsp_ symbols - Convert an outline tree into LSP
DocumentSymbols usingsourcefor position lookup. - validate_
new_ name - Validate
new_nameas a replacement forold_name.