Skip to content

Commit

Permalink
Remove exports from un-used exported functions, classes, and constants (
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Mar 22, 2021
1 parent cd6cfa5 commit e3e773a
Show file tree
Hide file tree
Showing 54 changed files with 100 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/client/activation/common/packageRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
2 changes: 1 addition & 1 deletion src/client/activation/languageServer/platformData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions src/client/activation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export enum LanguageServerType {

export const DotNetLanguageServerFolder = 'languageServer';

export interface LanguageServerCommandHandler {
interface LanguageServerCommandHandler {
clearAnalysisCache(): void;
}

Expand All @@ -85,7 +85,7 @@ export type ILanguageServerConnection = Pick<
'sendRequest' | 'sendNotification' | 'onProgress' | 'sendProgress' | 'onNotification' | 'onRequest'
>;

export interface ILanguageServer
interface ILanguageServer
extends RenameProvider,
DefinitionProvider,
HoverProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const messages = {
[DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic]: Diagnostics.invalidPythonPathInDebuggerLaunch(),
};

export class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic {
class InvalidPythonPathInDebuggerDiagnostic extends BaseDiagnostic {
constructor(
code:
| DiagnosticCodes.InvalidPythonPathInDebuggerLaunchDiagnostic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/client/application/diagnostics/commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { CommandsWithoutArgs } from '../../../common/application/commands';
import { DiagnosticScope, IDiagnostic, IDiagnosticCommand } from '../types';

export type CommandOption<Type, Option> = { 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');
Expand Down
8 changes: 4 additions & 4 deletions src/client/common/installer/productInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const UnsupportedChannelsForProduct = new Map<Product, Set<EnvironmentType>>([
[Product.torchProfilerInstallName, new Set([EnvironmentType.Conda])],
]);

export abstract class BaseInstaller {
abstract class BaseInstaller {
private static readonly PromptPromises = new Map<string, Promise<InstallerResponse>>();
protected readonly appShell: IApplicationShell;
protected readonly configService: IConfigurationService;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/interpreterPathService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
5 changes: 1 addition & 4 deletions src/client/common/process/rawProcessApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import { noop } from '../utils/misc';

const pidUsageTree = require('pidusage-tree');

export function getDefaultOptions<T extends ShellOptions | SpawnOptions>(
options: T,
defaultEnv?: EnvironmentVariables,
): T {
function getDefaultOptions<T extends ShellOptions | SpawnOptions>(options: T, defaultEnv?: EnvironmentVariables): T {
const defaultOptions = { ...options };
const execOptions = defaultOptions as SpawnOptions;
if (execOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export interface IExperiments {
readonly optOutFrom: string[];
}

export enum AnalysisSettingsLogLevel {
enum AnalysisSettingsLogLevel {
Information = 'Information',
Error = 'Error',
Warning = 'Warning',
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/utils/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function createDeferredFromPromise<T>(promise: Promise<T>): Deferred<T> {

// iterators

export interface IAsyncIterator<T> extends AsyncIterator<T, void>, Partial<AsyncIterable<T>> {}
interface IAsyncIterator<T> extends AsyncIterator<T, void>, Partial<AsyncIterable<T>> {}

export interface IAsyncIterableIterator<T> extends IAsyncIterator<T>, AsyncIterable<T> {}

Expand All @@ -144,7 +144,7 @@ async function getNext<T>(it: AsyncIterator<T, T | void>, indexMaybe?: number):
}
}

export const NEVER: Promise<unknown> = new Promise(() => {
const NEVER: Promise<unknown> = new Promise(() => {
/** No body. */
});

Expand Down
2 changes: 1 addition & 1 deletion src/client/common/utils/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function getNamesAndValues<T>(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[];
}

Expand Down
5 changes: 2 additions & 3 deletions src/client/common/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function usingAsync<T extends IAsyncDisposable, R>(
* See https://github.com/Microsoft/TypeScript/pull/21316.
*/

export type DeepReadonly<T> = T extends any[] ? IDeepReadonlyArray<T[number]> : DeepReadonlyNonArray<T>;
type DeepReadonly<T> = T extends any[] ? IDeepReadonlyArray<T[number]> : DeepReadonlyNonArray<T>;
type DeepReadonlyNonArray<T> = T extends object ? DeepReadonlyObject<T> : T;
interface IDeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
type DeepReadonlyObject<T> = {
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/utils/multiStepInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -41,7 +41,7 @@ export interface IQuickPickParameters<T extends QuickPickItem> {
acceptFilterBoxTextAsSelection?: boolean;
}

export interface InputBoxParameters {
interface InputBoxParameters {
title: string;
password?: boolean;
step?: number;
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/utils/random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/utils/resourceLifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
async function disposeAll(disposables: IDisposable[]): Promise<void> {
await Promise.all(
disposables.map(async (d, index) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/utils/sysTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/client/common/utils/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function copyStrict<T extends BasicVersionInfo>(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<T extends BasicVersionInfo>(info: T | undefined): T {
function normalizeBasicVersionInfo<T extends BasicVersionInfo>(info: T | undefined): T {
if (!info) {
return EMPTY_VERSION as T;
}
Expand Down Expand Up @@ -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<T extends BasicVersionInfo>(info: T): void {
function validateBasicVersionInfo<T extends BasicVersionInfo>(info: T): void {
const raw = (info as unknown) as RawBasicVersionInfo;
validateVersionPart('major', info.major, raw.unnormalized?.major);
validateVersionPart('minor', info.minor, raw.unnormalized?.minor);
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/variables/sysTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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}`);
Expand Down
2 changes: 1 addition & 1 deletion src/client/debugger/extension/adapter/remoteLaunchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/client/debugger/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type PathMapping = {
localRoot: string;
remoteRoot: string;
};
export type Connection = {
type Connection = {
host?: string;
port?: number;
};
Expand All @@ -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).
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/client/interpreter/activation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -134,7 +134,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
}

// Cache only if successful, else keep trying & failing if necessary.
const cache = new InMemoryCache<NodeJS.ProcessEnv | undefined>(cacheDuration);
const cache = new InMemoryCache<NodeJS.ProcessEnv | undefined>(CACHE_DURATION);
return this.getActivatedEnvironmentVariablesImpl(resource, interpreter, allowExceptions).then((vars) => {
cache.data = vars;
this.activatedEnvVariablesCache.set(cacheKey, cache);
Expand Down Expand Up @@ -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:
Expand All @@ -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,
});
Expand Down Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit e3e773a

Please sign in to comment.