From e3e773a2d78b17577cc16cf0f043ed40059f7807 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Mon, 22 Mar 2021 11:45:33 -0700 Subject: [PATCH] Remove exports from un-used exported functions, classes, and constants (#15741) --- .../common/languageServerPackageService.ts | 2 +- .../activation/common/packageRepository.ts | 2 +- .../languageServerPackageService.ts | 2 +- .../activation/languageServer/platformData.ts | 2 +- src/client/activation/types.ts | 4 +-- .../diagnostics/checks/envPathVariable.ts | 2 +- .../checks/invalidPythonPathInDebugger.ts | 2 +- .../diagnostics/checks/lsNotSupported.ts | 2 +- .../application/diagnostics/commands/types.ts | 6 ++--- .../common/installer/productInstaller.ts | 8 +++--- src/client/common/interpreterPathService.ts | 2 +- src/client/common/process/rawProcessApis.ts | 5 +--- .../baseActivationProvider.ts | 2 +- src/client/common/types.ts | 2 +- src/client/common/utils/async.ts | 4 +-- src/client/common/utils/enum.ts | 2 +- src/client/common/utils/misc.ts | 5 ++-- src/client/common/utils/multiStepInput.ts | 4 +-- src/client/common/utils/random.ts | 2 +- src/client/common/utils/resourceLifecycle.ts | 4 +-- src/client/common/utils/sysTypes.ts | 2 +- src/client/common/utils/version.ts | 4 +-- src/client/common/variables/sysTypes.ts | 4 +-- .../extension/adapter/remoteLaunchers.ts | 2 +- src/client/debugger/types.ts | 6 ++--- src/client/interpreter/activation/service.ts | 14 +++++------ src/client/interpreter/interpreterVersion.ts | 2 +- src/client/jupyter/jupyterIntegration.ts | 4 +-- .../languageserver/notebookConcatDocument.ts | 2 +- src/client/jupyter/types.ts | 10 ++++---- src/client/linters/baseLinter.ts | 4 +-- src/client/logging/_global.ts | 2 +- src/client/logging/formatters.ts | 2 +- src/client/logging/levels.ts | 4 +-- src/client/logging/logger.ts | 2 +- src/client/providers/jediProxy.ts | 8 +++--- .../pythonEnvironments/base/envsCache.ts | 2 +- .../pythonEnvironments/base/info/index.ts | 6 ++--- src/client/pythonEnvironments/base/locator.ts | 4 +-- .../base/locators/lowLevel/filesLocator.ts | 2 +- .../locators/lowLevel/fsWatchingLocator.ts | 2 +- .../pythonEnvironments/common/commonUtils.ts | 9 +++---- .../common/environmentIdentifier.ts | 2 +- .../discovery/locators/services/conda.ts | 2 +- .../locators/services/condaLocatorService.ts | 4 +-- .../locators/services/windowsStoreLocator.ts | 6 ++--- src/client/pythonEnvironments/info/index.ts | 10 ++++---- .../pythonEnvironments/info/interpreter.ts | 2 +- src/client/pythonEnvironments/legacyIOC.ts | 2 +- src/client/testing/common/runner.ts | 6 +---- .../testing/common/testVisitors/visitor.ts | 25 +++---------------- src/client/testing/common/types.ts | 4 +-- src/client/testing/navigation/types.ts | 2 +- src/client/workspaceSymbols/parser.ts | 4 +-- 54 files changed, 100 insertions(+), 130 deletions(-) diff --git a/src/client/activation/common/languageServerPackageService.ts b/src/client/activation/common/languageServerPackageService.ts index 385667e95329..b0762590f427 100644 --- a/src/client/activation/common/languageServerPackageService.ts +++ b/src/client/activation/common/languageServerPackageService.ts @@ -15,7 +15,7 @@ import { IServiceContainer } from '../../ioc/types'; import { ILanguageServerPackageService } from '../types'; import { azureCDNBlobStorageAccount, LanguageServerDownloadChannel } from './packageRepository'; -export const maxMajorVersion = 0; +const maxMajorVersion = 0; @injectable() export abstract class LanguageServerPackageService implements ILanguageServerPackageService { diff --git a/src/client/activation/common/packageRepository.ts b/src/client/activation/common/packageRepository.ts index 719a3d7c0296..ccba1701e68d 100644 --- a/src/client/activation/common/packageRepository.ts +++ b/src/client/activation/common/packageRepository.ts @@ -7,7 +7,7 @@ import { injectable } from 'inversify'; import { AzureBlobStoreNugetRepository } from '../../common/nuget/azureBlobStoreNugetRepository'; import { IServiceContainer } from '../../ioc/types'; -export const azureBlobStorageAccount = 'https://pvsc.blob.core.windows.net'; +const azureBlobStorageAccount = 'https://pvsc.blob.core.windows.net'; export const azureCDNBlobStorageAccount = 'https://pvsc.azureedge.net'; export enum LanguageServerDownloadChannel { diff --git a/src/client/activation/languageServer/languageServerPackageService.ts b/src/client/activation/languageServer/languageServerPackageService.ts index 62e2b7077aee..a4b4f2a211c3 100644 --- a/src/client/activation/languageServer/languageServerPackageService.ts +++ b/src/client/activation/languageServer/languageServerPackageService.ts @@ -12,7 +12,7 @@ import { LanguageServerPackageService } from '../common/languageServerPackageSer import { PlatformName } from '../types'; const downloadBaseFileName = 'Python-Language-Server'; -export const PackageNames = { +const PackageNames = { [PlatformName.Windows32Bit]: `${downloadBaseFileName}-${PlatformName.Windows32Bit}`, [PlatformName.Windows64Bit]: `${downloadBaseFileName}-${PlatformName.Windows64Bit}`, [PlatformName.Linux64Bit]: `${downloadBaseFileName}-${PlatformName.Linux64Bit}`, diff --git a/src/client/activation/languageServer/platformData.ts b/src/client/activation/languageServer/platformData.ts index bab753acc2d0..09bd74266648 100644 --- a/src/client/activation/languageServer/platformData.ts +++ b/src/client/activation/languageServer/platformData.ts @@ -7,7 +7,7 @@ import { inject, injectable } from 'inversify'; import { IPlatformService } from '../../common/platform/types'; import { IPlatformData } from '../types'; -export enum PlatformName { +enum PlatformName { Windows32Bit = 'win-x86', Windows64Bit = 'win-x64', Mac64Bit = 'osx-x64', diff --git a/src/client/activation/types.ts b/src/client/activation/types.ts index 7859c99ee53b..355712c6e381 100644 --- a/src/client/activation/types.ts +++ b/src/client/activation/types.ts @@ -72,7 +72,7 @@ export enum LanguageServerType { export const DotNetLanguageServerFolder = 'languageServer'; -export interface LanguageServerCommandHandler { +interface LanguageServerCommandHandler { clearAnalysisCache(): void; } @@ -85,7 +85,7 @@ export type ILanguageServerConnection = Pick< 'sendRequest' | 'sendNotification' | 'onProgress' | 'sendProgress' | 'onNotification' | 'onRequest' >; -export interface ILanguageServer +interface ILanguageServer extends RenameProvider, DefinitionProvider, HoverProvider, diff --git a/src/client/application/diagnostics/checks/envPathVariable.ts b/src/client/application/diagnostics/checks/envPathVariable.ts index 420c6813f7fb..840061a54083 100644 --- a/src/client/application/diagnostics/checks/envPathVariable.ts +++ b/src/client/application/diagnostics/checks/envPathVariable.ts @@ -19,7 +19,7 @@ const InvalidEnvPathVariableMessage = "The environment variable '{0}' seems to have some paths containing the '\"' character." + " The existence of such a character is known to have caused the {1} extension to not load. If the extension fails to load please modify your paths to remove this '\"' character."; -export class InvalidEnvironmentPathVariableDiagnostic extends BaseDiagnostic { +class InvalidEnvironmentPathVariableDiagnostic extends BaseDiagnostic { constructor(message: string, resource: Resource) { super( DiagnosticCodes.InvalidEnvironmentPathVariableDiagnostic, diff --git a/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts b/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts index f006b8f84232..fcde53e2effe 100644 --- a/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts +++ b/src/client/application/diagnostics/checks/invalidPythonPathInDebugger.ts @@ -31,7 +31,7 @@ const messages = { [DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic]: Diagnostics.invalidPythonPathInDebuggerLaunch(), }; -export class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic { +class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic { constructor( code: | DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic diff --git a/src/client/application/diagnostics/checks/lsNotSupported.ts b/src/client/application/diagnostics/checks/lsNotSupported.ts index 337a0a843ae6..46f9b549da9c 100644 --- a/src/client/application/diagnostics/checks/lsNotSupported.ts +++ b/src/client/application/diagnostics/checks/lsNotSupported.ts @@ -14,7 +14,7 @@ import { DiagnosticCodes } from '../constants'; import { DiagnosticCommandPromptHandlerServiceId, MessageCommandPrompt } from '../promptHandler'; import { DiagnosticScope, IDiagnostic, IDiagnosticHandlerService } from '../types'; -export class LSNotSupportedDiagnostic extends BaseDiagnostic { +class LSNotSupportedDiagnostic extends BaseDiagnostic { constructor(message: string, resource: Resource) { super( DiagnosticCodes.LSNotSupportedDiagnostic, diff --git a/src/client/application/diagnostics/commands/types.ts b/src/client/application/diagnostics/commands/types.ts index 118dc626be82..690e7d99953e 100644 --- a/src/client/application/diagnostics/commands/types.ts +++ b/src/client/application/diagnostics/commands/types.ts @@ -7,9 +7,9 @@ import { CommandsWithoutArgs } from '../../../common/application/commands'; import { DiagnosticScope, IDiagnostic, IDiagnosticCommand } from '../types'; export type CommandOption = { type: Type; options: Option }; -export type LaunchBrowserOption = CommandOption<'launch', string>; -export type IgnoreDiagnostOption = CommandOption<'ignore', DiagnosticScope>; -export type ExecuteVSCCommandOption = CommandOption<'executeVSCCommand', CommandsWithoutArgs>; +type LaunchBrowserOption = CommandOption<'launch', string>; +type IgnoreDiagnostOption = CommandOption<'ignore', DiagnosticScope>; +type ExecuteVSCCommandOption = CommandOption<'executeVSCCommand', CommandsWithoutArgs>; export type CommandOptions = LaunchBrowserOption | IgnoreDiagnostOption | ExecuteVSCCommandOption; export const IDiagnosticsCommandFactory = Symbol('IDiagnosticsCommandFactory'); diff --git a/src/client/common/installer/productInstaller.ts b/src/client/common/installer/productInstaller.ts index 30658d2feb8c..17f482bf0b23 100644 --- a/src/client/common/installer/productInstaller.ts +++ b/src/client/common/installer/productInstaller.ts @@ -45,7 +45,7 @@ const UnsupportedChannelsForProduct = new Map>([ [Product.torchProfilerInstallName, new Set([EnvironmentType.Conda])], ]); -export abstract class BaseInstaller { +abstract class BaseInstaller { private static readonly PromptPromises = new Map>(); protected readonly appShell: IApplicationShell; protected readonly configService: IConfigurationService; @@ -288,7 +288,7 @@ export class FormatterInstaller extends BaseInstaller { return InstallerResponse.Ignore; } } -export class TestFrameworkInstaller extends BaseInstaller { +class TestFrameworkInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, @@ -310,7 +310,7 @@ export class TestFrameworkInstaller extends BaseInstaller { } } -export class RefactoringLibraryInstaller extends BaseInstaller { +class RefactoringLibraryInstaller extends BaseInstaller { protected async promptToInstallImplementation( product: Product, resource?: Uri, @@ -326,7 +326,7 @@ export class RefactoringLibraryInstaller extends BaseInstaller { } } -export class DataScienceInstaller extends BaseInstaller { +class DataScienceInstaller extends BaseInstaller { // Override base installer to support a more DS-friendly streamlined installation. public async install( product: Product, diff --git a/src/client/common/interpreterPathService.ts b/src/client/common/interpreterPathService.ts index c510dc5e348d..acc41161c4a2 100644 --- a/src/client/common/interpreterPathService.ts +++ b/src/client/common/interpreterPathService.ts @@ -29,7 +29,7 @@ export const isGlobalSettingCopiedKey = 'isGlobalSettingCopiedKey'; export const defaultInterpreterPathSetting: keyof IPythonSettings = 'defaultInterpreterPath'; const CI_PYTHON_PATH = getCIPythonPath(); -export function getCIPythonPath(): string { +function getCIPythonPath(): string { if (process.env.CI_PYTHON_PATH && fs.existsSync(process.env.CI_PYTHON_PATH)) { return process.env.CI_PYTHON_PATH; } diff --git a/src/client/common/process/rawProcessApis.ts b/src/client/common/process/rawProcessApis.ts index bb85a4716b39..00d70e8e5dba 100644 --- a/src/client/common/process/rawProcessApis.ts +++ b/src/client/common/process/rawProcessApis.ts @@ -21,10 +21,7 @@ import { noop } from '../utils/misc'; const pidUsageTree = require('pidusage-tree'); -export function getDefaultOptions( - options: T, - defaultEnv?: EnvironmentVariables, -): T { +function getDefaultOptions(options: T, defaultEnv?: EnvironmentVariables): T { const defaultOptions = { ...options }; const execOptions = defaultOptions as SpawnOptions; if (execOptions) { diff --git a/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts b/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts index cc7bdf1363c0..4e271d592784 100644 --- a/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts +++ b/src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts @@ -11,7 +11,7 @@ import { IConfigurationService } from '../../types'; import { ITerminalActivationCommandProvider, TerminalShellType } from '../types'; @injectable() -export abstract class BaseActivationCommandProvider implements ITerminalActivationCommandProvider { +abstract class BaseActivationCommandProvider implements ITerminalActivationCommandProvider { constructor(@inject(IServiceContainer) protected readonly serviceContainer: IServiceContainer) {} public abstract isShellSupported(targetShell: TerminalShellType): boolean; diff --git a/src/client/common/types.ts b/src/client/common/types.ts index b3a185f376b4..56aca593119d 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -330,7 +330,7 @@ export interface IExperiments { readonly optOutFrom: string[]; } -export enum AnalysisSettingsLogLevel { +enum AnalysisSettingsLogLevel { Information = 'Information', Error = 'Error', Warning = 'Warning', diff --git a/src/client/common/utils/async.ts b/src/client/common/utils/async.ts index 24f24fde7291..a101f45d31f1 100644 --- a/src/client/common/utils/async.ts +++ b/src/client/common/utils/async.ts @@ -117,7 +117,7 @@ export function createDeferredFromPromise(promise: Promise): Deferred { // iterators -export interface IAsyncIterator extends AsyncIterator, Partial> {} +interface IAsyncIterator extends AsyncIterator, Partial> {} export interface IAsyncIterableIterator extends IAsyncIterator, AsyncIterable {} @@ -144,7 +144,7 @@ async function getNext(it: AsyncIterator, indexMaybe?: number): } } -export const NEVER: Promise = new Promise(() => { +const NEVER: Promise = new Promise(() => { /** No body. */ }); diff --git a/src/client/common/utils/enum.ts b/src/client/common/utils/enum.ts index d737be5b701e..78104b48846f 100644 --- a/src/client/common/utils/enum.ts +++ b/src/client/common/utils/enum.ts @@ -7,7 +7,7 @@ export function getNamesAndValues(e: any): { name: string; value: T }[] { return getNames(e).map((n) => ({ name: n, value: e[n] })); } -export function getNames(e: any) { +function getNames(e: any) { return getObjValues(e).filter((v) => typeof v === 'string') as string[]; } diff --git a/src/client/common/utils/misc.ts b/src/client/common/utils/misc.ts index 181fb0d01c80..4c202097e163 100644 --- a/src/client/common/utils/misc.ts +++ b/src/client/common/utils/misc.ts @@ -46,7 +46,7 @@ export async function usingAsync( * See https://github.com/Microsoft/TypeScript/pull/21316. */ -export type DeepReadonly = T extends any[] ? IDeepReadonlyArray : DeepReadonlyNonArray; +type DeepReadonly = T extends any[] ? IDeepReadonlyArray : DeepReadonlyNonArray; type DeepReadonlyNonArray = T extends object ? DeepReadonlyObject : T; interface IDeepReadonlyArray extends ReadonlyArray> {} type DeepReadonlyObject = { @@ -114,12 +114,11 @@ export function isResource(resource?: InterpreterUri): resource is Resource { * Using `instanceof Uri` doesn't always work as the object is not an instance of Uri (at least not in tests). * That's why VSC too has a helper method `URI.isUri` (though not public). * - * @export * @param {InterpreterUri} [resource] * @returns {resource is Uri} */ -export function isUri(resource?: Uri | any): resource is Uri { +function isUri(resource?: Uri | any): resource is Uri { if (!resource) { return false; } diff --git a/src/client/common/utils/multiStepInput.ts b/src/client/common/utils/multiStepInput.ts index cbda46e9f2b0..d031033aea38 100644 --- a/src/client/common/utils/multiStepInput.ts +++ b/src/client/common/utils/multiStepInput.ts @@ -12,7 +12,7 @@ import { IApplicationShell } from '../application/types'; // Borrowed from https://github.com/Microsoft/vscode-extension-samples/blob/master/quickinput-sample/src/multiStepInput.ts // Why re-invent the wheel :) -export class InputFlowAction { +class InputFlowAction { public static back = new InputFlowAction(); public static cancel = new InputFlowAction(); @@ -41,7 +41,7 @@ export interface IQuickPickParameters { acceptFilterBoxTextAsSelection?: boolean; } -export interface InputBoxParameters { +interface InputBoxParameters { title: string; password?: boolean; step?: number; diff --git a/src/client/common/utils/random.ts b/src/client/common/utils/random.ts index 872766274ff2..a766df771116 100644 --- a/src/client/common/utils/random.ts +++ b/src/client/common/utils/random.ts @@ -17,7 +17,7 @@ function getRandom(): number { return num / maxValue; } -export function getRandomBetween(min: number = 0, max: number = 10): number { +function getRandomBetween(min: number = 0, max: number = 10): number { const randomVal: number = getRandom(); return min + randomVal * (max - min); } diff --git a/src/client/common/utils/resourceLifecycle.ts b/src/client/common/utils/resourceLifecycle.ts index f624bc7050e7..9e78c66877ab 100644 --- a/src/client/common/utils/resourceLifecycle.ts +++ b/src/client/common/utils/resourceLifecycle.ts @@ -13,14 +13,14 @@ export interface IDisposable { /** * A registry of disposables. */ -export interface IDisposables extends IDisposable { +interface IDisposables extends IDisposable { push(...disposable: IDisposable[]): void; } /** * Safely dispose each of the disposables. */ -export async function disposeAll(disposables: IDisposable[]): Promise { +async function disposeAll(disposables: IDisposable[]): Promise { await Promise.all( disposables.map(async (d, index) => { try { diff --git a/src/client/common/utils/sysTypes.ts b/src/client/common/utils/sysTypes.ts index fcdb61786a37..42605bef4a46 100644 --- a/src/client/common/utils/sysTypes.ts +++ b/src/client/common/utils/sysTypes.ts @@ -83,7 +83,7 @@ export function isBoolean(obj: any): obj is boolean { /** * @returns whether the provided parameter is undefined. */ -export function isUndefined(obj: any): boolean { +function isUndefined(obj: any): boolean { return typeof obj === _typeof.undefined; } diff --git a/src/client/common/utils/version.ts b/src/client/common/utils/version.ts index bc8a98074f2a..c28bf85dfd70 100644 --- a/src/client/common/utils/version.ts +++ b/src/client/common/utils/version.ts @@ -103,7 +103,7 @@ function copyStrict(info: T): RawBasicVersionInfo { * Only the "basic" version info will be set (and normalized). * The caller is responsible for any other properties beyond that. */ -export function normalizeBasicVersionInfo(info: T | undefined): T { +function normalizeBasicVersionInfo(info: T | undefined): T { if (!info) { return EMPTY_VERSION as T; } @@ -138,7 +138,7 @@ function validateVersionPart(prop: string, part: number, unnormalized?: ErrorMsg * Only the "basic" version info will be validated. The caller * is responsible for any other properties beyond that. */ -export function validateBasicVersionInfo(info: T): void { +function validateBasicVersionInfo(info: T): void { const raw = (info as unknown) as RawBasicVersionInfo; validateVersionPart('major', info.major, raw.unnormalized?.major); validateVersionPart('minor', info.minor, raw.unnormalized?.minor); diff --git a/src/client/common/variables/sysTypes.ts b/src/client/common/variables/sysTypes.ts index b2d5b5545fb8..6b615cf219a3 100644 --- a/src/client/common/variables/sysTypes.ts +++ b/src/client/common/variables/sysTypes.ts @@ -6,7 +6,7 @@ import { isFunction, isString } from '../utils/sysTypes'; -export type TypeConstraint = string | Function; +type TypeConstraint = string | Function; export function validateConstraints(args: any[], constraints: TypeConstraint[]): void { const len = Math.min(args.length, constraints.length); @@ -15,7 +15,7 @@ export function validateConstraints(args: any[], constraints: TypeConstraint[]): } } -export function validateConstraint(arg: any, constraint: TypeConstraint): void { +function validateConstraint(arg: any, constraint: TypeConstraint): void { if (isString(constraint)) { if (typeof arg !== constraint) { throw new Error(`argument does not match constraint: typeof ${constraint}`); diff --git a/src/client/debugger/extension/adapter/remoteLaunchers.ts b/src/client/debugger/extension/adapter/remoteLaunchers.ts index 8f1eab6f9b51..de0362778a47 100644 --- a/src/client/debugger/extension/adapter/remoteLaunchers.ts +++ b/src/client/debugger/extension/adapter/remoteLaunchers.ts @@ -10,7 +10,7 @@ import '../../../common/extensions'; const pathToPythonLibDir = path.join(EXTENSION_ROOT_DIR, 'pythonFiles', 'lib', 'python'); const pathToDebugger = path.join(pathToPythonLibDir, 'debugpy'); -export type RemoteDebugOptions = { +type RemoteDebugOptions = { host: string; port: number; waitUntilDebuggerAttaches: boolean; diff --git a/src/client/debugger/types.ts b/src/client/debugger/types.ts index 58e1d88e282e..3c404ebfc24f 100644 --- a/src/client/debugger/types.ts +++ b/src/client/debugger/types.ts @@ -26,7 +26,7 @@ export type PathMapping = { localRoot: string; remoteRoot: string; }; -export type Connection = { +type Connection = { host?: string; port?: number; }; @@ -48,7 +48,7 @@ interface ICommonDebugArguments { // An absolute path to local directory with source. pathMappings?: PathMapping[]; } -export interface IKnownAttachDebugArguments extends ICommonDebugArguments { +interface IKnownAttachDebugArguments extends ICommonDebugArguments { workspaceFolder?: string; customDebugger?: boolean; // localRoot and remoteRoot are deprecated (replaced by pathMappings). @@ -63,7 +63,7 @@ export interface IKnownAttachDebugArguments extends ICommonDebugArguments { listen?: Connection; } -export interface IKnownLaunchRequestArguments extends ICommonDebugArguments { +interface IKnownLaunchRequestArguments extends ICommonDebugArguments { sudo?: boolean; pyramid?: boolean; workspaceFolder?: string; diff --git a/src/client/interpreter/activation/service.ts b/src/client/interpreter/activation/service.ts index 20156c169e6b..64e45055f4cc 100644 --- a/src/client/interpreter/activation/service.ts +++ b/src/client/interpreter/activation/service.ts @@ -23,9 +23,9 @@ import { EventName } from '../../telemetry/constants'; import { IInterpreterService } from '../contracts'; import { IEnvironmentActivationService } from './types'; -const getEnvironmentPrefix = 'e8b39361-0157-4923-80e1-22d70d46dee6'; -const cacheDuration = 10 * 60 * 1000; -export const getEnvironmentTimeout = 30000; +const ENVIRONMENT_PREFIX = 'e8b39361-0157-4923-80e1-22d70d46dee6'; +const CACHE_DURATION = 10 * 60 * 1000; +const ENVIRONMENT_TIMEOUT = 30000; // The shell under which we'll execute activation scripts. const defaultShells = { @@ -134,7 +134,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi } // Cache only if successful, else keep trying & failing if necessary. - const cache = new InMemoryCache(cacheDuration); + const cache = new InMemoryCache(CACHE_DURATION); return this.getActivatedEnvironmentVariablesImpl(resource, interpreter, allowExceptions).then((vars) => { cache.data = vars; this.activatedEnvVariablesCache.set(cacheKey, cache); @@ -183,7 +183,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi args.forEach((arg, i) => { args[i] = arg.toCommandArgument(); }); - const command = `${activationCommand} && echo '${getEnvironmentPrefix}' && python ${args.join(' ')}`; + const command = `${activationCommand} && echo '${ENVIRONMENT_PREFIX}' && python ${args.join(' ')}`; traceVerbose(`Activating Environment to capture Environment variables, ${command}`); // Do some wrapping of the call. For two reasons: @@ -201,7 +201,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi result = await processService.shellExec(command, { env, shell: shellInfo.shell, - timeout: getEnvironmentTimeout, + timeout: ENVIRONMENT_TIMEOUT, maxBuffer: 1000 * 1000, throwOnStdErr: false, }); @@ -265,7 +265,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi @traceDecorators.error('Failed to parse Environment variables') @traceDecorators.verbose('parseEnvironmentOutput', LogOptions.None) protected parseEnvironmentOutput(output: string, parse: (out: string) => NodeJS.ProcessEnv | undefined) { - output = output.substring(output.indexOf(getEnvironmentPrefix) + getEnvironmentPrefix.length); + output = output.substring(output.indexOf(ENVIRONMENT_PREFIX) + ENVIRONMENT_PREFIX.length); const js = output.substring(output.indexOf('{')).trim(); return parse(js); } diff --git a/src/client/interpreter/interpreterVersion.ts b/src/client/interpreter/interpreterVersion.ts index 3cf9da609c54..29167cd379b6 100644 --- a/src/client/interpreter/interpreterVersion.ts +++ b/src/client/interpreter/interpreterVersion.ts @@ -5,7 +5,7 @@ import { IProcessServiceFactory } from '../common/process/types'; import { getPythonVersion } from '../pythonEnvironments/info/pythonVersion'; import { IInterpreterVersionService } from './contracts'; -export const PIP_VERSION_REGEX = '\\d+\\.\\d+(\\.\\d+)?'; +const PIP_VERSION_REGEX = '\\d+\\.\\d+(\\.\\d+)?'; @injectable() export class InterpreterVersionService implements IInterpreterVersionService { diff --git a/src/client/jupyter/jupyterIntegration.ts b/src/client/jupyter/jupyterIntegration.ts index c552473eed1a..c6cec568374d 100644 --- a/src/client/jupyter/jupyterIntegration.ts +++ b/src/client/jupyter/jupyterIntegration.ts @@ -36,7 +36,7 @@ import { IDataViewerDataProvider, IJupyterUriProvider } from './types'; import { inDiscoveryExperiment } from '../common/experiments/helpers'; import { isWindowsStoreInterpreter } from '../pythonEnvironments/discovery/locators/services/windowsStoreInterpreter'; -export interface ILanguageServer extends Disposable { +interface ILanguageServer extends Disposable { readonly connection: ILanguageServerConnection; readonly capabilities: lsp.ServerCapabilities; } @@ -118,7 +118,7 @@ type PythonApiForJupyterExtension = { registerInterpreterStatusFilter(filter: IInterpreterStatusbarVisibilityFilter): void; }; -export type JupyterExtensionApi = { +type JupyterExtensionApi = { /** * Registers python extension specific parts with the jupyter extension * @param interpreterService diff --git a/src/client/jupyter/languageserver/notebookConcatDocument.ts b/src/client/jupyter/languageserver/notebookConcatDocument.ts index 2ee2e6f1a7c5..9cffc83924d6 100644 --- a/src/client/jupyter/languageserver/notebookConcatDocument.ts +++ b/src/client/jupyter/languageserver/notebookConcatDocument.ts @@ -22,7 +22,7 @@ import { IVSCodeNotebook } from '../../common/application/types'; import { IDisposable } from '../../common/types'; import { PYTHON_LANGUAGE } from '../../common/constants'; -export const NotebookConcatPrefix = '_NotebookConcat_'; +const NotebookConcatPrefix = '_NotebookConcat_'; /** * This helper class is used to present a converted document to an LS diff --git a/src/client/jupyter/types.ts b/src/client/jupyter/types.ts index ae9695cf8b7d..5eb58c7cf2b2 100644 --- a/src/client/jupyter/types.ts +++ b/src/client/jupyter/types.ts @@ -5,7 +5,7 @@ import { QuickPickItem } from 'vscode'; -export interface IJupyterServerUri { +interface IJupyterServerUri { baseUrl: string; token: string; @@ -15,7 +15,7 @@ export interface IJupyterServerUri { displayName: string; } -export type JupyterServerUriHandle = string; +type JupyterServerUriHandle = string; export interface IJupyterUriProvider { readonly id: string; // Should be a unique string (like a guid) @@ -24,7 +24,7 @@ export interface IJupyterUriProvider { getServerUri(handle: JupyterServerUriHandle): Promise; } -export interface IDataFrameInfo { +interface IDataFrameInfo { columns?: { key: string; type: ColumnType }[]; indexColumn?: string; rowCount?: number; @@ -37,11 +37,11 @@ export interface IDataViewerDataProvider { getRows(start: number, end: number): Promise; } -export enum ColumnType { +enum ColumnType { String = 'string', Number = 'number', Bool = 'bool', } // eslint-disable-next-line @typescript-eslint/no-explicit-any -export type IRowsResponse = any[]; +type IRowsResponse = any[]; diff --git a/src/client/linters/baseLinter.ts b/src/client/linters/baseLinter.ts index 565bdd5a9103..9652786e31f6 100644 --- a/src/client/linters/baseLinter.ts +++ b/src/client/linters/baseLinter.ts @@ -19,7 +19,7 @@ const namedRegexp = require('named-js-regexp'); // Allow codes with more than one letter (i.e. ABC123) const REGEX = '(?\\d+),(?-?\\d+),(?\\w+),(?\\w+\\d+):(?.*)\\r?(\\n|$)'; -export interface IRegexGroup { +interface IRegexGroup { line: number; column: number; code: string; @@ -27,7 +27,7 @@ export interface IRegexGroup { type: string; } -export function matchNamedRegEx(data: string, regex: string): IRegexGroup | undefined { +function matchNamedRegEx(data: string, regex: string): IRegexGroup | undefined { const compiledRegexp = namedRegexp(regex, 'g'); const rawMatch = compiledRegexp.exec(data); if (rawMatch !== null) { diff --git a/src/client/logging/_global.ts b/src/client/logging/_global.ts index 26274a79035b..14eb237419f4 100644 --- a/src/client/logging/_global.ts +++ b/src/client/logging/_global.ts @@ -65,7 +65,7 @@ export function addOutputChannelLogging(channel: IOutputChannel) { } // Emit a log message derived from the args to all enabled transports. -export function log(logLevel: LogLevel, ...args: Arguments) { +function log(logLevel: LogLevel, ...args: Arguments) { logToAll([globalLogger], logLevel, args); } diff --git a/src/client/logging/formatters.ts b/src/client/logging/formatters.ts index 48c09547d891..fbae3a6ae75a 100644 --- a/src/client/logging/formatters.ts +++ b/src/client/logging/formatters.ts @@ -9,7 +9,7 @@ import { getLevel, LogLevel, LogLevelName } from './levels'; const TIMESTAMP = 'YYYY-MM-DD HH:mm:ss'; // Knobs used when creating a formatter. -export type FormatterOptions = { +type FormatterOptions = { label?: string; }; diff --git a/src/client/logging/levels.ts b/src/client/logging/levels.ts index aeab61f27190..7615144ce85d 100644 --- a/src/client/logging/levels.ts +++ b/src/client/logging/levels.ts @@ -27,7 +27,7 @@ const logLevelMap: { [K in LogLevel]: LogLevelName } = { [LogLevel.Trace]: 'DEBUG-TRACE', }; // This can be used for winston.LoggerOptions.levels. -export const configLevels: winston.config.AbstractConfigSetLevels = { +const configLevels: winston.config.AbstractConfigSetLevels = { ERROR: 0, WARNING: 1, INFORMATION: 2, @@ -68,7 +68,7 @@ export function resolveLevelName( return undefined; } } -export function getLevelName(level: LogLevel): LogLevelName | undefined { +function getLevelName(level: LogLevel): LogLevelName | undefined { return logLevelMap[level]; } diff --git a/src/client/logging/logger.ts b/src/client/logging/logger.ts index 335406831d43..8a8806e23ff2 100644 --- a/src/client/logging/logger.ts +++ b/src/client/logging/logger.ts @@ -13,7 +13,7 @@ import { LogLevel, resolveLevelName } from './levels'; import { getConsoleTransport, getFileTransport, isConsoleTransport } from './transports'; import { Arguments } from './util'; -export type LoggerConfig = { +type LoggerConfig = { level?: LogLevel; file?: { logfile: string; diff --git a/src/client/providers/jediProxy.ts b/src/client/providers/jediProxy.ts index 3893acb2f482..d2d42ee64a2c 100644 --- a/src/client/providers/jediProxy.ts +++ b/src/client/providers/jediProxy.ts @@ -828,21 +828,21 @@ export interface IArgumentsResult extends ICommandResult { definitions: ISignature[]; } -export interface ISignature { +interface ISignature { name: string; docstring: string; description: string; paramindex: number; params: IArgument[]; } -export interface IArgument { +interface IArgument { name: string; value: string; docstring: string; description: string; } -export interface IReference { +interface IReference { name: string; fileName: string; columnIndex: number; @@ -860,7 +860,7 @@ export interface IAutoCompleteItem { raw_docstring: string; rightLabel: string; } -export interface IDefinitionRange { +interface IDefinitionRange { startLine: number; startColumn: number; endLine: number; diff --git a/src/client/pythonEnvironments/base/envsCache.ts b/src/client/pythonEnvironments/base/envsCache.ts index e7c099a49f04..e1e1795c1ff1 100644 --- a/src/client/pythonEnvironments/base/envsCache.ts +++ b/src/client/pythonEnvironments/base/envsCache.ts @@ -116,7 +116,7 @@ export interface IEnvsCache { flush(): Promise; } -export interface IPersistentStorage { +interface IPersistentStorage { load(): Promise; store(envs: PythonEnvInfo[]): Promise; } diff --git a/src/client/pythonEnvironments/base/info/index.ts b/src/client/pythonEnvironments/base/info/index.ts index cdab39c711fa..63990c1b2bcc 100644 --- a/src/client/pythonEnvironments/base/info/index.ts +++ b/src/client/pythonEnvironments/base/info/index.ts @@ -94,7 +94,7 @@ export enum PythonEnvSource { * @prop location - the env's location (on disk), if relevant * @prop source - the locator[s] which found the environment. */ -export type PythonEnvBaseInfo = { +type PythonEnvBaseInfo = { kind: PythonEnvKind; executable: PythonExecutableInfo; // One of (name, location) must be non-empty. @@ -139,7 +139,7 @@ export type PythonVersion = BasicVersionInfo & { /** * Information for a Python build/installation. */ -export type PythonBuildInfo = { +type PythonBuildInfo = { version: PythonVersion; // incl. raw, AKA sys.version arch: Architecture; }; @@ -150,7 +150,7 @@ export type PythonBuildInfo = { * @prop org - the name of the distro's creator/publisher * @prop defaultDisplayName - the text to use when showing the distro to users */ -export type PythonDistroMetaInfo = { +type PythonDistroMetaInfo = { org: string; defaultDisplayName?: string; }; diff --git a/src/client/pythonEnvironments/base/locator.ts b/src/client/pythonEnvironments/base/locator.ts index 4606d27e8d5c..cae4357ecfd2 100644 --- a/src/client/pythonEnvironments/base/locator.ts +++ b/src/client/pythonEnvironments/base/locator.ts @@ -72,7 +72,7 @@ export const NOOP_ITERATOR: IPythonEnvsIterator = iterEmpty(); * This is directly correlated with the `BasicPythonEnvsChangedEvent` * emitted by watchers. */ -export type BasicPythonLocatorQuery = { +type BasicPythonLocatorQuery = { /** * If set as true, ignore the cache and query for fresh environments. */ @@ -88,7 +88,7 @@ export type BasicPythonLocatorQuery = { /** * The portion of a query related to env search locations. */ -export type SearchLocations = { +type SearchLocations = { /** * The locations under which to look for environments. */ diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts index 0c3612d092d7..842f38495114 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/filesLocator.ts @@ -21,7 +21,7 @@ type GetExecutablesFunc = () => Promise | AsyncIterableIterator; protected readonly watcher = new PythonEnvsWatcher(); diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts index a95a17886ac0..0fc6ca0b1367 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts @@ -28,7 +28,7 @@ type DirUnwatchableReason = 'too many files' | undefined; /** * Determine if the directory is watchable. */ -export function checkDirWatchable(dirname: string): DirUnwatchableReason { +function checkDirWatchable(dirname: string): DirUnwatchableReason { let names: string[]; try { names = fs.readdirSync(dirname); diff --git a/src/client/pythonEnvironments/common/commonUtils.ts b/src/client/pythonEnvironments/common/commonUtils.ts index 8385b8380b30..d8eeaed0e8b5 100644 --- a/src/client/pythonEnvironments/common/commonUtils.ts +++ b/src/client/pythonEnvironments/common/commonUtils.ts @@ -14,11 +14,8 @@ import { getPythonVersionFromPyvenvCfg } from '../discovery/locators/services/vi import * as posix from './posixUtils'; import * as windows from './windowsUtils'; -export const matchPythonBinFilename = +const matchPythonBinFilename = getOSType() === OSType.Windows ? windows.matchPythonBinFilename : posix.matchPythonBinFilename; -export const matchBasicPythonBinFilename = - getOSType() === OSType.Windows ? windows.matchBasicPythonBinFilename : posix.matchBasicPythonBinFilename; - type FileFilterFunc = (filename: string) => boolean; /** @@ -200,7 +197,7 @@ function matchFile( * Looks for files in the same directory which might have version in their name. * @param interpreterPath */ -export async function getPythonVersionFromNearByFiles(interpreterPath: string): Promise { +async function getPythonVersionFromNearByFiles(interpreterPath: string): Promise { const root = path.dirname(interpreterPath); let version = UNKNOWN_PYTHON_VERSION; for await (const entry of findInterpretersInDir(root)) { @@ -247,7 +244,7 @@ export async function getPythonVersionFromPath( /** * Decide if the file is meets the given criteria for a Python executable. */ -export async function checkPythonExecutable( +async function checkPythonExecutable( executable: string | DirEntry, opts: { matchFilename?: (f: string) => boolean; diff --git a/src/client/pythonEnvironments/common/environmentIdentifier.ts b/src/client/pythonEnvironments/common/environmentIdentifier.ts index 2a9fd6da5a2c..b9ee73afa9bc 100644 --- a/src/client/pythonEnvironments/common/environmentIdentifier.ts +++ b/src/client/pythonEnvironments/common/environmentIdentifier.ts @@ -34,7 +34,7 @@ import { EnvironmentType } from '../info'; * * Last category is globally installed python, or system python. */ -export function getPrioritizedEnvironmentType(): EnvironmentType[] { +function getPrioritizedEnvironmentType(): EnvironmentType[] { return [ EnvironmentType.Pyenv, EnvironmentType.Conda, diff --git a/src/client/pythonEnvironments/discovery/locators/services/conda.ts b/src/client/pythonEnvironments/discovery/locators/services/conda.ts index 537be256bd2f..ef9201912adc 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/conda.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/conda.ts @@ -37,7 +37,7 @@ export type CondaInfo = { conda_version?: string; // eslint-disable-line camelcase }; -export type CondaEnvInfo = { +type CondaEnvInfo = { prefix: string; name?: string; }; diff --git a/src/client/pythonEnvironments/discovery/locators/services/condaLocatorService.ts b/src/client/pythonEnvironments/discovery/locators/services/condaLocatorService.ts index 8e5bdf5614ec..04e85d880288 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/condaLocatorService.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/condaLocatorService.ts @@ -43,7 +43,7 @@ const condaGlobPathsForLinuxMac = [ untildify('~/*conda*/bin/conda'), ]; -export const CondaLocationsGlob = `{${condaGlobPathsForLinuxMac.join(',')}}`; +const CondaLocationsGlob = `{${condaGlobPathsForLinuxMac.join(',')}}`; // ...and for windows, the known default install locations: const condaGlobPathsForWindows = [ @@ -56,7 +56,7 @@ const condaGlobPathsForWindows = [ ]; // format for glob processing: -export const CondaLocationsGlobWin = `{${condaGlobPathsForWindows.join(',')}}`; +const CondaLocationsGlobWin = `{${condaGlobPathsForWindows.join(',')}}`; export const CondaGetEnvironmentPrefix = 'Outputting Environment Now...'; diff --git a/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts b/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts index b18502aa3cf0..48b6a70f0f80 100644 --- a/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts +++ b/src/client/pythonEnvironments/discovery/locators/services/windowsStoreLocator.ts @@ -19,7 +19,7 @@ import { PythonEnvStructure } from '../../../common/pythonBinariesWatcher'; * @returns {string} : Returns path to the Windows Apps directory under * `%LOCALAPPDATA%/Microsoft/WindowsApps`. */ -export function getWindowsStoreAppsRoot(): string { +function getWindowsStoreAppsRoot(): string { const localAppData = getEnvironmentVariable('LOCALAPPDATA') || ''; return path.join(localAppData, 'Microsoft', 'WindowsApps'); } @@ -30,7 +30,7 @@ export function getWindowsStoreAppsRoot(): string { * @returns {boolean} : Returns true if `interpreterPath` is under * `%ProgramFiles%/WindowsApps`. */ -export function isForbiddenStorePath(absPath: string): boolean { +function isForbiddenStorePath(absPath: string): boolean { const programFilesStorePath = path .join(getEnvironmentVariable('ProgramFiles') || 'Program Files', 'WindowsApps') .normalize() @@ -162,7 +162,7 @@ const storePythonDirGlob = 'PythonSoftwareFoundation.Python.3.{[0-9],[0-9][0-9]} * @param {string} interpreterPath : Path to python interpreter. * @returns {boolean} : Returns true if the path matches pattern for windows python executable. */ -export function isWindowsStorePythonExePattern(interpreterPath: string): boolean { +function isWindowsStorePythonExePattern(interpreterPath: string): boolean { return minimatch(path.basename(interpreterPath), pythonExeGlob, { nocase: true }); } diff --git a/src/client/pythonEnvironments/info/index.ts b/src/client/pythonEnvironments/info/index.ts index 7c74ad91749e..76b7bdff437e 100644 --- a/src/client/pythonEnvironments/info/index.ts +++ b/src/client/pythonEnvironments/info/index.ts @@ -78,14 +78,14 @@ export type PythonEnvironment = InterpreterInformation & { /** * Python environment containing only partial info. But it will contain the environment path. */ -export type PartialPythonEnvironment = Partial> & { path: string }; +type PartialPythonEnvironment = Partial> & { path: string }; /** * Standardize the given env info. * * @param environment = the env info to normalize */ -export function normalizeEnvironment(environment: PartialPythonEnvironment): void { +function normalizeEnvironment(environment: PartialPythonEnvironment): void { environment.path = path.normalize(environment.path); } @@ -130,7 +130,7 @@ export function getEnvironmentTypeName(environmentType: EnvironmentType): string * @param environment1 - one of the two envs to compare * @param environment2 - one of the two envs to compare */ -export function areSamePartialEnvironment( +function areSamePartialEnvironment( environment1: PartialPythonEnvironment | undefined, environment2: PartialPythonEnvironment | undefined, fs: IFileSystem, @@ -158,7 +158,7 @@ export function areSamePartialEnvironment( * @param environment - the info to update * @param other - the info to copy in */ -export function updateEnvironment(environment: PartialPythonEnvironment, other: PartialPythonEnvironment): void { +function updateEnvironment(environment: PartialPythonEnvironment, other: PartialPythonEnvironment): void { // Preserve type information. // Possible we identified environment as unknown, but a later provider has identified env type. if (environment.envType === EnvironmentType.Unknown && other.envType && other.envType !== EnvironmentType.Unknown) { @@ -212,7 +212,7 @@ export function mergeEnvironments( * @param path1 - one of the two paths to compare * @param path2 - one of the two paths to compare */ -export function inSameDirectory(path1: string | undefined, path2: string | undefined, fs: IFileSystem): boolean { +function inSameDirectory(path1: string | undefined, path2: string | undefined, fs: IFileSystem): boolean { if (!path1 || !path2) { return false; } diff --git a/src/client/pythonEnvironments/info/interpreter.ts b/src/client/pythonEnvironments/info/interpreter.ts index e44dd8dec758..75fd037877ca 100644 --- a/src/client/pythonEnvironments/info/interpreter.ts +++ b/src/client/pythonEnvironments/info/interpreter.ts @@ -18,7 +18,7 @@ import { copyPythonExecInfo, PythonExecInfo } from '../exec'; * @param python - the path to the Python executable * @param raw - the information returned by the `interpreterInfo.py` script */ -export function extractInterpreterInfo(python: string, raw: InterpreterInfoJson): InterpreterInformation { +function extractInterpreterInfo(python: string, raw: InterpreterInfoJson): InterpreterInformation { let rawVersion = `${raw.versionInfo.slice(0, 3).join('.')}`; // We only need additional version details if the version is 'alpha', 'beta' or 'candidate'. // This restriction is needed to avoid sending any PII if this data is used with telemetry. diff --git a/src/client/pythonEnvironments/legacyIOC.ts b/src/client/pythonEnvironments/legacyIOC.ts index 15445e25d914..b943c7e3c0b2 100644 --- a/src/client/pythonEnvironments/legacyIOC.ts +++ b/src/client/pythonEnvironments/legacyIOC.ts @@ -132,7 +132,7 @@ export async function isComponentEnabled(): Promise { return results.includes(true); } -export interface IPythonEnvironments extends ILocator {} +interface IPythonEnvironments extends ILocator {} @injectable() class ComponentAdapter implements IComponentAdapter, IExtensionSingleActivationService { diff --git a/src/client/testing/common/runner.ts b/src/client/testing/common/runner.ts index cba2c22b1882..6a6d8709d704 100644 --- a/src/client/testing/common/runner.ts +++ b/src/client/testing/common/runner.ts @@ -24,11 +24,7 @@ export class TestRunner implements ITestRunner { } } -export async function run( - serviceContainer: IServiceContainer, - testProvider: TestProvider, - options: Options, -): Promise { +async function run(serviceContainer: IServiceContainer, testProvider: TestProvider, options: Options): Promise { const testExecutablePath = getExecutablePath( testProvider, serviceContainer.get(IConfigurationService).getSettings(options.workspaceFolder), diff --git a/src/client/testing/common/testVisitors/visitor.ts b/src/client/testing/common/testVisitors/visitor.ts index ca382cbac93f..34ff2a3a0486 100644 --- a/src/client/testing/common/testVisitors/visitor.ts +++ b/src/client/testing/common/testVisitors/visitor.ts @@ -3,13 +3,13 @@ 'use strict'; -import { getChildren, getParent } from '../testUtils'; +import { getChildren } from '../testUtils'; import { TestDataItem, Tests } from '../types'; -export type Visitor = (item: TestDataItem) => void; +type Visitor = (item: TestDataItem) => void; /** - * Vists tests recursively. + * Visits tests recursively. * * @export * @param {Tests} tests @@ -38,22 +38,3 @@ export function visitRecursive(tests: Tests, arg1: TestDataItem | Visitor, arg2? } children.forEach((folder) => visitRecursive(tests, folder, visitor)); } - -/** - * Visits parents recursively. - * - * @export - * @param {Tests} tests - * @param {TestDataItem} startItem - * @param {Visitor} visitor - * @returns {void} - */ -export function visitParentsRecursive(tests: Tests, startItem: TestDataItem, visitor: Visitor): void { - visitor(startItem); - const parent = getParent(tests, startItem); - if (!parent) { - return; - } - visitor(parent); - visitParentsRecursive(tests, parent, visitor); -} diff --git a/src/client/testing/common/types.ts b/src/client/testing/common/types.ts index 1c8b8c7189e9..39731a075ae1 100644 --- a/src/client/testing/common/types.ts +++ b/src/client/testing/common/types.ts @@ -126,7 +126,7 @@ export type TestResult = { functionsDidNotRun?: number; }; -export type TestingNode = TestResult & { +type TestingNode = TestResult & { name: string; nameToRun: string; resource: Uri; @@ -137,7 +137,7 @@ export type TestFolder = TestingNode & { testFiles: TestFile[]; }; -export type TestingXMLNode = TestingNode & { +type TestingXMLNode = TestingNode & { xmlName: string; }; diff --git a/src/client/testing/navigation/types.ts b/src/client/testing/navigation/types.ts index d2ae1cf65d4f..decc8d0a3d93 100644 --- a/src/client/testing/navigation/types.ts +++ b/src/client/testing/navigation/types.ts @@ -11,7 +11,7 @@ export const ITestCodeNavigatorCommandHandler = Symbol('ITestCodeNavigatorComman export interface ITestCodeNavigatorCommandHandler extends IDisposable { register(): void; } -export type NavigableItem = TestFile | TestFunction | TestSuite; +type NavigableItem = TestFile | TestFunction | TestSuite; export enum NavigableItemType { testFile = 'testFile', testFunction = 'testFunction', diff --git a/src/client/workspaceSymbols/parser.ts b/src/client/workspaceSymbols/parser.ts index 282592f0ea7b..b46ce151f6b4 100644 --- a/src/client/workspaceSymbols/parser.ts +++ b/src/client/workspaceSymbols/parser.ts @@ -11,7 +11,7 @@ const fuzzy = require('fuzzy'); const IsFileRegEx = /\tkind:file\tline:\d+$/g; const LINE_REGEX = '(?\\w+)\\t(?.*)\\t\\/\\^(?.*)\\$\\/;"\\tkind:(?\\w+)\\tline:(?\\d+)$'; -export interface IRegexGroup { +interface IRegexGroup { name: string; file: string; code: string; @@ -19,7 +19,7 @@ export interface IRegexGroup { line: number; } -export function matchNamedRegEx(data: String, regex: String): IRegexGroup | null { +function matchNamedRegEx(data: String, regex: String): IRegexGroup | null { const compiledRegexp = NamedRegexp(regex, 'g'); const rawMatch = compiledRegexp.exec(data); if (rawMatch !== null) {