Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -294,12 +294,7 @@ function doParseStoredWorkspace(path: URI, contents: string): IStoredWorkspace {
export function useSlashForPath(storedFolders: IStoredWorkspaceFolder[]): boolean {
if (isWindows) {
for (const folder of storedFolders) {
if (isRawFileWorkspaceFolder(folder) && folder.path.indexOf(SLASH) >= 0) {
return true;
}
}
return false;
return storedFolders.some(folder => isRawFileWorkspaceFolder(folder) && folder.path.indexOf(SLASH) >= 0);
}
return true;
}

View File

@@ -8,7 +8,7 @@ import * as arrays from 'vs/base/common/arrays';
import { IStateService } from 'vs/platform/state/node/state';
import { app, JumpListCategory } from 'electron';
import { ILogService } from 'vs/platform/log/common/log';
import { getBaseLabel, getPathLabel } from 'vs/base/common/labels';
import { getBaseLabel, getPathLabel, splitName } from 'vs/base/common/labels';
import { IPath } from 'vs/platform/windows/common/windows';
import { Event as CommonEvent, Emitter } from 'vs/base/common/event';
import { isWindows, isMacintosh } from 'vs/base/common/platform';
@@ -352,7 +352,7 @@ export class WorkspacesHistoryMainService extends Disposable implements IWorkspa
name: nls.localize('recentFolders', "Recent Workspaces"),
items: arrays.coalesce(this.getRecentlyOpened().workspaces.slice(0, 7 /* limit number of entries here */).map(recent => {
const workspace = isRecentWorkspace(recent) ? recent.workspace : recent.folderUri;
const title = recent.label || getSimpleWorkspaceLabel(workspace, this.environmentService.untitledWorkspacesHome);
const title = recent.label ? splitName(recent.label).name : getSimpleWorkspaceLabel(workspace, this.environmentService.untitledWorkspacesHome);
let description;
let args;

View File

@@ -247,7 +247,7 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
}
}
} catch (error) {
if (error && error.code !== 'ENOENT') {
if (error.code !== 'ENOENT') {
this.logService.warn(`Unable to read folders in ${this.untitledWorkspacesHome} (${error}).`);
}
}
@@ -265,6 +265,9 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
}
const result = this.doEnterWorkspace(window, getWorkspaceIdentifier(path));
if (!result) {
return null;
}
// Emit as event
this._onWorkspaceEntered.fire({ window, workspace: result.workspace });
@@ -300,7 +303,11 @@ export class WorkspacesMainService extends Disposable implements IWorkspacesMain
return true; // OK
}
private doEnterWorkspace(window: ICodeWindow, workspace: IWorkspaceIdentifier): IEnterWorkspaceResult {
private doEnterWorkspace(window: ICodeWindow, workspace: IWorkspaceIdentifier): IEnterWorkspaceResult | null {
if (!window.config) {
return null;
}
window.focus();
// Register window for backups and migrate current backups over

View File

@@ -52,7 +52,7 @@ export class WorkspacesService implements AddFirstParameterToFunctions<IWorkspac
async getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
const window = this.windowsMainService.getWindowById(windowId);
if (window) {
if (window?.config) {
return this.workspacesHistoryMainService.getRecentlyOpened(window.config.workspace, window.config.folderUri, window.config.filesToOpenOrCreate);
}