未验证 提交 c8573287 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #47090 from pradeepmurugesan/reveal-in-finder-root-folder

#46785 open root folder when no file is in focus and reveal in finder
......@@ -386,9 +386,11 @@ CommandsRegistry.registerCommand({
}
});
function revealResourcesInOS(resources: URI[], windowsService: IWindowsService, notificationService: INotificationService): void {
function revealResourcesInOS(resources: URI[], windowsService: IWindowsService, notificationService: INotificationService, workSpaceContextService: IWorkspaceContextService): void {
if (resources.length) {
sequence(resources.map(r => () => windowsService.showItemInFolder(paths.normalize(r.fsPath, true))));
} else if (workSpaceContextService.getWorkspace().folders.length) {
windowsService.showItemInFolder(paths.normalize(workSpaceContextService.getWorkspace().folders[0].uri.fsPath, true));
} else {
notificationService.info(nls.localize('openFileToReveal', "Open a file first to reveal"));
}
......@@ -403,7 +405,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
},
handler: (accessor: ServicesAccessor, resource: URI | object) => {
const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
revealResourcesInOS(resources, accessor.get(IWindowsService), accessor.get(INotificationService));
revealResourcesInOS(resources, accessor.get(IWindowsService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService));
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -415,7 +417,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const editorService = accessor.get(IWorkbenchEditorService);
const activeInput = editorService.getActiveEditorInput();
const resources = activeInput && activeInput.getResource() ? [activeInput.getResource()] : [];
revealResourcesInOS(resources, accessor.get(IWindowsService), accessor.get(INotificationService));
revealResourcesInOS(resources, accessor.get(IWindowsService), accessor.get(INotificationService), accessor.get(IWorkspaceContextService));
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册