Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 9979416

Browse files
committed
use phone handle icon for re-root command, microsoft/vscode#86125
1 parent e651919 commit 9979416

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

package.json

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,6 @@
149149
"title": "Show Incoming Calls",
150150
"category": "Calls",
151151
"icon": "./media/action-call-from.svg"
152-
},
153-
{
154-
"command": "references-view.rerunCallHierarchy",
155-
"title": "Show Call Hierarchy",
156-
"category": "Calls",
157-
"icon": {
158-
"dark": "./media/action-refresh-dark.svg",
159-
"light": "./media/action-refresh.svg"
160-
}
161152
}
162153
],
163154
"menus": {
@@ -242,9 +233,14 @@
242233
"when": "view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"
243234
},
244235
{
245-
"command": "references-view.rerunCallHierarchy",
236+
"command": "references-view.showOutgoingCalls",
237+
"group": "inline",
238+
"when": "view == references-view.tree && viewItem == call-item && references-view.callHierarchyMode == showOutgoing"
239+
},
240+
{
241+
"command": "references-view.showIncomingCalls",
246242
"group": "inline",
247-
"when": "view == references-view.tree && viewItem == call-item"
243+
"when": "view == references-view.tree && viewItem == call-item && references-view.callHierarchyMode == showIncoming"
248244
}
249245
],
250246
"commandPalette": [
@@ -287,10 +283,6 @@
287283
{
288284
"command": "references-view.pickFromHistory",
289285
"when": "reference-list.isActive"
290-
},
291-
{
292-
"command": "references-view.rerunCallHierarchy",
293-
"when": "never"
294286
}
295287
]
296288
},

src/extension.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,13 @@ export function activate(context: vscode.ExtensionContext) {
188188
}
189189
};
190190

191-
const setCallHierarchyDirectionCommand = async (direction: CallsDirection) => {
191+
const setCallHierarchyDirectionCommand = async (direction: CallsDirection, arg: any) => {
192192
callsDirection.value = direction;
193-
if (model instanceof CallsModel) {
194-
updateCallHierachyModel(model.uri, model.position, direction);
195-
}
196-
};
193+
if (arg instanceof CallItem) {
194+
return updateCallHierachyModel(arg.item.uri, arg.item.selectionRange.start, direction);
197195

198-
const makeRootCommand = (call: any) => {
199-
if (call instanceof CallItem) {
200-
return updateCallHierachyModel(call.item.uri, call.item.selectionRange.start);
196+
} else if (model instanceof CallsModel) {
197+
return updateCallHierachyModel(model.uri, model.position, direction);
201198
}
202199
};
203200

@@ -341,9 +338,8 @@ export function activate(context: vscode.ExtensionContext) {
341338
vscode.commands.registerCommand('references-view.findImplementations', () => findReferencesCommand(ItemSource.Implementations)),
342339
vscode.commands.registerCommand('references-view.refindReference', findReferencesCommand),
343340
vscode.commands.registerCommand('references-view.showCallHierarchy', updateCallHierachyModel),
344-
vscode.commands.registerCommand('references-view.showOutgoingCalls', () => setCallHierarchyDirectionCommand(CallsDirection.Outgoing)),
345-
vscode.commands.registerCommand('references-view.showIncomingCalls', () => setCallHierarchyDirectionCommand(CallsDirection.Incoming)),
346-
vscode.commands.registerCommand('references-view.rerunCallHierarchy', makeRootCommand),
341+
vscode.commands.registerCommand('references-view.showOutgoingCalls', (arg) => setCallHierarchyDirectionCommand(CallsDirection.Outgoing, arg)),
342+
vscode.commands.registerCommand('references-view.showIncomingCalls', (arg) => setCallHierarchyDirectionCommand(CallsDirection.Incoming, arg)),
347343
vscode.commands.registerCommand('references-view.refind', refindCommand),
348344
vscode.commands.registerCommand('references-view.refresh', refreshCommand),
349345
vscode.commands.registerCommand('references-view.clear', clearCommand),

0 commit comments

Comments
 (0)