mirror of
https://github.com/Microsoft/vscode
synced 2024-07-17 02:57:19 +00:00
This commit is contained in:
parent
9d1c2920c0
commit
386459dec0
|
@ -180,13 +180,34 @@ class CallItemDataProvider implements vscode.TreeDataProvider<CallItem> {
|
|||
item.tooltip = item.label ? `${item.label} - ${element.item.detail}` : element.item.detail;
|
||||
item.contextValue = 'call-item';
|
||||
item.iconPath = getThemeIcon(element.item.kind);
|
||||
|
||||
type OpenArgs = [vscode.Uri, vscode.TextDocumentShowOptions];
|
||||
let openArgs: OpenArgs;
|
||||
|
||||
if (element.model.direction === CallsDirection.Outgoing) {
|
||||
|
||||
openArgs = [element.item.uri, { selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) }];
|
||||
|
||||
} else {
|
||||
// incoming call -> reveal first call instead of caller
|
||||
let firstLoctionStart: vscode.Position | undefined;
|
||||
if (element.locations) {
|
||||
for (const loc of element.locations) {
|
||||
if (loc.uri.toString() === element.item.uri.toString()) {
|
||||
firstLoctionStart = firstLoctionStart?.isBefore(loc.range.start) ? firstLoctionStart : loc.range.start;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!firstLoctionStart) {
|
||||
firstLoctionStart = element.item.selectionRange.start;
|
||||
}
|
||||
openArgs = [element.item.uri, { selection: new vscode.Range(firstLoctionStart, firstLoctionStart) }];
|
||||
}
|
||||
|
||||
item.command = {
|
||||
command: 'vscode.open',
|
||||
title: vscode.l10n.t('Open Call'),
|
||||
arguments: [
|
||||
element.item.uri,
|
||||
<vscode.TextDocumentShowOptions>{ selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) }
|
||||
]
|
||||
arguments: openArgs
|
||||
};
|
||||
item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
|
||||
return item;
|
||||
|
|
Loading…
Reference in a new issue