Render.md
LSP render
type: module path: "@root/src/PuduLangMcp/Domain/Lsp/Render.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.55 depth_status: MODERATE coupling: 2 interface_stability: 0.8 tags: [module] aliases: [Lsp Render]
Purpose
Turn language-server results into short text a model reads well: 1-based positions, workspace- relative paths, and one line per item.
Interface
Signatures
export fn hover(result: &Json.Json) -> Str
export fn locations(result: &Json.Json, shown: fn(Str) -> Str) -> Array[Location]
export fn locationLine(held: &Location) -> Str // "path:line:character"
export fn completion(result: &Json.Json, limit: Int) -> Str
export fn signatureHelp(result: &Json.Json) -> Str
export fn codeActions(result: &Json.Json) -> Str
export fn workspaceEdit(result: &Json.Json, shown: fn(Str) -> Str) -> Str
export fn documentSymbols(result: &Json.Json) -> Str
export fn workspaceSymbols(result: &Json.Json, shown: fn(Str) -> Str) -> Str
export fn diagnostics(items: &Array[Json.Json]) -> Str
export type Location = { uri: Str, path: Str, line: Int, character: Int, endLine: Int } // 1-basedLinkage
- Requires:
Std.Json, [[src/PuduLangMcp/Utils/JsonAccess]]. - Consumed by: [[src/PuduLangMcp/App/Tools/Language]].
Algorithm
hover:contentsas markup (value), a plain string, or a list of either, joined by blank lines.nullanswers "No information at this position."locations: aLocation, a list of them, orLocationLinks (targetUri,targetRange).completion: a list or aCompletionList.items; eachlabel — detail, at mostlimit, then a count of the rest.signatureHelp: the active signature's label, its documentation, and the active parameter's label when the parameter label is a string or a[start, end]offset pair into the signature.codeActions: one line per action title, with its kind when present.workspaceEdit:changes(by URI) ordocumentChanges(textDocument.uri,edits), one line per edit:path:line:character-endLine:endCharacter → newText.documentSymbols: hierarchicalDocumentSymbols (children indented) orSymbolInformations;kind name — detail (line N), kind named from the LSP symbol-kind table.diagnostics:line:character severity [code] message, severity named 1 error … 4 hint.
Negative Logic (Prohibited Paths)
- No raw JSON is shown to the model when a known shape can be rendered; an unknown shape falls back to its encoded JSON rather than being dropped.
Edge Cases
- An empty list renders as a sentence saying nothing was found.
Depth
DEPTH 0.55.
Grill Log
- Q: Show absolute paths? A: No;
shownmaps a URI to a workspace-relative path, the standard library'sStd/...path, or<source>for inline code, so paths are short and do not leak the machine's layout.
Referenced by
[[src/PuduLangMcp/Domain/Lsp/_MOC]]
