mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
fix #57984
This commit is contained in:
@@ -112,7 +112,7 @@ export class ExtHostApiCommands {
|
||||
args: [
|
||||
{ name: 'uri', description: 'Uri of a text document', constraint: URI }
|
||||
],
|
||||
returns: 'A promise that resolves to an array of SymbolInformation-instances.'
|
||||
returns: 'A promise that resolves to an array of SymbolInformation and DocumentSymbol instances.'
|
||||
});
|
||||
this._register('vscode.executeCompletionItemProvider', this._executeCompletionItemProvider, {
|
||||
description: 'Execute completion item provider.',
|
||||
@@ -420,16 +420,27 @@ export class ExtHostApiCommands {
|
||||
if (isFalsyOrEmpty(value)) {
|
||||
return undefined;
|
||||
}
|
||||
let result: vscode.SymbolInformation[] = [];
|
||||
for (const symbol of value) {
|
||||
result.push(new types.SymbolInformation(
|
||||
symbol.name,
|
||||
typeConverters.SymbolKind.to(symbol.kind),
|
||||
symbol.containerName,
|
||||
new types.Location(resource, typeConverters.Range.to(symbol.range))
|
||||
));
|
||||
class MergedInfo extends types.SymbolInformation implements vscode.DocumentSymbol {
|
||||
static to(symbol: modes.DocumentSymbol): MergedInfo {
|
||||
let res = new MergedInfo(
|
||||
symbol.name,
|
||||
typeConverters.SymbolKind.to(symbol.kind),
|
||||
symbol.containerName,
|
||||
new types.Location(resource, typeConverters.Range.to(symbol.range))
|
||||
);
|
||||
res.detail = symbol.detail;
|
||||
res.range = res.location.range;
|
||||
res.selectionRange = typeConverters.Range.to(symbol.selectionRange);
|
||||
res.children = symbol.children && symbol.children.map(MergedInfo.to);
|
||||
return res;
|
||||
}
|
||||
|
||||
detail: string;
|
||||
range: vscode.Range;
|
||||
selectionRange: vscode.Range;
|
||||
children: vscode.DocumentSymbol[];
|
||||
}
|
||||
return result;
|
||||
return value.map(MergedInfo.to);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user