Move exists to own file
This commit is contained in:
parent
c3651027ba
commit
f8f2538d20
|
@ -10,6 +10,7 @@ import * as nls from 'vscode-nls';
|
||||||
import { wait } from '../test/testUtils';
|
import { wait } from '../test/testUtils';
|
||||||
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
import { ITypeScriptServiceClient, ServerResponse } from '../typescriptService';
|
||||||
import { coalesce, flatten } from '../utils/arrays';
|
import { coalesce, flatten } from '../utils/arrays';
|
||||||
|
import { exists } from '../utils/fs';
|
||||||
import { isTsConfigFileName } from '../utils/languageDescription';
|
import { isTsConfigFileName } from '../utils/languageDescription';
|
||||||
import { Lazy } from '../utils/lazy';
|
import { Lazy } from '../utils/lazy';
|
||||||
import { isImplicitProjectConfigFile } from '../utils/tsconfig';
|
import { isImplicitProjectConfigFile } from '../utils/tsconfig';
|
||||||
|
@ -24,15 +25,6 @@ enum AutoDetect {
|
||||||
watch = 'watch'
|
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 {
|
interface TypeScriptTaskDefinition extends vscode.TaskDefinition {
|
||||||
tsconfig: string;
|
tsconfig: string;
|
||||||
|
|
16
extensions/typescript-language-features/src/utils/fs.ts
Normal file
16
extensions/typescript-language-features/src/utils/fs.ts
Normal 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;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue