Ensure workspace is read from WorkspaceContextService

This commit is contained in:
John Rothfels
2016-12-18 10:36:11 -08:00
parent 5d7ba47683
commit 25dcdbb973
10 changed files with 36 additions and 59 deletions

View File

@@ -6,7 +6,7 @@
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { ISearchService, QueryType } from 'vs/platform/search/common/search';
import { IWorkspaceContextService, IWorkspace } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
@@ -21,7 +21,7 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape {
private _activeSearches: { [id: number]: TPromise<Uri[]> } = Object.create(null);
private _searchService: ISearchService;
private _workspace: IWorkspace;
private _contextService: IWorkspaceContextService;
private _textFileService: ITextFileService;
private _editorService: IWorkbenchEditorService;
private _textModelResolverService: ITextModelResolverService;
@@ -38,7 +38,7 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape {
super();
this._searchService = searchService;
this._workspace = contextService.getWorkspace();
this._contextService = contextService;
this._textFileService = textFileService;
this._editorService = editorService;
this._fileService = fileService;
@@ -46,13 +46,13 @@ export class MainThreadWorkspace extends MainThreadWorkspaceShape {
}
$startSearch(include: string, exclude: string, maxResults: number, requestId: number): Thenable<Uri[]> {
if (!this._workspace) {
const workspace = this._contextService.getWorkspace();
if (!workspace) {
return;
}
const search = this._searchService.search({
folderResources: [this._workspace.resource],
folderResources: [workspace.resource],
type: QueryType.File,
maxResults,
includePattern: { [include]: true },