diff --git a/src/vs/workbench/parts/debug/browser/linkDetector.ts b/src/vs/workbench/parts/debug/browser/linkDetector.ts index 356578506cc146d2a1f71f1c3cabee66101a53c2..29dd86998c0c0475816709d4545cdc1abbacc2e3 100644 --- a/src/vs/workbench/parts/debug/browser/linkDetector.ts +++ b/src/vs/workbench/parts/debug/browser/linkDetector.ts @@ -37,6 +37,7 @@ export class LinkDetector { * If no links were detected, returns the original string. */ public handleLinks(text: string): HTMLElement | string { + const workspaceFolder = this.contextService.getWorkspace().folders[0]; let linkContainer: HTMLElement; for (let pattern of LinkDetector.FILE_LOCATION_PATTERNS) { @@ -46,7 +47,6 @@ export class LinkDetector { let match = pattern.exec(text); while (match !== null) { let resource: uri = null; - const workspaceFolder = this.contextService.getWorkspace().folders[0]; if (workspaceFolder) { try { resource = (match && !strings.startsWith(match[0], 'http')) diff --git a/src/vs/workbench/services/configuration/node/configuration.ts b/src/vs/workbench/services/configuration/node/configuration.ts index 68810961fd7f56f2f7f9dee88daa447f1de98007..fd6f77db55d593954cf2c370bd6063a90a2d867f 100644 --- a/src/vs/workbench/services/configuration/node/configuration.ts +++ b/src/vs/workbench/services/configuration/node/configuration.ts @@ -555,7 +555,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat if (this.getWorkbenchState() === WorkbenchState.EMPTY) { this._onDidUpdateConfiguration.fire({ source: ConfigurationSource.User, sourceConfig: this._configuration.user.contents }); } else { - this._onDidUpdateConfiguration.fire({ source: ConfigurationSource.Workspace, sourceConfig: this._configuration.getFolderConfigurationModel(this.workspace.folders[0].uri).contents }); + this._onDidUpdateConfiguration.fire({ source: ConfigurationSource.Workspace, sourceConfig: this.workspace.folders.length ? this._configuration.getFolderConfigurationModel(this.workspace.folders[0].uri).contents : void 0 }); // TODO@Sandeep debt? } } diff --git a/src/vs/workbench/services/history/browser/history.ts b/src/vs/workbench/services/history/browser/history.ts index 71695f668b8ed22c17103058328b272e578e6b76..2b8dedeb03882f7ad1428c670bea9cdc66d41eb7 100644 --- a/src/vs/workbench/services/history/browser/history.ts +++ b/src/vs/workbench/services/history/browser/history.ts @@ -15,7 +15,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi import { IHistoryService } from 'vs/workbench/services/history/common/history'; import { FileChangesEvent, IFileService, FileChangeType } from 'vs/platform/files/common/files'; import { Selection } from 'vs/editor/common/core/selection'; -import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; +import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; @@ -766,7 +766,8 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic } public getLastActiveWorkspaceRoot(): URI { - if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) { + const folders = this.contextService.getWorkspace().folders; + if (folders.length === 0) { return void 0; } @@ -785,6 +786,6 @@ export class HistoryService extends BaseHistoryService implements IHistoryServic } // fallback to first workspace - return this.contextService.getWorkspace().folders[0].uri; + return folders[0].uri; } }