From 4b3340352fd68aa302e2686ec9b82da0dfb8ca15 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Sat, 25 May 2019 07:49:02 +0200 Subject: [PATCH] debt - prefer our file service --- src/vs/code/node/cli.ts | 4 ++-- src/vs/platform/environment/node/argv.ts | 2 +- src/vs/workbench/services/search/node/searchService.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts index 7b8222c7c5c..d5f5e622c9f 100644 --- a/src/vs/code/node/cli.ts +++ b/src/vs/code/node/cli.ts @@ -257,7 +257,7 @@ export async function main(argv: string[]): Promise { addArg(argv, `--prof-startup-prefix`, filenamePrefix); addArg(argv, `--no-cached-data`); - fs.writeFileSync(filenamePrefix, argv.slice(-6).join('|')); + writeFileSync(filenamePrefix, argv.slice(-6).join('|')); processCallbacks.push(async _child => { @@ -329,7 +329,7 @@ export async function main(argv: string[]): Promise { await extHost.stop(); // re-create the marker file to signal that profiling is done - fs.writeFileSync(filenamePrefix, ''); + writeFileSync(filenamePrefix, ''); } catch (e) { console.error('Failed to profile startup. Make sure to quit Code first.'); diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts index 5c7a4050b8a..33d28e88cfc 100644 --- a/src/vs/platform/environment/node/argv.ts +++ b/src/vs/platform/environment/node/argv.ts @@ -8,7 +8,7 @@ import * as os from 'os'; import { localize } from 'vs/nls'; import { ParsedArgs } from 'vs/platform/environment/common/environment'; import { join } from 'vs/base/common/path'; -import { writeFileSync } from 'fs'; +import { writeFileSync } from 'vs/base/node/pfs'; /** * This code is also used by standalone cli's. Avoid adding any other dependencies. diff --git a/src/vs/workbench/services/search/node/searchService.ts b/src/vs/workbench/services/search/node/searchService.ts index fcef06a15fb..fc75d4442a7 100644 --- a/src/vs/workbench/services/search/node/searchService.ts +++ b/src/vs/workbench/services/search/node/searchService.ts @@ -13,7 +13,6 @@ import { keys, ResourceMap, values } from 'vs/base/common/map'; import { Schemas } from 'vs/base/common/network'; import { StopWatch } from 'vs/base/common/stopwatch'; import { URI as uri } from 'vs/base/common/uri'; -import * as pfs from 'vs/base/node/pfs'; import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc'; import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -425,6 +424,7 @@ export class DiskSearch implements ISearchResultProvider { searchDebug: IDebugParams | undefined, @ILogService private readonly logService: ILogService, @IConfigurationService private readonly configService: IConfigurationService, + @IFileService private readonly fileService: IFileService ) { const timeout = this.configService.getValue().search.maintainFileSearchCache ? Number.MAX_VALUE : @@ -465,7 +465,7 @@ export class DiskSearch implements ISearchResultProvider { textSearch(query: ITextQuery, onProgress?: (p: ISearchProgressItem) => void, token?: CancellationToken): Promise { const folderQueries = query.folderQueries || []; - return Promise.all(folderQueries.map(q => q.folder.scheme === Schemas.file && pfs.exists(q.folder.fsPath))) + return Promise.all(folderQueries.map(q => this.fileService.exists(q.folder))) .then(exists => { if (token && token.isCancellationRequested) { throw canceled(); @@ -480,7 +480,7 @@ export class DiskSearch implements ISearchResultProvider { fileSearch(query: IFileQuery, token?: CancellationToken): Promise { const folderQueries = query.folderQueries || []; - return Promise.all(folderQueries.map(q => q.folder.scheme === Schemas.file && pfs.exists(q.folder.fsPath))) + return Promise.all(folderQueries.map(q => this.fileService.exists(q.folder))) .then(exists => { if (token && token.isCancellationRequested) { throw canceled(); -- GitLab