提交 40b6406a 编写于 作者: B Benjamin Pasero 提交者: GitHub

Merge pull request #23049 from cristianhosu/22768

Feature #22768
......@@ -511,7 +511,7 @@ export class VSCodeMenu {
if (folders.length || files.length) {
openRecentMenu.append(__separator__());
openRecentMenu.append(new MenuItem(this.likeAction('clearRecentlyOpened', { label: mnemonicLabel(nls.localize({ key: 'miClearItems', comment: ['&& denotes a mnemonic'] }, "&&Clear Items")), click: () => this.windowsService.clearRecentPathsList() }, false)));
openRecentMenu.append(this.createMenuItem(nls.localize({ key: 'miClearRecentOpen', comment: ['&& denotes a mnemonic'] }, "&&Clear Recent Files"), 'workbench.action.clearRecentFiles'));
}
}
......
......@@ -30,6 +30,7 @@ export interface IWindowsService {
setRepresentedFilename(windowId: number, fileName: string): TPromise<void>;
addToRecentlyOpen(paths: { path: string, isFile?: boolean }[]): TPromise<void>;
removeFromRecentlyOpen(paths: string[]): TPromise<void>;
clearRecentPathsList(): TPromise<void>;
getRecentlyOpen(windowId: number): TPromise<{ files: string[]; folders: string[]; }>;
focusWindow(windowId: number): TPromise<void>;
isMaximized(windowId: number): TPromise<boolean>;
......
......@@ -24,6 +24,7 @@ export interface IWindowsChannel extends IChannel {
call(command: 'setRepresentedFilename', arg: [number, string]): TPromise<void>;
call(command: 'addToRecentlyOpen', arg: { path: string, isFile?: boolean }[]): TPromise<void>;
call(command: 'removeFromRecentlyOpen', arg: string[]): TPromise<void>;
call(command: 'clearRecentPathsList'): TPromise<void>;
call(command: 'getRecentlyOpen', arg: number): TPromise<{ files: string[]; folders: string[]; }>;
call(command: 'focusWindow', arg: number): TPromise<void>;
call(command: 'isMaximized', arg: number): TPromise<boolean>;
......@@ -72,6 +73,7 @@ export class WindowsChannel implements IWindowsChannel {
case 'setRepresentedFilename': return this.service.setRepresentedFilename(arg[0], arg[1]);
case 'addToRecentlyOpen': return this.service.addToRecentlyOpen(arg);
case 'removeFromRecentlyOpen': return this.service.removeFromRecentlyOpen(arg);
case 'clearRecentPathsList': return this.service.clearRecentPathsList();
case 'getRecentlyOpen': return this.service.getRecentlyOpen(arg);
case 'focusWindow': return this.service.focusWindow(arg);
case 'isMaximized': return this.service.isMaximized(arg);
......@@ -153,6 +155,10 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('removeFromRecentlyOpen', paths);
}
clearRecentPathsList(): TPromise<void> {
return this.channel.call('clearRecentPathsList');
}
getRecentlyOpen(windowId: number): TPromise<{ files: string[]; folders: string[]; }> {
return this.channel.call('getRecentlyOpen', windowId);
}
......
......@@ -140,6 +140,11 @@ export class WindowsService implements IWindowsService, IDisposable {
return TPromise.as(null);
}
clearRecentPathsList(): TPromise<void> {
this.windowsMainService.clearRecentPathsList();
return TPromise.as(null);
}
getRecentlyOpen(windowId: number): TPromise<{ files: string[]; folders: string[]; }> {
const vscodeWindow = this.windowsMainService.getWindowById(windowId);
......
......@@ -34,7 +34,7 @@ import {
NavigateBetweenGroupsAction, FocusActiveGroupAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, ShowEditorsInGroupOneAction,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, ReopenClosedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, NAVIGATE_IN_GROUP_ONE_PREFIX,
OpenPreviousEditorFromHistoryAction, ShowAllEditorsAction, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, ClearEditorHistoryAction, ShowEditorsInGroupTwoAction, MoveEditorRightInGroupAction, OpenNextEditorInGroup, OpenPreviousEditorInGroup,
NAVIGATE_IN_GROUP_TWO_PREFIX, ShowEditorsInGroupThreeAction, NAVIGATE_IN_GROUP_THREE_PREFIX, FocusLastEditorInStackAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction, MoveEditorToNextGroupAction, MoveEditorLeftInGroupAction
NAVIGATE_IN_GROUP_TWO_PREFIX, ShowEditorsInGroupThreeAction, NAVIGATE_IN_GROUP_THREE_PREFIX, FocusLastEditorInStackAction, OpenNextRecentlyUsedEditorInGroupAction, MoveEditorToPreviousGroupAction, MoveEditorToNextGroupAction, MoveEditorLeftInGroupAction, ClearRecentFilesAction
} from 'vs/workbench/browser/parts/editor/editorActions';
import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands';
......@@ -323,6 +323,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(ShowEditorsInGroupThre
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenNextEditor, OpenNextEditor.ID, OpenNextEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageDown, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET] } }), 'View: Open Next Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditor, OpenPreviousEditor.ID, OpenPreviousEditor.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.PageUp, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET] } }), 'View: Open Previous Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ReopenClosedEditorAction, ReopenClosedEditorAction.ID, ReopenClosedEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_T }), 'View: Reopen Closed Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ClearRecentFilesAction, ClearRecentFilesAction.ID, ClearRecentFilesAction.LABEL), 'View: Clear Items', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(KeepEditorAction, KeepEditorAction.ID, KeepEditorAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.Enter) }), 'View: Keep Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_W) }), 'View: Close All Editors', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseLeftEditorsInGroupAction, CloseLeftEditorsInGroupAction.ID, CloseLeftEditorsInGroupAction.LABEL), 'View: Close Editors to the Left', category);
......
......@@ -22,6 +22,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IEditorGroupService, GroupArrangement } from 'vs/workbench/services/group/common/groupService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IWindowsService } from 'vs/platform/windows/common/windows';
export class SplitEditorAction extends Action {
......@@ -1114,6 +1115,26 @@ export class ReopenClosedEditorAction extends Action {
}
}
export class ClearRecentFilesAction extends Action {
public static ID = 'workbench.action.clearRecentFiles';
public static LABEL = nls.localize('clearRecentFiles', "Clear Recent Files");
constructor(
id: string,
label: string,
@IWindowsService private windowsService: IWindowsService
) {
super(id, label);
}
public run(): TPromise<any> {
this.windowsService.clearRecentPathsList();
return TPromise.as(false);
}
}
export const NAVIGATE_IN_GROUP_ONE_PREFIX = 'edt one ';
export class ShowEditorsInGroupOneAction extends QuickOpenAction {
......
......@@ -914,6 +914,9 @@ export class TestWindowsService implements IWindowsService {
removeFromRecentlyOpen(paths: string[]): TPromise<void> {
return TPromise.as(void 0);
}
clearRecentPathsList(): TPromise<void> {
return TPromise.as(void 0);
}
getRecentlyOpen(windowId: number): TPromise<{ files: string[]; folders: string[]; }> {
return TPromise.as(void 0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册