Motivation
Sourcekit-lsp needs to retrieve USRs and metadata for all declarations in a file to implement the references CodeLens feature.
Currently, the only way to get this information is by calling cursorInfo for each declaration individually. In a file with 100+ declarations, this requires 100+ round trips to sourcekitd. This is slow and creates excessive overhead.
Context: swiftlang/sourcekit-lsp#2552 (comment)
Proposed solution
Add a new batch request source.request.declaration.usrs to sourcekitd that returns USRs and declaration metadata for all declarations in a file in a single call. Similar to CollectVariableType source.request.variable.type
Input:
key.filepath
key.compilerargs
- (Optional)
key.offset and key.length - If specified, only return declarations in this range
Output:
Array of declaration info objects with:
key.offset
key.length
key.usr
key.kind
Alternatives considered
No response
Additional information
No response
Motivation
Sourcekit-lsp needs to retrieve USRs and metadata for all declarations in a file to implement the references CodeLens feature.
Currently, the only way to get this information is by calling
cursorInfofor each declaration individually. In a file with 100+ declarations, this requires 100+ round trips to sourcekitd. This is slow and creates excessive overhead.Context: swiftlang/sourcekit-lsp#2552 (comment)
Proposed solution
Add a new batch request
source.request.declaration.usrsto sourcekitd that returns USRs and declaration metadata for all declarations in a file in a single call. Similar toCollectVariableTypesource.request.variable.typeInput:
key.filepathkey.compilerargskey.offsetandkey.length- If specified, only return declarations in this rangeOutput:
Array of declaration info objects with:
key.offsetkey.lengthkey.usrkey.kindAlternatives considered
No response
Additional information
No response