Move exists to own file

This commit is contained in:
Matt Bierner 2020-09-18 16:26:04 -07:00
parent c3651027ba
commit f8f2538d20
2 changed files with 17 additions and 9 deletions

View file

@ -10,6 +10,7 @@ import * as nls from 'vscode-nls';
import { wait } from '../test/testUtils';
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
import { coalesce, flatten } from '../utils/arrays';
import { exists } from '../utils/fs';
import { isTsConfigFileName } from '../utils/languageDescription';
import { Lazy } from '../utils/lazy';
import { isImplicitProjectConfigFile } from '../utils/tsconfig';
@ -24,15 +25,6 @@ enum AutoDetect {
watch = 'watch'
}
const exists = async (resource: vscode.Uri): Promise<boolean> => {
try {
const stat = await vscode.workspace.fs.stat(resource);
// stat.type is an enum flag
return !!(stat.type & vscode.FileType.File);
} catch {
return false;
}
};
interface TypeScriptTaskDefinition extends vscode.TaskDefinition {
tsconfig: string;

View file

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export const exists = async (resource: vscode.Uri): Promise<boolean> => {
try {
const stat = await vscode.workspace.fs.stat(resource);
// stat.type is an enum flag
return !!(stat.type & vscode.FileType.File);
} catch {
return false;
}
};