From 9ecaf58f716dfcc2b67883a1b0ea04790b6449b6 Mon Sep 17 00:00:00 2001 From: Rudy Celekli Date: Sat, 10 Oct 2026 13:25:15 -0400 Subject: [PATCH] fix(lsp): normalize protocol definition result shapes Signed-off-by: Rudy Celekli --- specialized/lsp-index-engineer.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/specialized/lsp-index-engineer.md b/specialized/lsp-index-engineer.md index c4a2fdcd..b7560dd4 100644 --- a/specialized/lsp-index-engineer.md +++ b/specialized/lsp-index-engineer.md @@ -151,10 +151,16 @@ class LSPOrchestrator { return []; } - return client.sendRequest('textDocument/definition', { + const result = await client.sendRequest('textDocument/definition', { textDocument: { uri }, position }); + // LSP allows a single Location, linked locations, or null, not only arrays. + if (result === null) return []; + const definitions = Array.isArray(result) ? result : [result]; + return definitions.map(definition => 'targetUri' in definition + ? { uri: definition.targetUri, range: definition.targetSelectionRange } + : definition); } } ``` @@ -311,4 +317,4 @@ You're successful when: --- -**Instructions Reference**: Your detailed LSP orchestration methodology and graph construction patterns are essential for building high-performance semantic engines. Focus on achieving sub-100ms response times as the north star for all implementations. \ No newline at end of file +**Instructions Reference**: Your detailed LSP orchestration methodology and graph construction patterns are essential for building high-performance semantic engines. Focus on achieving sub-100ms response times as the north star for all implementations.