mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 23:44:09 +01:00
don't store empty label list
This commit is contained in:
@@ -81,20 +81,32 @@ export function restoreRecentlyOpened(data: RecentlyOpenedStorageData | undefine
|
||||
}
|
||||
|
||||
export function toStoreData(recents: IRecentlyOpened): RecentlyOpenedStorageData {
|
||||
const serialized: ISerializedRecentlyOpened = { workspaces3: [], files2: [], workspaceLabels: [], fileLabels: [] };
|
||||
const serialized: ISerializedRecentlyOpened = { workspaces3: [], files2: [] };
|
||||
|
||||
let hasLabel = false;
|
||||
const workspaceLabels: (string | null)[] = [];
|
||||
for (const recent of recents.workspaces) {
|
||||
if (isRecentFolder(recent)) {
|
||||
serialized.workspaces3.push(recent.folderUri.toString());
|
||||
} else {
|
||||
serialized.workspaces3.push({ id: recent.workspace.id, configURIPath: recent.workspace.configPath.toString() });
|
||||
}
|
||||
serialized.workspaceLabels.push(recent.label || null);
|
||||
workspaceLabels.push(recent.label || null);
|
||||
hasLabel = hasLabel || !!recent.label;
|
||||
}
|
||||
if (hasLabel) {
|
||||
serialized.workspaceLabels = workspaceLabels;
|
||||
}
|
||||
|
||||
hasLabel = false;
|
||||
const fileLabels: (string | null)[] = [];
|
||||
for (const recent of recents.files) {
|
||||
serialized.files2.push(recent.fileUri.toString());
|
||||
serialized.fileLabels.push(recent.label || null);
|
||||
fileLabels.push(recent.label || null);
|
||||
hasLabel = hasLabel || !!recent.label;
|
||||
}
|
||||
if (hasLabel) {
|
||||
serialized.fileLabels = fileLabels;
|
||||
}
|
||||
|
||||
return serialized;
|
||||
|
||||
@@ -100,7 +100,7 @@ export class WindowService extends Disposable implements IWindowService {
|
||||
|
||||
openWindow(uris: IURIToOpen[], options?: IOpenSettings): Promise<void> {
|
||||
if (!!this.configuration.remoteAuthority) {
|
||||
uris.forEach(u => u.label = u.label || this.getRecentLabel(u, options && options.forceOpenWorkspaceAsFile));
|
||||
uris.forEach(u => u.label = u.label || this.getRecentLabel(u, !!(options && options.forceOpenWorkspaceAsFile)));
|
||||
}
|
||||
return this.windowsService.openWindow(this.windowId, uris, options);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user