Avoid checking for workspace exists or not. Instead use the EMPTY workspace state

This commit is contained in:
Sandeep Somavarapu
2017-09-13 09:55:38 +02:00
parent 05846be140
commit 292017d78c
13 changed files with 40 additions and 37 deletions

View File

@@ -7,7 +7,7 @@
import { isPromiseCanceledError } from 'vs/base/common/errors';
import URI from 'vs/base/common/uri';
import { ISearchService, QueryType, ISearchQuery, ISearchProgressItem, ISearchComplete } from 'vs/platform/search/common/search';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceContextService, WorkspaceState } 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, isCommonCodeEditor } from 'vs/editor/common/editorCommon';
@@ -53,17 +53,17 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
// --- workspace ---
private _onDidChangeWorkspace(): void {
this._proxy.$acceptWorkspaceData(this._contextService.getWorkspace());
this._proxy.$acceptWorkspaceData(this._contextService.getWorkspaceState() === WorkspaceState.EMPTY ? null : this._contextService.getWorkspace());
}
// --- search ---
$startSearch(include: string, exclude: string, maxResults: number, requestId: number): Thenable<URI[]> {
const workspace = this._contextService.getWorkspace();
if (!workspace) {
if (this._contextService.getWorkspaceState() === WorkspaceState.EMPTY) {
return undefined;
}
const workspace = this._contextService.getWorkspace();
const query: ISearchQuery = {
folderQueries: workspace.roots.map(root => ({ folder: root })),
type: QueryType.File,