提交 6fb9cc97 编写于 作者: B Benjamin Pasero

fix #35935

上级 51e471a6
......@@ -1148,14 +1148,20 @@ export class ClearRecentFilesAction extends Action {
constructor(
id: string,
label: string,
@IWindowsService private windowsService: IWindowsService
@IWindowsService private windowsService: IWindowsService,
@IHistoryService private historyService: IHistoryService
) {
super(id, label);
}
run(): TPromise<any> {
// Clear global recently opened
this.windowsService.clearRecentlyOpened();
// Clear workspace specific recently opened
this.historyService.clearRecentlyOpened();
return TPromise.as(false);
}
}
......
......@@ -51,6 +51,11 @@ export interface IHistoryService {
*/
clear(): void;
/**
* Clear list of recently opened editors.
*/
clearRecentlyOpened(): void;
/**
* Get the entire history of opened editors.
*/
......
......@@ -342,15 +342,24 @@ export class HistoryService extends Disposable implements IHistoryService {
clear(): void {
this.ensureHistoryLoaded();
// Navigation (next, previous)
this.index = -1;
this.lastIndex = -1;
this.stack.splice(0);
this.history = [];
// Closed files
this.recentlyClosedFiles = [];
// History
this.clearRecentlyOpened();
this.updateContextKeys();
}
clearRecentlyOpened(): void {
this.history = [];
}
private updateContextKeys(): void {
this.canNavigateBackContextKey.set(this.stack.length > 0 && this.index > 0);
this.canNavigateForwardContextKey.set(this.stack.length > 0 && this.index < this.stack.length - 1);
......
......@@ -354,6 +354,9 @@ export class TestHistoryService implements IHistoryService {
public clear(): void {
}
public clearRecentlyOpened(): void {
}
public getHistory(): (IEditorInput | IResourceInput)[] {
return [];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册