Skip to content

A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy injectors to reality checkers. Each agent is a specialized expert with personality, processes, and proven deliverables.

Shell

fix(lsp): normalize protocol definition result shapes

Rudy Celekli9ecaf58f716d
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<Location | Location[] | LocationLink[] | null>('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.