mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +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.tooltip = item.label ? `${item.label} - ${element.item.detail}` : element.item.detail;
|
||||||
item.contextValue = 'call-item';
|
item.contextValue = 'call-item';
|
||||||
item.iconPath = getThemeIcon(element.item.kind);
|
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 = {
|
item.command = {
|
||||||
command: 'vscode.open',
|
command: 'vscode.open',
|
||||||
title: vscode.l10n.t('Open Call'),
|
title: vscode.l10n.t('Open Call'),
|
||||||
arguments: [
|
arguments: openArgs
|
||||||
element.item.uri,
|
|
||||||
<vscode.TextDocumentShowOptions>{ selection: element.item.selectionRange.with({ end: element.item.selectionRange.start }) }
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
|
item.collapsibleState = vscode.TreeItemCollapsibleState.Collapsed;
|
||||||
return item;
|
return item;
|
||||||
|
|
Loading…
Reference in a new issue