Merge #1102: fix(lsp): normalize protocol definition results to locations

This commit is contained in:
Michael Sitarzewski
2026-10-13 05:51:52 -05:00
+8 -2
View File
@@ -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.
**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.