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

do not assume folders[0] is there

上级 8d161606
......@@ -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'))
......
......@@ -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?
}
}
......
......@@ -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;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册