提交 0e6b6a9b 编写于 作者: I isidor

commands: ignore list if the command is triggered from the main menu

fixes #45414
上级 25470cb5
......@@ -16,12 +16,16 @@ import { IFileStat } from 'vs/platform/files/common/files';
// Commands can get exeucted from a command pallete, from a context menu or from some list using a keybinding
// To cover all these cases we need to properly compute the resource on which the command is being executed
export function getResourceForCommand(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI {
export function getResourceForCommand(resource: URI | object | { from: string }, listService: IListService, editorService: IWorkbenchEditorService): URI {
if (URI.isUri(resource)) {
return resource;
}
let list = listService.lastFocusedList;
if ('from' in resource && resource.from === 'menu') {
// Ignore list if the command is triggered from the main menu
list = undefined;
}
const list = listService.lastFocusedList;
if (list && list.isDOMFocused()) {
const focus = list.getFocus();
if (focus instanceof FileStat) {
......@@ -34,7 +38,7 @@ export function getResourceForCommand(resource: URI | {}, listService: IListServ
return toResource(editorService.getActiveEditorInput(), { supportSideBySide: true });
}
export function getMultiSelectedResources(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
export function getMultiSelectedResources(resource: URI | object | { from: string }, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
const list = listService.lastFocusedList;
if (list && list.isDOMFocused()) {
// Explorer
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册