提交 f8d9b7d0 编写于 作者: B Benjamin Pasero

make sure recent list of paths is bounded

上级 bbd9cbd3
......@@ -37,7 +37,6 @@ export class VSCodeMenu {
private static lastKnownKeybindingsMapStorageKey = 'lastKnownKeybindings';
private static MAX_RECENT_ENTRIES = 10;
private static AUTO_SAVE_DELAY_DEFAULT = 1000; // in ms
private static AUTO_SAVE_DISABLED = -1;
......@@ -423,7 +422,7 @@ export class VSCodeMenu {
// Folders
recentList.folders.forEach((folder, index) => {
if (index < VSCodeMenu.MAX_RECENT_ENTRIES) {
if (index < windows.WindowsManager.MAX_RECENT_ENTRIES) {
openRecentMenu.append(this.createOpenRecentMenuItem(folder));
}
});
......@@ -435,7 +434,7 @@ export class VSCodeMenu {
}
recentList.files.forEach((file, index) => {
if (index < VSCodeMenu.MAX_RECENT_ENTRIES) {
if (index < windows.WindowsManager.MAX_RECENT_ENTRIES) {
openRecentMenu.append(this.createOpenRecentMenuItem(file));
}
});
......
......@@ -95,8 +95,9 @@ export class WindowsManager {
public static autoSaveDelayStorageKey = 'autoSaveDelay';
public static openedPathsListStorageKey = 'openedPathsList';
private static workingDirPickerStorageKey = 'pickerWorkingDir';
public static MAX_RECENT_ENTRIES = 10;
private static workingDirPickerStorageKey = 'pickerWorkingDir';
private static windowsStateStorageKey = 'windowsState';
private static themeStorageKey = 'theme'; // TODO@Ben this key is only used to find out if a window can be shown instantly because of light theme, remove once we have support for bg color
......@@ -567,7 +568,8 @@ export class WindowsManager {
// Clear those dupes
recentPaths = arrays.distinct(recentPaths);
return recentPaths;
// Make sure it is bounded
return recentPaths.slice(0, WindowsManager.MAX_RECENT_ENTRIES);
}
private toIPath(anyPath: string, ignoreFileNotFound?: boolean, gotoLineMode?: boolean): window.IPath {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册