Skip to content

Commit b39ed1f

Browse files
committed
bug detecting workspaceIndentifiers to revive
1 parent f53be27 commit b39ed1f

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/vs/platform/windows/node/windowsIpc.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Event } from 'vs/base/common/event';
77
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
88
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions, IMessageBoxResult, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IDevToolsOptions, INewWindowOptions } from 'vs/platform/windows/common/windows';
9-
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
9+
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
1010
import { IRecentlyOpened } from 'vs/platform/history/common/history';
1111
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
1212
import { URI } from 'vs/base/common/uri';
@@ -63,7 +63,7 @@ export class WindowsChannel implements IServerChannel {
6363
case 'removeFromRecentlyOpened': {
6464
let paths: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string> = arg;
6565
if (Array.isArray(paths)) {
66-
paths = paths.map(path => isWorkspaceIdentifier(path) ? reviveWorkspaceIdentifier(path) : typeof path === 'string' ? path : URI.revive(path));
66+
paths = paths.map(path => isChanneledWorkspaceIdentifier(path) ? reviveWorkspaceIdentifier(path) : typeof path === 'string' ? path : URI.revive(path));
6767
}
6868
return this.service.removeFromRecentlyOpened(paths);
6969
}
@@ -193,7 +193,7 @@ export class WindowsChannelClient implements IWindowsService {
193193
getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
194194
return this.channel.call('getRecentlyOpened', windowId)
195195
.then((recentlyOpened: IRecentlyOpened) => {
196-
recentlyOpened.workspaces = recentlyOpened.workspaces.map(workspace => isWorkspaceIdentifier(workspace) ? reviveWorkspaceIdentifier(workspace) : URI.revive(workspace));
196+
recentlyOpened.workspaces = recentlyOpened.workspaces.map(workspace => isChanneledWorkspaceIdentifier(workspace) ? reviveWorkspaceIdentifier(workspace) : URI.revive(workspace));
197197
recentlyOpened.files = recentlyOpened.files.map(URI.revive);
198198
return recentlyOpened;
199199
});
@@ -337,3 +337,7 @@ export class WindowsChannelClient implements IWindowsService {
337337
return Promise.resolve(this.channel.call('resolveProxy', [windowId, url]));
338338
}
339339
}
340+
341+
function isChanneledWorkspaceIdentifier(obj: any): obj is IWorkspaceIdentifier {
342+
return obj && obj['configPath'];
343+
}

src/vs/platform/workspaces/common/workspaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface IWorkspaceIdentifier {
2626
configPath: URI;
2727
}
2828

29-
export function reviveWorkspaceIdentifier(workspace: { id: string, configPath: UriComponents; }) {
29+
export function reviveWorkspaceIdentifier(workspace: { id: string, configPath: UriComponents; }): IWorkspaceIdentifier {
3030
return { id: workspace.id, configPath: URI.revive(workspace.configPath) };
3131
}
3232

src/vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,11 +1245,6 @@ suite('WorkspaceConfigurationService-Multiroot', () => {
12451245
});
12461246
});
12471247

1248-
1249-
export function createWorkspaceIdentifier(path: URI) {
1250-
1251-
}
1252-
12531248
function getWorkspaceId(configPath: URI): string {
12541249
let workspaceConfigPath = configPath.scheme === Schemas.file ? fsPath(configPath) : configPath.toString();
12551250
if (!isLinux) {

0 commit comments

Comments
 (0)