diff --git a/.eslintrc.json b/.eslintrc.json index 2b6afe437b0f5..7b7c1f525891c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,6 +13,11 @@ "@typescript-eslint", "no-null", "import", "eslint-plugin-local" ], "rules": { + "sort-imports": ["error", { + "ignoreDeclarationSort": true, + "allowSeparatedGroups": true + }], + "@typescript-eslint/adjacent-overload-signatures": "error", "@typescript-eslint/array-type": "error", "@typescript-eslint/no-array-constructor": "error", diff --git a/Herebyfile.mjs b/Herebyfile.mjs index 9a4fff3df2756..4a916bbf4c0ea 100644 --- a/Herebyfile.mjs +++ b/Herebyfile.mjs @@ -6,9 +6,9 @@ import { task } from "hereby"; import _glob from "glob"; import util from "util"; import chalk from "chalk"; -import { exec, readJson, getDiffTool, getDirSize, memoize, needsUpdate, Debouncer, Deferred } from "./scripts/build/utils.mjs"; -import { runConsoleTests, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline, cleanTestDirs } from "./scripts/build/tests.mjs"; -import { buildProject as realBuildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs"; +import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs"; +import { cleanTestDirs, localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs"; +import { cleanProject, buildProject as realBuildProject, watchProject } from "./scripts/build/projects.mjs"; import { localizationDirectories } from "./scripts/build/localization.mjs"; import cmdLineOptions from "./scripts/build/options.mjs"; import esbuild from "esbuild"; diff --git a/scripts/build/findUpDir.mjs b/scripts/build/findUpDir.mjs index b88efd92fe10f..e663697db4451 100644 --- a/scripts/build/findUpDir.mjs +++ b/scripts/build/findUpDir.mjs @@ -1,4 +1,4 @@ -import { join, resolve, dirname } from "path"; +import { dirname, join, resolve } from "path"; import { existsSync } from "fs"; import url from "url"; diff --git a/scripts/build/projects.mjs b/scripts/build/projects.mjs index df5a4906e1702..6df499445c177 100644 --- a/scripts/build/projects.mjs +++ b/scripts/build/projects.mjs @@ -1,4 +1,4 @@ -import { exec, Debouncer } from "./utils.mjs"; +import { Debouncer, exec } from "./utils.mjs"; import { resolve } from "path"; import { findUpRoot } from "./findUpDir.mjs"; import cmdLineOptions from "./options.mjs"; diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 21b796d43609a..60172033a77aa 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,62 +1,299 @@ import { - __String, AccessExpression, addRelatedInfo, append, appendIfUnique, ArrayBindingElement, ArrayLiteralExpression, - ArrowFunction, AssignmentDeclarationKind, BinaryExpression, BinaryOperatorToken, BindableAccessExpression, - BindableObjectDefinePropertyCall, BindablePropertyAssignmentExpression, BindableStaticAccessExpression, - BindableStaticNameExpression, BindableStaticPropertyAssignmentExpression, BindingElement, Block, - BreakOrContinueStatement, CallChain, CallExpression, CaseBlock, CaseClause, cast, CatchClause, ClassLikeDeclaration, - ClassStaticBlockDeclaration, CompilerOptions, concatenate, ConditionalExpression, ConditionalTypeNode, contains, - createBinaryExpressionTrampoline, createDiagnosticForNodeInSourceFile, createFileDiagnostic, createQueue, - createSymbolTable, Debug, Declaration, declarationNameToString, DeleteExpression, DestructuringAssignment, - DiagnosticCategory, DiagnosticMessage, DiagnosticRelatedInformation, Diagnostics, DiagnosticWithLocation, - DoStatement, DynamicNamedDeclaration, ElementAccessChain, ElementAccessExpression, EntityNameExpression, - EnumDeclaration, escapeLeadingUnderscores, every, ExportAssignment, exportAssignmentIsAlias, - ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, findAncestor, FlowFlags, FlowLabel, FlowNode, - FlowReduceLabel, forEach, forEachChild, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, - FunctionLikeDeclaration, GetAccessorDeclaration, getAssignedExpandoInitializer, getAssignmentDeclarationKind, - getAssignmentDeclarationPropertyAccessKind, getCombinedModifierFlags, getCombinedNodeFlags, getContainingClass, - getEffectiveContainerForJSDocTemplateTag, getElementOrPropertyAccessName, getEmitScriptTarget, - getEnclosingBlockScopeContainer, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, getExpandoInitializer, - getHostSignatureFromJSDoc, getImmediatelyInvokedFunctionExpression, getJSDocTypeTag, getLeftmostAccessExpression, - getNameOfDeclaration, getNameOrArgument, getNodeId, getRangesWhere, getRightMostAssignedExpression, - getSourceFileOfNode, getSourceTextOfNodeFromSourceFile, getSpanOfTokenAtPosition, getStrictOptionValue, - getSymbolNameForPrivateIdentifier, getTextOfIdentifierOrLiteral, getThisContainer, getTokenPosOfNode, - hasDynamicName, hasJSDocNodes, hasSyntacticModifier, Identifier, idText, IfStatement, ImportClause, - InternalSymbolName, isAliasableExpression, isAmbientModule, isAssignmentExpression, isAssignmentOperator, - isAssignmentTarget, isAsyncFunction, isAutoAccessorPropertyDeclaration, isBinaryExpression, - isBindableObjectDefinePropertyCall, isBindableStaticAccessExpression, isBindableStaticNameExpression, - isBindingPattern, isBlock, isBlockOrCatchScoped, isCallExpression, isClassStaticBlockDeclaration, - isConditionalTypeNode, isDeclaration, isDeclarationStatement, isDestructuringAssignment, isDottedName, - isElementAccessExpression, isEmptyObjectLiteral, isEntityNameExpression, isEnumConst, isEnumDeclaration, - isExportAssignment, isExportDeclaration, isExportsIdentifier, isExportSpecifier, isExpression, - isExpressionOfOptionalChainRoot, isExternalModule, isExternalOrCommonJsModule, isForInOrOfStatement, - isFunctionDeclaration, isFunctionLike, isFunctionLikeDeclaration, isFunctionLikeOrClassStaticBlockDeclaration, - isFunctionSymbol, isGlobalScopeAugmentation, isIdentifier, isIdentifierName, isInJSFile, isInTopLevelContext, - isJSDocConstructSignature, isJSDocEnumTag, isJSDocTemplateTag, isJSDocTypeAlias, isJsonSourceFile, - isLeftHandSideExpression, isLogicalOrCoalescingAssignmentOperator, isModuleAugmentationExternal, isModuleBlock, - isModuleDeclaration, isModuleExportsAccessExpression, isNamedDeclaration, isNamespaceExport, isNonNullExpression, - isNullishCoalesce, isObjectLiteralExpression, isObjectLiteralMethod, - isObjectLiteralOrClassExpressionMethodOrAccessor, isOmittedExpression, isOptionalChain, isOptionalChainRoot, - isOutermostOptionalChain, isParameterDeclaration, isParameterPropertyDeclaration, isParenthesizedExpression, - isPartOfTypeQuery, isPrefixUnaryExpression, isPrivateIdentifier, isPrologueDirective, - isPropertyAccessEntityNameExpression, isPropertyAccessExpression, isPropertyNameLiteral, isPrototypeAccess, - isPushOrUnshiftIdentifier, isRequireCall, isShorthandPropertyAssignment, isSignedNumericLiteral, isSourceFile, - isSpecialPropertyDeclaration, isStatement, isStatementButNotDeclaration, isStatic, isString, isStringLiteralLike, - isStringOrNumericLiteralLike, isThisInitializedDeclaration, isTypeAliasDeclaration, isTypeOfExpression, - isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement, - JSDocCallbackTag, JSDocClassTag, JSDocEnumTag, JSDocFunctionType, JSDocParameterTag, JSDocPropertyLikeTag, - JSDocSignature, JSDocTypedefTag, JSDocTypeLiteral, JsxAttribute, JsxAttributes, LabeledStatement, length, - LiteralLikeElementAccessExpression, MappedTypeNode, MethodDeclaration, ModifierFlags, ModuleBlock, - ModuleDeclaration, Mutable, NamespaceExportDeclaration, Node, NodeArray, NodeFlags, nodeHasName, nodeIsMissing, - nodeIsPresent, NonNullChain, NonNullExpression, NumericLiteral, objectAllocator, ObjectLiteralExpression, - OptionalChain, ParameterDeclaration, ParenthesizedExpression, Pattern, PatternAmbientModule, perfLogger, - PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessChain, PropertyAccessExpression, - PropertyDeclaration, PropertySignature, removeFileExtension, ReturnStatement, ScriptTarget, - SetAccessorDeclaration, setParent, setParentRecursive, setValueDeclaration, ShorthandPropertyAssignment, - shouldPreserveConstEnums, SignatureDeclaration, skipParentheses, sliceAfter, some, SourceFile, SpreadElement, - Statement, StringLiteral, SwitchStatement, Symbol, SymbolFlags, symbolName, SymbolTable, SyntaxKind, TextRange, - ThrowStatement, TokenFlags, tokenToString, tracing, TracingNode, tryCast, tryParsePattern, TryStatement, - TypeLiteralNode, TypeOfExpression, TypeParameterDeclaration, unescapeLeadingUnderscores, unreachableCodeIsError, - unusedLabelIsError, VariableDeclaration, WhileStatement, WithStatement, + AccessExpression, + ArrayBindingElement, + ArrayLiteralExpression, + ArrowFunction, + AssignmentDeclarationKind, + BinaryExpression, + BinaryOperatorToken, + BindableAccessExpression, + BindableObjectDefinePropertyCall, + BindablePropertyAssignmentExpression, + BindableStaticAccessExpression, + BindableStaticNameExpression, + BindableStaticPropertyAssignmentExpression, + BindingElement, + Block, + BreakOrContinueStatement, + CallChain, + CallExpression, + CaseBlock, + CaseClause, + CatchClause, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CompilerOptions, + ConditionalExpression, + ConditionalTypeNode, + Debug, + Declaration, + DeleteExpression, + DestructuringAssignment, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticRelatedInformation, + DiagnosticWithLocation, + Diagnostics, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + EntityNameExpression, + EnumDeclaration, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + ForInOrOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + Identifier, + IfStatement, + ImportClause, + InternalSymbolName, + JSDocCallbackTag, + JSDocClassTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTypeLiteral, + JSDocTypedefTag, + JsxAttribute, + JsxAttributes, + LabeledStatement, + LiteralLikeElementAccessExpression, + MappedTypeNode, + MethodDeclaration, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + Mutable, + NamespaceExportDeclaration, + Node, + NodeArray, + NodeFlags, + NonNullChain, + NonNullExpression, + NumericLiteral, + ObjectLiteralExpression, + OptionalChain, + ParameterDeclaration, + ParenthesizedExpression, + Pattern, + PatternAmbientModule, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SignatureDeclaration, + SourceFile, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + TextRange, + ThrowStatement, + TokenFlags, + TracingNode, + TryStatement, + TypeLiteralNode, + TypeOfExpression, + TypeParameterDeclaration, + VariableDeclaration, + WhileStatement, + WithStatement, + __String, + addRelatedInfo, + append, + appendIfUnique, + cast, + concatenate, + contains, + createBinaryExpressionTrampoline, + createDiagnosticForNodeInSourceFile, + createFileDiagnostic, + createQueue, + createSymbolTable, + declarationNameToString, + escapeLeadingUnderscores, + every, + exportAssignmentIsAlias, + findAncestor, + forEach, + forEachChild, + getAssignedExpandoInitializer, + getAssignmentDeclarationKind, + getAssignmentDeclarationPropertyAccessKind, + getCombinedModifierFlags, + getCombinedNodeFlags, + getContainingClass, + getEffectiveContainerForJSDocTemplateTag, + getElementOrPropertyAccessName, + getEmitScriptTarget, + getEnclosingBlockScopeContainer, + getErrorSpanForNode, + getEscapedTextOfIdentifierOrLiteral, + getExpandoInitializer, + getHostSignatureFromJSDoc, + getImmediatelyInvokedFunctionExpression, + getJSDocTypeTag, + getLeftmostAccessExpression, + getNameOfDeclaration, + getNameOrArgument, + getNodeId, + getRangesWhere, + getRightMostAssignedExpression, + getSourceFileOfNode, + getSourceTextOfNodeFromSourceFile, + getSpanOfTokenAtPosition, + getStrictOptionValue, + getSymbolNameForPrivateIdentifier, + getTextOfIdentifierOrLiteral, + getThisContainer, + getTokenPosOfNode, + hasDynamicName, + hasJSDocNodes, + hasSyntacticModifier, + idText, + isAliasableExpression, + isAmbientModule, + isAssignmentExpression, + isAssignmentOperator, + isAssignmentTarget, + isAsyncFunction, + isAutoAccessorPropertyDeclaration, + isBinaryExpression, + isBindableObjectDefinePropertyCall, + isBindableStaticAccessExpression, + isBindableStaticNameExpression, + isBindingPattern, + isBlock, + isBlockOrCatchScoped, + isCallExpression, + isClassStaticBlockDeclaration, + isConditionalTypeNode, + isDeclaration, + isDeclarationStatement, + isDestructuringAssignment, + isDottedName, + isElementAccessExpression, + isEmptyObjectLiteral, + isEntityNameExpression, + isEnumConst, + isEnumDeclaration, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isExportsIdentifier, + isExpression, + isExpressionOfOptionalChainRoot, + isExternalModule, + isExternalOrCommonJsModule, + isForInOrOfStatement, + isFunctionDeclaration, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeOrClassStaticBlockDeclaration, + isFunctionSymbol, + isGlobalScopeAugmentation, + isIdentifier, + isIdentifierName, + isInJSFile, + isInTopLevelContext, + isJSDocConstructSignature, + isJSDocEnumTag, + isJSDocTemplateTag, + isJSDocTypeAlias, + isJsonSourceFile, + isLeftHandSideExpression, + isLogicalOrCoalescingAssignmentOperator, + isModuleAugmentationExternal, + isModuleBlock, + isModuleDeclaration, + isModuleExportsAccessExpression, + isNamedDeclaration, + isNamespaceExport, + isNonNullExpression, + isNullishCoalesce, + isObjectLiteralExpression, + isObjectLiteralMethod, + isObjectLiteralOrClassExpressionMethodOrAccessor, + isOmittedExpression, + isOptionalChain, + isOptionalChainRoot, + isOutermostOptionalChain, + isParameterDeclaration, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isPartOfTypeQuery, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAccessEntityNameExpression, + isPropertyAccessExpression, + isPropertyNameLiteral, + isPrototypeAccess, + isPushOrUnshiftIdentifier, + isRequireCall, + isShorthandPropertyAssignment, + isSignedNumericLiteral, + isSourceFile, + isSpecialPropertyDeclaration, + isStatement, + isStatementButNotDeclaration, + isStatic, + isString, + isStringLiteralLike, + isStringOrNumericLiteralLike, + isThisInitializedDeclaration, + isTypeAliasDeclaration, + isTypeOfExpression, + isVariableDeclaration, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableStatement, + length, + nodeHasName, + nodeIsMissing, + nodeIsPresent, + objectAllocator, + perfLogger, + removeFileExtension, + setParent, + setParentRecursive, + setValueDeclaration, + shouldPreserveConstEnums, + skipParentheses, + sliceAfter, + some, + symbolName, + tokenToString, + tracing, + tryCast, + tryParsePattern, + unescapeLeadingUnderscores, + unreachableCodeIsError, + unusedLabelIsError, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 26506bf04368c..313e1298f3108 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,19 +1,85 @@ import * as ts from "./_namespaces/ts"; import { - addRange, AffectedFileResult, arrayFrom, arrayToMap, BuilderProgram, BuilderProgramHost, BuilderState, BuildInfo, - BundleBuildInfo, CancellationToken, CommandLineOption, compareStringsCaseSensitive, compareValues, CompilerHost, - CompilerOptions, compilerOptionsAffectDeclarationPath, compilerOptionsAffectEmit, - compilerOptionsAffectSemanticDiagnostics, CompilerOptionsValue, concatenate, convertToOptionsWithAbsolutePaths, - createBuildInfo, createGetCanonicalFileName, createProgram, CustomTransformers, Debug, Diagnostic, - DiagnosticCategory, DiagnosticMessageChain, DiagnosticRelatedInformation, DiagnosticWithLocation, - EmitAndSemanticDiagnosticsBuilderProgram, EmitOnly, EmitResult, emitSkippedWithNoDiagnostics, emptyArray, - ensurePathIsNonModuleName, filterSemanticDiagnostics, forEach, forEachEntry, forEachKey, generateDjb2Hash, - GetCanonicalFileName, getDirectoryPath, getEmitDeclarations, getNormalizedAbsolutePath, getOptionsNameMap, - getOwnKeys, getRelativePathFromDirectory, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, HostForComputeHash, isArray, - isDeclarationFileName, isJsonSourceFile, isNumber, isString, map, mapDefined, maybeBind, noop, notImplemented, - outFile, Path, Program, ProjectReference, ReadBuildProgramHost, ReadonlyCollection, - returnFalse, returnUndefined, SemanticDiagnosticsBuilderProgram, skipTypeChecking, some, SourceFile, - sourceFileMayBeEmitted, SourceMapEmitResult, toPath, tryAddToSet, WriteFileCallback, WriteFileCallbackData, + AffectedFileResult, + BuildInfo, + BuilderProgram, + BuilderProgramHost, + BuilderState, + BundleBuildInfo, + CancellationToken, + CommandLineOption, + CompilerHost, + CompilerOptions, + CompilerOptionsValue, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCategory, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + DiagnosticWithLocation, + EmitAndSemanticDiagnosticsBuilderProgram, + EmitOnly, + EmitResult, + GetCanonicalFileName, + HostForComputeHash, + Path, + Program, + ProjectReference, + ReadBuildProgramHost, + ReadonlyCollection, + SemanticDiagnosticsBuilderProgram, + SourceFile, + SourceMapEmitResult, + WriteFileCallback, + WriteFileCallbackData, + addRange, + arrayFrom, + arrayToMap, + compareStringsCaseSensitive, + compareValues, + compilerOptionsAffectDeclarationPath, + compilerOptionsAffectEmit, + compilerOptionsAffectSemanticDiagnostics, + concatenate, + convertToOptionsWithAbsolutePaths, + createBuildInfo, + createGetCanonicalFileName, + createProgram, + emitSkippedWithNoDiagnostics, + emptyArray, + ensurePathIsNonModuleName, + filterSemanticDiagnostics, + forEach, + forEachEntry, + forEachKey, + generateDjb2Hash, + getDirectoryPath, + getEmitDeclarations, + getNormalizedAbsolutePath, + getOptionsNameMap, + getOwnKeys, + getRelativePathFromDirectory, + getTsBuildInfoEmitOutputFilePath, + handleNoEmitOptions, + isArray, + isDeclarationFileName, + isJsonSourceFile, + isNumber, + isString, + map, + mapDefined, + maybeBind, + noop, + notImplemented, + outFile, + returnFalse, + returnUndefined, + skipTypeChecking, + some, + sourceFileMayBeEmitted, + toPath, + tryAddToSet, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/builderPublic.ts b/src/compiler/builderPublic.ts index b2893c4691d38..0e155a0f2be9b 100644 --- a/src/compiler/builderPublic.ts +++ b/src/compiler/builderPublic.ts @@ -1,8 +1,21 @@ import { - BuilderProgramKind, CancellationToken, CompilerHost, CompilerOptions, createBuilderProgram, - createRedirectedBuilderProgram, CustomTransformers, Diagnostic, DiagnosticWithLocation, EmitResult, - getBuilderCreationParameters, Program, ProjectReference, ReusableBuilderProgramState, SavedBuildProgramEmitState, - SourceFile, WriteFileCallback, + BuilderProgramKind, + CancellationToken, + CompilerHost, + CompilerOptions, + CustomTransformers, + Diagnostic, + DiagnosticWithLocation, + EmitResult, + Program, + ProjectReference, + ReusableBuilderProgramState, + SavedBuildProgramEmitState, + SourceFile, + WriteFileCallback, + createBuilderProgram, + createRedirectedBuilderProgram, + getBuilderCreationParameters, } from "./_namespaces/ts"; export type AffectedFileResult = { result: T; affected: SourceFile | Program; } | undefined; diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 3fdeb73d1c8b7..57abd590d56c9 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,11 +1,38 @@ import { - arrayFrom, CancellationToken, computeSignatureWithDiagnostics, createGetCanonicalFileName, CustomTransformers, Debug, EmitOutput, emptyArray, - ExportedModulesFromDeclarationEmit, GetCanonicalFileName, getDirectoryPath, getSourceFileOfNode, + CancellationToken, + CustomTransformers, + Debug, + EmitOutput, + ExportedModulesFromDeclarationEmit, + GetCanonicalFileName, HostForComputeHash, - isDeclarationFileName, isExternalOrCommonJsModule, isGlobalScopeAugmentation, isJsonSourceFile, - isModuleWithStringLiteralName, isStringLiteral, mapDefined, mapDefinedIterator, ModuleDeclaration, - ModuleKind, outFile, OutputFile, Path, Program, ResolutionMode, some, SourceFile, StringLiteralLike, Symbol, - toPath, TypeChecker, + ModuleDeclaration, + ModuleKind, + OutputFile, + Path, + Program, + ResolutionMode, + SourceFile, + StringLiteralLike, + Symbol, + TypeChecker, + arrayFrom, + computeSignatureWithDiagnostics, + createGetCanonicalFileName, + emptyArray, + getDirectoryPath, + getSourceFileOfNode, + isDeclarationFileName, + isExternalOrCommonJsModule, + isGlobalScopeAugmentation, + isJsonSourceFile, + isModuleWithStringLiteralName, + isStringLiteral, + mapDefined, + mapDefinedIterator, + outFile, + some, + toPath, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/builderStatePublic.ts b/src/compiler/builderStatePublic.ts index d520c76ccc56d..17ffc222e30d1 100644 --- a/src/compiler/builderStatePublic.ts +++ b/src/compiler/builderStatePublic.ts @@ -1,4 +1,7 @@ -import { Diagnostic, WriteFileCallbackData } from "./_namespaces/ts"; +import { + Diagnostic, + WriteFileCallbackData, +} from "./_namespaces/ts"; export interface EmitOutput { outputFiles: OutputFile[]; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d316aec55faba..b30a02406896d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,201 +1,1015 @@ import * as ts from "./_namespaces/ts"; import { - __String, AccessExpression, AccessFlags, AccessorDeclaration, addRange, addRelatedInfo, addSyntheticLeadingComment, - AllAccessorDeclarations, and, AnonymousType, AnyImportOrReExport, AnyImportSyntax, append, appendIfUnique, - ArrayBindingPattern, arrayFrom, arrayIsHomogeneous, ArrayLiteralExpression, arrayOf, arraysEqual, arrayToMultiMap, - ArrayTypeNode, ArrowFunction, AssertionExpression, AssignmentDeclarationKind, AssignmentKind, AssignmentPattern, - AwaitExpression, BaseType, BigIntLiteral, BigIntLiteralType, BinaryExpression, BinaryOperatorToken, binarySearch, - BindableObjectDefinePropertyCall, BindingElement, BindingElementGrandparent, BindingName, BindingPattern, - bindSourceFile, Block, BreakOrContinueStatement, CallChain, CallExpression, CallLikeExpression, - CallSignatureDeclaration, CancellationToken, canHaveDecorators, canHaveExportModifier, canHaveIllegalDecorators, - canHaveIllegalModifiers, canHaveModifiers, cartesianProduct, CaseBlock, CaseClause, CaseOrDefaultClause, cast, - chainDiagnosticMessages, CharacterCodes, CheckFlags, ClassDeclaration, ClassElement, ClassExpression, - ClassLikeDeclaration, ClassStaticBlockDeclaration, clear, combinePaths, compareDiagnostics, comparePaths, - compareValues, Comparison, CompilerOptions, ComputedPropertyName, concatenate, concatenateDiagnosticMessageChains, - ConditionalExpression, ConditionalRoot, ConditionalType, ConditionalTypeNode, ConstructorDeclaration, - ConstructorTypeNode, ConstructSignatureDeclaration, contains, containsParseError, ContextFlags, copyEntries, - countWhere, createBinaryExpressionTrampoline, createCompilerDiagnostic, createDiagnosticCollection, - createDiagnosticForFileFromMessageChain, createDiagnosticForNode, createDiagnosticForNodeArray, - createDiagnosticForNodeFromMessageChain, createDiagnosticMessageChainFromDiagnostic, createEmptyExports, - createFileDiagnostic, createGetCanonicalFileName, createGetSymbolWalker, createPrinter, - createPropertyNameNodeForIdentifierOrLiteral, createScanner, createSymbolTable, createTextWriter, - createUnderscoreEscapedMultiMap, Debug, Declaration, DeclarationName, declarationNameToString, DeclarationStatement, - DeclarationWithTypeParameterChildren, DeclarationWithTypeParameters, Decorator, deduplicate, DefaultClause, - defaultMaximumTruncationLength, DeferredTypeReference, DeleteExpression, Diagnostic, DiagnosticCategory, - DiagnosticMessage, DiagnosticMessageChain, DiagnosticRelatedInformation, Diagnostics, DiagnosticWithLocation, - DoStatement, DynamicNamedDeclaration, ElementAccessChain, ElementAccessExpression, ElementFlags, EmitFlags, - EmitHint, EmitResolver, EmitTextWriter, emptyArray, endsWith, EntityName, EntityNameExpression, - EntityNameOrEntityNameExpression, entityNameToString, EnumDeclaration, EnumMember, equateValues, - escapeLeadingUnderscores, escapeString, every, EvolvingArrayType, ExclamationToken, ExportAssignment, - exportAssignmentIsAlias, ExportDeclaration, ExportSpecifier, Expression, expressionResultIsUnused, - ExpressionStatement, ExpressionWithTypeArguments, Extension, ExternalEmitHelpers, externalHelpersModuleNameText, - factory, fileExtensionIs, fileExtensionIsOneOf, filter, find, findAncestor, findBestPatternMatch, findIndex, - findLast, findLastIndex, findUseStrictPrologue, first, firstDefined, firstOrUndefined, flatMap, flatten, - FlowArrayMutation, FlowAssignment, FlowCall, FlowCondition, FlowFlags, FlowLabel, FlowNode, FlowReduceLabel, - FlowStart, FlowSwitchClause, FlowType, forEach, forEachChild, forEachChildRecursively, - forEachEnclosingBlockScopeContainer, forEachEntry, forEachImportClauseDeclaration, forEachKey, - forEachReturnStatement, forEachYieldExpression, ForInOrOfStatement, ForInStatement, formatMessage, ForOfStatement, - ForStatement, FreshableIntrinsicType, FreshableType, FreshObjectLiteralType, FunctionDeclaration, - FunctionExpression, FunctionFlags, FunctionLikeDeclaration, FunctionTypeNode, GenericType, GetAccessorDeclaration, - getAliasDeclarationFromName, getAllAccessorDeclarations, getAllowSyntheticDefaultImports, getAncestor, - getAssignedExpandoInitializer, getAssignmentDeclarationKind, getAssignmentDeclarationPropertyAccessKind, - getAssignmentTargetKind, getCheckFlags, getClassExtendsHeritageElement, getClassLikeDeclarationOfSymbol, - getCombinedLocalAndExportSymbolFlags, getCombinedModifierFlags, getCombinedNodeFlags, getContainingClass, - getContainingFunction, getContainingFunctionOrClassStaticBlock, getDeclarationModifierFlagsFromSymbol, - getDeclarationOfKind, getDeclarationsOfKind, getDeclaredExpandoInitializer, getDirectoryPath, - getEffectiveBaseTypeNode, getEffectiveConstraintOfTypeParameter, getEffectiveContainerForJSDocTemplateTag, - getEffectiveImplementsTypeNodes, getEffectiveInitializer, getEffectiveJSDocHost, getEffectiveModifierFlags, - getEffectiveReturnTypeNode, getEffectiveSetAccessorTypeAnnotationNode, getEffectiveTypeAnnotationNode, - getEffectiveTypeParameterDeclarations, getElementOrPropertyAccessName, getEmitDeclarations, getEmitModuleKind, - getEmitModuleResolutionKind, getEmitScriptTarget, getEnclosingBlockScopeContainer, getEntityNameFromTypeNode, - getEntries, getErrorSpanForNode, getEscapedTextOfIdentifierOrLiteral, getESModuleInterop, getExpandoInitializer, - getExportAssignmentExpression, getExternalModuleImportEqualsDeclarationExpression, getExternalModuleName, - getExternalModuleRequireArgument, getFirstConstructorWithBody, getFirstIdentifier, getFunctionFlags, - getHostSignatureFromJSDoc, getImmediatelyInvokedFunctionExpression, getInitializerOfBinaryExpression, - getInterfaceBaseTypeNodes, getInvokedExpression, getJSDocClassTag, getJSDocDeprecatedTag, getJSDocEnumTag, - getJSDocHost, getJSDocParameterTags, getJSDocRoot, getJSDocTags, getJSDocThisTag, getJSDocType, - getJSDocTypeAssertionType, getJSDocTypeParameterDeclarations, getJSDocTypeTag, getJSXImplicitImportBase, - getJSXRuntimeImport, getJSXTransformEnabled, getLeftmostAccessExpression, getLineAndCharacterOfPosition, - getLocalSymbolForExportDefault, getMembersOfDeclaration, getModeForUsageLocation, getModifiers, - getModuleInstanceState, getNameFromIndexInfo, getNameOfDeclaration, getNameOfExpando, getNamespaceDeclarationNode, - getNewTargetContainer, getNonAugmentationDeclaration, getNormalizedAbsolutePath, getObjectFlags, getOriginalNode, - getOrUpdate, getOwnKeys, getParameterSymbolFromJSDoc, getParseTreeNode, getPropertyAssignmentAliasLikeExpression, - getPropertyNameForPropertyNameNode, getResolutionDiagnostic, getResolutionModeOverrideForClause, - getResolvedExternalModuleName, getResolvedModule, getRestParameterElementType, getRootDeclaration, - getScriptTargetFeatures, getSelectedEffectiveModifierFlags, getSemanticJsxChildren, getSetAccessorValueParameter, - getSingleVariableOfVariableStatement, getSourceFileOfModule, getSourceFileOfNode, getSpanOfTokenAtPosition, - getSpellingSuggestion, getStrictOptionValue, getSuperContainer, getSymbolNameForPrivateIdentifier, - getTextOfIdentifierOrLiteral, getTextOfJSDocComment, getTextOfNode, getTextOfPropertyName, getThisContainer, - getThisParameter, getTrailingSemicolonDeferringWriter, getTypeParameterFromJsDoc, getTypesPackageName, - getUseDefineForClassFields, group, hasAbstractModifier, hasAccessorModifier, hasAmbientModifier, - hasContextSensitiveParameters, hasDecorators, HasDecorators, hasDynamicName, hasEffectiveModifier, - hasEffectiveModifiers, hasEffectiveReadonlyModifier, HasExpressionInitializer, hasExtension, HasIllegalDecorators, - HasIllegalModifiers, hasInitializer, HasInitializer, hasJSDocNodes, hasJSDocParameterTags, hasJsonModuleEmitEnabled, - HasModifiers, hasOnlyExpressionInitializer, hasOverrideModifier, hasPossibleExternalModuleReference, - hasQuestionToken, hasRestParameter, hasScopeMarker, hasStaticModifier, hasSyntacticModifier, hasSyntacticModifiers, - HeritageClause, Identifier, IdentifierTypePredicate, idText, IfStatement, ImportCall, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportsNotUsedAsValues, ImportSpecifier, - ImportTypeAssertionContainer, ImportTypeNode, IncompleteType, IndexedAccessType, IndexedAccessTypeNode, IndexInfo, - IndexKind, indexOfNode, IndexSignatureDeclaration, IndexType, indicesOf, InferenceContext, InferenceFlags, - InferenceInfo, InferencePriority, InferTypeNode, InstantiableType, InstantiationExpressionType, - InterfaceDeclaration, InterfaceType, InterfaceTypeWithDeclaredMembers, InternalSymbolName, IntersectionType, - IntersectionTypeNode, IntrinsicType, introducesArgumentsExoticObject, isAccessExpression, isAccessor, - isAliasableExpression, isAmbientModule, isArray, isArrayBindingPattern, isArrayLiteralExpression, isArrowFunction, - isAssertionExpression, isAssignmentDeclaration, isAssignmentExpression, isAssignmentOperator, isAssignmentPattern, - isAssignmentTarget, isAsyncFunction, isAutoAccessorPropertyDeclaration, isBinaryExpression, - isBindableObjectDefinePropertyCall, isBindableStaticElementAccessExpression, isBindableStaticNameExpression, - isBindingElement, isBindingPattern, isBlock, isBlockOrCatchScoped, isBlockScopedContainerTopLevel, isCallChain, - isCallExpression, isCallLikeExpression, isCallOrNewExpression, isCallSignatureDeclaration, isCatchClause, - isCatchClauseVariableDeclarationOrBindingElement, isCheckJsEnabledForFile, isChildOfNodeWithKind, - isClassDeclaration, isClassElement, isClassExpression, isClassLike, isClassStaticBlockDeclaration, isCommaSequence, - isCommonJsExportedExpression, isCommonJsExportPropertyAssignment, isComputedNonLiteralName, isComputedPropertyName, - isConstructorDeclaration, isConstructorTypeNode, isConstTypeReference, isDeclaration, isDeclarationName, - isDeclarationReadonly, isDecorator, isDefaultedExpandoInitializer, isDeleteTarget, isDottedName, isDynamicName, - isEffectiveExternalModule, isElementAccessExpression, isEntityName, isEntityNameExpression, isEnumConst, - isEnumDeclaration, isEnumMember, isExclusivelyTypeOnlyImportOrExport, isExportAssignment, isExportDeclaration, - isExportsIdentifier, isExportSpecifier, isExpression, isExpressionNode, isExpressionOfOptionalChainRoot, - isExpressionStatement, isExpressionWithTypeArguments, isExpressionWithTypeArgumentsInClassExtendsClause, - isExternalModule, isExternalModuleAugmentation, isExternalModuleImportEqualsDeclaration, isExternalModuleIndicator, - isExternalModuleNameRelative, isExternalModuleReference, isExternalOrCommonJsModule, isForInOrOfStatement, - isForInStatement, isForOfStatement, isForStatement, isFunctionDeclaration, isFunctionExpression, - isFunctionExpressionOrArrowFunction, isFunctionLike, isFunctionLikeDeclaration, - isFunctionLikeOrClassStaticBlockDeclaration, isFunctionOrModuleBlock, isFunctionTypeNode, isGeneratedIdentifier, - isGetAccessor, isGetAccessorDeclaration, isGetOrSetAccessorDeclaration, isGlobalScopeAugmentation, isHeritageClause, - isIdentifier, isIdentifierStart, isIdentifierText, isIdentifierTypePredicate, isIdentifierTypeReference, - isIfStatement, isImportCall, isImportClause, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, - isImportOrExportSpecifier, isImportSpecifier, isImportTypeNode, isIndexedAccessTypeNode, isInExpressionContext, - isInfinityOrNaNString, isInJSDoc, isInJSFile, isInJsonFile, isInterfaceDeclaration, - isInternalModuleImportEqualsDeclaration, isInTopLevelContext, isIntrinsicJsxName, isIterationStatement, - isJSDocAllType, isJSDocAugmentsTag, isJSDocCallbackTag, isJSDocConstructSignature, isJSDocFunctionType, - isJSDocIndexSignature, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, isJSDocNode, - isJSDocNonNullableType, isJSDocNullableType, isJSDocOptionalType, isJSDocParameterTag, isJSDocPropertyLikeTag, - isJSDocReturnTag, isJSDocSignature, isJSDocTemplateTag, isJSDocTypeAlias, isJSDocTypeAssertion, isJSDocTypedefTag, - isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, isJSDocUnknownType, isJSDocVariadicType, - isJsonSourceFile, isJsxAttribute, isJsxAttributeLike, isJsxAttributes, isJsxElement, isJsxOpeningElement, - isJsxOpeningFragment, isJsxOpeningLikeElement, isJsxSelfClosingElement, isJsxSpreadAttribute, isJSXTagName, - isKnownSymbol, isLateVisibilityPaintedStatement, isLeftHandSideExpression, isLet, isLineBreak, - isLiteralComputedPropertyDeclarationName, isLiteralExpressionOfObject, isLiteralImportTypeNode, isLiteralTypeNode, - isMetaProperty, isMethodDeclaration, isMethodSignature, isModifier, isModuleBlock, isModuleDeclaration, - isModuleExportsAccessExpression, isModuleIdentifier, isModuleOrEnumDeclaration, isModuleWithStringLiteralName, - isNamedDeclaration, isNamedExports, isNamedTupleMember, isNamespaceExport, isNamespaceExportDeclaration, - isNamespaceReexportDeclaration, isNewExpression, isNightly, isNodeDescendantOf, isNullishCoalesce, isNumericLiteral, - isNumericLiteralName, isObjectBindingPattern, isObjectLiteralElementLike, isObjectLiteralExpression, - isObjectLiteralMethod, isObjectLiteralOrClassExpressionMethodOrAccessor, isOmittedExpression, isOptionalChain, - isOptionalChainRoot, isOptionalJSDocPropertyLikeTag, isOptionalTypeNode, isOutermostOptionalChain, isParameter, - isParameterDeclaration, isParameterOrCatchClauseVariable, isParameterPropertyDeclaration, isParenthesizedExpression, - isParenthesizedTypeNode, isPartOfTypeNode, isPartOfTypeQuery, isPlainJsFile, isPrefixUnaryExpression, - isPrivateIdentifier, isPrivateIdentifierClassElementDeclaration, isPrivateIdentifierPropertyAccessExpression, - isPropertyAccessEntityNameExpression, isPropertyAccessExpression, isPropertyAccessOrQualifiedNameOrImportTypeNode, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertyNameLiteral, isPropertySignature, - isPrototypeAccess, isPrototypePropertyAssignment, isPushOrUnshiftIdentifier, isQualifiedName, isRequireCall, - isRestParameter, isRestTypeNode, isRightSideOfQualifiedNameOrPropertyAccess, - isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, isSameEntityName, isSetAccessor, - isShorthandAmbientModuleSymbol, isShorthandPropertyAssignment, isSingleOrDoubleQuote, isSourceFile, isSourceFileJS, - isSpreadAssignment, isSpreadElement, isStatement, isStatementWithLocals, isStatic, isString, - isStringANonContextualKeyword, isStringLiteral, isStringLiteralLike, isStringOrNumericLiteralLike, isSuperCall, - isSuperProperty, isTaggedTemplateExpression, isTemplateSpan, isThisContainerOrFunctionBlock, isThisIdentifier, - isThisInitializedDeclaration, isThisInitializedObjectBindingExpression, isThisInTypeQuery, isThisProperty, - isThisTypeParameter, isTransientSymbol, isTupleTypeNode, isTypeAlias, isTypeAliasDeclaration, isTypeDeclaration, - isTypeLiteralNode, isTypeNode, isTypeNodeKind, isTypeOfExpression, isTypeOnlyImportOrExportDeclaration, - isTypeOperatorNode, isTypeParameterDeclaration, isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, - isTypeReferenceType, isUMDExportSymbol, isValidESSymbolDeclaration, isValidTypeOnlyAliasUseSite, - isValueSignatureDeclaration, isVarConst, isVariableDeclaration, - isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableDeclarationInVariableStatement, - isVariableDeclarationList, isVariableLike, isVariableLikeOrAccessor, isVariableStatement, isWriteAccess, - isWriteOnlyAccess, IterableOrIteratorType, IterationTypes, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocComment, - JSDocContainer, JSDocEnumTag, JSDocFunctionType, JSDocImplementsTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, - JSDocMemberName, JSDocNullableType, JSDocOptionalType, JSDocParameterTag, JSDocPrivateTag, JSDocPropertyLikeTag, - JSDocPropertyTag, JSDocProtectedTag, JSDocPublicTag, JSDocSignature, JSDocTemplateTag, JSDocTypedefTag, - JSDocTypeExpression, JSDocTypeReferencingNode, JSDocTypeTag, JSDocVariadicType, JsxAttribute, JsxAttributeLike, - JsxAttributes, JsxChild, JsxClosingElement, JsxElement, JsxEmit, JsxExpression, JsxFlags, JsxFragment, - JsxOpeningElement, JsxOpeningFragment, JsxOpeningLikeElement, JsxReferenceKind, JsxSelfClosingElement, - JsxSpreadAttribute, JsxTagNameExpression, KeywordTypeNode, LabeledStatement, last, lastOrUndefined, - LateBoundBinaryExpressionDeclaration, LateBoundDeclaration, LateBoundName, LateVisibilityPaintedStatement, - LeftHandSideExpression, length, LiteralExpression, LiteralType, LiteralTypeNode, mangleScopedPackageName, map, - mapDefined, MappedSymbol, MappedType, MappedTypeNode, MatchingKeys, maybeBind, MemberName, MemberOverrideStatus, - memoize, MetaProperty, MethodDeclaration, MethodSignature, minAndMax, MinusToken, Modifier, ModifierFlags, - modifiersToFlags, modifierToFlag, ModuleBlock, ModuleDeclaration, ModuleInstanceState, ModuleKind, - ModuleResolutionKind, NamedDeclaration, NamedExports, NamedImportsOrExports, NamedTupleMember, - NamespaceDeclaration, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, needsScopeMarker, NewExpression, - Node, NodeArray, NodeBuilderFlags, nodeCanBeDecorated, NodeCheckFlags, NodeFlags, nodeHasName, nodeIsDecorated, - nodeIsMissing, nodeIsPresent, nodeIsSynthesized, NodeLinks, nodeStartsNewLexicalEnvironment, NodeWithTypeArguments, - NonNullChain, NonNullExpression, not, noTruncationMaximumTruncationLength, nullTransformationContext, - NumberLiteralType, NumericLiteral, objectAllocator, ObjectBindingPattern, ObjectFlags, ObjectFlagsType, - ObjectLiteralElementLike, ObjectLiteralExpression, ObjectType, OptionalChain, OptionalTypeNode, or, - orderedRemoveItemAt, OuterExpressionKinds, outFile, ParameterDeclaration, parameterIsThisKeyword, - ParameterPropertyDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, parseIsolatedEntityName, - parseNodeFactory, parsePseudoBigInt, Path, pathIsRelative, PatternAmbientModule, PlusToken, PostfixUnaryExpression, - PrefixUnaryExpression, PrivateIdentifier, Program, PromiseOrAwaitableType, PropertyAccessChain, - PropertyAccessEntityNameExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, - PropertySignature, PseudoBigInt, pseudoBigIntToString, pushIfUnique, QualifiedName, QuestionToken, rangeEquals, - rangeOfNode, rangeOfTypeParameters, ReadonlyKeyword, reduceLeft, RelationComparisonResult, - relativeComplement, removeExtension, removePrefix, replaceElement, resolutionExtensionIsTSOrJson, - ResolvedModuleFull, ResolvedType, resolveTripleslashReference, resolvingEmptyArray, RestTypeNode, ReturnStatement, - ReverseMappedSymbol, ReverseMappedType, sameMap, SatisfiesExpression, ScriptKind, ScriptTarget, - SetAccessorDeclaration, setCommentRange, setEmitFlags, setNodeFlags, setOriginalNode, setParent, - setSyntheticLeadingComments, setTextRange, setTextRangePosEnd, setValueDeclaration, ShorthandPropertyAssignment, - shouldPreserveConstEnums, Signature, SignatureDeclaration, SignatureFlags, SignatureKind, singleElementArray, - skipOuterExpressions, skipParentheses, skipTrivia, skipTypeChecking, some, SourceFile, SpreadAssignment, - SpreadElement, startsWith, Statement, stringContains, StringLiteral, StringLiteralLike, StringLiteralType, - StringMappingType, stripQuotes, StructuredType, SubstitutionType, sum, SuperCall, SwitchStatement, Symbol, - SymbolAccessibility, SymbolAccessibilityResult, SymbolFlags, SymbolFormatFlags, SymbolId, SymbolLinks, symbolName, - SymbolTable, SymbolTracker, SymbolVisibilityResult, SyntaxKind, SyntheticDefaultModuleType, SyntheticExpression, - TaggedTemplateExpression, TemplateExpression, TemplateLiteralType, TemplateLiteralTypeNode, Ternary, - textRangeContainsPositionInclusive, TextSpan, textSpanContainsPosition, textSpanEnd, ThisExpression, ThisTypeNode, - ThrowStatement, TokenFlags, tokenToString, tracing, TracingNode, TransientSymbol, tryAddToSet, tryCast, - tryExtractTSExtension, tryGetClassImplementingOrExtendingExpressionWithTypeArguments, tryGetExtensionFromPath, - tryGetModuleSpecifierFromDeclaration, tryGetPropertyAccessOrIdentifierToString, TryStatement, TupleType, - TupleTypeNode, TupleTypeReference, Type, TypeAliasDeclaration, TypeAssertion, TypeChecker, TypeCheckerHost, - TypeComparer, TypeElement, TypeFlags, TypeFormatFlags, TypeId, TypeLiteralNode, TypeMapKind, TypeMapper, TypeNode, - TypeNodeSyntaxKind, TypeOfExpression, TypeOnlyAliasDeclaration, TypeOnlyCompatibleAliasDeclaration, - TypeOperatorNode, TypeParameter, TypeParameterDeclaration, TypePredicate, TypePredicateKind, TypePredicateNode, - TypeQueryNode, TypeReference, TypeReferenceNode, TypeReferenceSerializationKind, TypeReferenceType, TypeVariable, - UnaryExpression, UnderscoreEscapedMap, unescapeLeadingUnderscores, UnionOrIntersectionType, - UnionOrIntersectionTypeNode, UnionReduction, UnionType, UnionTypeNode, UniqueESSymbolType, - usingSingleLineStringWriter, VariableDeclaration, VariableDeclarationList, VariableLikeDeclaration, - VariableStatement, VarianceFlags, visitEachChild, visitNode, visitNodes, Visitor, VisitResult, VoidExpression, - walkUpBindingElementsAndPatterns, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, - walkUpParenthesizedTypesAndGetParentAndChild, WhileStatement, WideningContext, WithStatement, YieldExpression, ResolutionMode, + AccessExpression, + AccessFlags, + AccessorDeclaration, + AllAccessorDeclarations, + AnonymousType, + AnyImportOrReExport, + AnyImportSyntax, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AssertionExpression, + AssignmentDeclarationKind, + AssignmentKind, + AssignmentPattern, + AwaitExpression, + BaseType, + BigIntLiteral, + BigIntLiteralType, + BinaryExpression, + BinaryOperatorToken, + BindableObjectDefinePropertyCall, + BindingElement, + BindingElementGrandparent, + BindingName, + BindingPattern, + Block, + BreakOrContinueStatement, + CallChain, + CallExpression, + CallLikeExpression, + CallSignatureDeclaration, + CancellationToken, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CharacterCodes, + CheckFlags, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + Comparison, + CompilerOptions, + ComputedPropertyName, + ConditionalExpression, + ConditionalRoot, + ConditionalType, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + ContextFlags, + Debug, + Declaration, + DeclarationName, + DeclarationStatement, + DeclarationWithTypeParameterChildren, + DeclarationWithTypeParameters, + Decorator, + DefaultClause, + DeferredTypeReference, + DeleteExpression, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + DiagnosticWithLocation, + Diagnostics, + DoStatement, + DynamicNamedDeclaration, + ElementAccessChain, + ElementAccessExpression, + ElementFlags, + EmitFlags, + EmitHint, + EmitResolver, + EmitTextWriter, + EntityName, + EntityNameExpression, + EntityNameOrEntityNameExpression, + EnumDeclaration, + EnumMember, + EvolvingArrayType, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalEmitHelpers, + FlowArrayMutation, + FlowAssignment, + FlowCall, + FlowCondition, + FlowFlags, + FlowLabel, + FlowNode, + FlowReduceLabel, + FlowStart, + FlowSwitchClause, + FlowType, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FreshObjectLiteralType, + FreshableIntrinsicType, + FreshableType, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + FunctionTypeNode, + GenericType, + GetAccessorDeclaration, + HasDecorators, + HasExpressionInitializer, + HasIllegalDecorators, + HasIllegalModifiers, + HasInitializer, + HasModifiers, + HeritageClause, + Identifier, + IdentifierTypePredicate, + IfStatement, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + ImportsNotUsedAsValues, + IncompleteType, + IndexInfo, + IndexKind, + IndexSignatureDeclaration, + IndexType, + IndexedAccessType, + IndexedAccessTypeNode, + InferTypeNode, + InferenceContext, + InferenceFlags, + InferenceInfo, + InferencePriority, + InstantiableType, + InstantiationExpressionType, + InterfaceDeclaration, + InterfaceType, + InterfaceTypeWithDeclaredMembers, + InternalSymbolName, + IntersectionType, + IntersectionTypeNode, + IntrinsicType, + IterableOrIteratorType, + IterationTypes, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocContainer, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNullableType, + JSDocOptionalType, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocSignature, + JSDocTemplateTag, + JSDocTypeExpression, + JSDocTypeReferencingNode, + JSDocTypeTag, + JSDocTypedefTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributes, + JsxChild, + JsxClosingElement, + JsxElement, + JsxEmit, + JsxExpression, + JsxFlags, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxReferenceKind, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + KeywordTypeNode, + LabeledStatement, + LateBoundBinaryExpressionDeclaration, + LateBoundDeclaration, + LateBoundName, + LateVisibilityPaintedStatement, + LeftHandSideExpression, + LiteralExpression, + LiteralType, + LiteralTypeNode, + MappedSymbol, + MappedType, + MappedTypeNode, + MatchingKeys, + MemberName, + MemberOverrideStatus, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + Modifier, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + ModuleInstanceState, + ModuleKind, + ModuleResolutionKind, + NamedDeclaration, + NamedExports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceDeclaration, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeBuilderFlags, + NodeCheckFlags, + NodeFlags, + NodeLinks, + NodeWithTypeArguments, + NonNullChain, + NonNullExpression, + NumberLiteralType, + NumericLiteral, + ObjectBindingPattern, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ObjectType, + OptionalChain, + OptionalTypeNode, + OuterExpressionKinds, + ParameterDeclaration, + ParameterPropertyDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + Path, + PatternAmbientModule, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PromiseOrAwaitableType, + PropertyAccessChain, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + PseudoBigInt, + QualifiedName, + QuestionToken, + ReadonlyKeyword, + RelationComparisonResult, + ResolutionMode, + ResolvedModuleFull, + ResolvedType, + RestTypeNode, + ReturnStatement, + ReverseMappedSymbol, + ReverseMappedType, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SourceFile, + SpreadAssignment, + SpreadElement, + Statement, + StringLiteral, + StringLiteralLike, + StringLiteralType, + StringMappingType, + StructuredType, + SubstitutionType, + SuperCall, + SwitchStatement, + Symbol, + SymbolAccessibility, + SymbolAccessibilityResult, + SymbolFlags, + SymbolFormatFlags, + SymbolId, + SymbolLinks, + SymbolTable, + SymbolTracker, + SymbolVisibilityResult, + SyntaxKind, + SyntheticDefaultModuleType, + SyntheticExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralType, + TemplateLiteralTypeNode, + Ternary, + TextSpan, + ThisExpression, + ThisTypeNode, + ThrowStatement, + TokenFlags, + TracingNode, + TransientSymbol, + TryStatement, + TupleType, + TupleTypeNode, + TupleTypeReference, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeCheckerHost, + TypeComparer, + TypeElement, + TypeFlags, + TypeFormatFlags, + TypeId, + TypeLiteralNode, + TypeMapKind, + TypeMapper, + TypeNode, + TypeNodeSyntaxKind, + TypeOfExpression, + TypeOnlyAliasDeclaration, + TypeOnlyCompatibleAliasDeclaration, + TypeOperatorNode, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypePredicateNode, + TypeQueryNode, + TypeReference, + TypeReferenceNode, + TypeReferenceSerializationKind, + TypeReferenceType, + TypeVariable, + UnaryExpression, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionOrIntersectionTypeNode, + UnionReduction, + UnionType, + UnionTypeNode, + UniqueESSymbolType, + VariableDeclaration, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + VarianceFlags, + VisitResult, + Visitor, + VoidExpression, + WhileStatement, + WideningContext, + WithStatement, + YieldExpression, + __String, + addRange, + addRelatedInfo, + addSyntheticLeadingComment, + and, + append, + appendIfUnique, + arrayFrom, + arrayIsHomogeneous, + arrayOf, + arrayToMultiMap, + arraysEqual, + binarySearch, + bindSourceFile, + canHaveDecorators, + canHaveExportModifier, + canHaveIllegalDecorators, + canHaveIllegalModifiers, + canHaveModifiers, + cartesianProduct, + cast, + chainDiagnosticMessages, + clear, + combinePaths, + compareDiagnostics, + comparePaths, + compareValues, + concatenate, + concatenateDiagnosticMessageChains, + contains, + containsParseError, + copyEntries, + countWhere, + createBinaryExpressionTrampoline, + createCompilerDiagnostic, + createDiagnosticCollection, + createDiagnosticForFileFromMessageChain, + createDiagnosticForNode, + createDiagnosticForNodeArray, + createDiagnosticForNodeFromMessageChain, + createDiagnosticMessageChainFromDiagnostic, + createEmptyExports, + createFileDiagnostic, + createGetCanonicalFileName, + createGetSymbolWalker, + createPrinter, + createPropertyNameNodeForIdentifierOrLiteral, + createScanner, + createSymbolTable, + createTextWriter, + createUnderscoreEscapedMultiMap, + declarationNameToString, + deduplicate, + defaultMaximumTruncationLength, + emptyArray, + endsWith, + entityNameToString, + equateValues, + escapeLeadingUnderscores, + escapeString, + every, + exportAssignmentIsAlias, + expressionResultIsUnused, + externalHelpersModuleNameText, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + find, + findAncestor, + findBestPatternMatch, + findIndex, + findLast, + findLastIndex, + findUseStrictPrologue, + first, + firstDefined, + firstOrUndefined, + flatMap, + flatten, + forEach, + forEachChild, + forEachChildRecursively, + forEachEnclosingBlockScopeContainer, + forEachEntry, + forEachImportClauseDeclaration, + forEachKey, + forEachReturnStatement, + forEachYieldExpression, + formatMessage, + getAliasDeclarationFromName, + getAllAccessorDeclarations, + getAllowSyntheticDefaultImports, + getAncestor, + getAssignedExpandoInitializer, + getAssignmentDeclarationKind, + getAssignmentDeclarationPropertyAccessKind, + getAssignmentTargetKind, + getCheckFlags, + getClassExtendsHeritageElement, + getClassLikeDeclarationOfSymbol, + getCombinedLocalAndExportSymbolFlags, + getCombinedModifierFlags, + getCombinedNodeFlags, + getContainingClass, + getContainingFunction, + getContainingFunctionOrClassStaticBlock, + getDeclarationModifierFlagsFromSymbol, + getDeclarationOfKind, + getDeclarationsOfKind, + getDeclaredExpandoInitializer, + getDirectoryPath, + getESModuleInterop, + getEffectiveBaseTypeNode, + getEffectiveConstraintOfTypeParameter, + getEffectiveContainerForJSDocTemplateTag, + getEffectiveImplementsTypeNodes, + getEffectiveInitializer, + getEffectiveJSDocHost, + getEffectiveModifierFlags, + getEffectiveReturnTypeNode, + getEffectiveSetAccessorTypeAnnotationNode, + getEffectiveTypeAnnotationNode, + getEffectiveTypeParameterDeclarations, + getElementOrPropertyAccessName, + getEmitDeclarations, + getEmitModuleKind, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getEnclosingBlockScopeContainer, + getEntityNameFromTypeNode, + getEntries, + getErrorSpanForNode, + getEscapedTextOfIdentifierOrLiteral, + getExpandoInitializer, + getExportAssignmentExpression, + getExternalModuleImportEqualsDeclarationExpression, + getExternalModuleName, + getExternalModuleRequireArgument, + getFirstConstructorWithBody, + getFirstIdentifier, + getFunctionFlags, + getHostSignatureFromJSDoc, + getImmediatelyInvokedFunctionExpression, + getInitializerOfBinaryExpression, + getInterfaceBaseTypeNodes, + getInvokedExpression, + getJSDocClassTag, + getJSDocDeprecatedTag, + getJSDocEnumTag, + getJSDocHost, + getJSDocParameterTags, + getJSDocRoot, + getJSDocTags, + getJSDocThisTag, + getJSDocType, + getJSDocTypeAssertionType, + getJSDocTypeParameterDeclarations, + getJSDocTypeTag, + getJSXImplicitImportBase, + getJSXRuntimeImport, + getJSXTransformEnabled, + getLeftmostAccessExpression, + getLineAndCharacterOfPosition, + getLocalSymbolForExportDefault, + getMembersOfDeclaration, + getModeForUsageLocation, + getModifiers, + getModuleInstanceState, + getNameFromIndexInfo, + getNameOfDeclaration, + getNameOfExpando, + getNamespaceDeclarationNode, + getNewTargetContainer, + getNonAugmentationDeclaration, + getNormalizedAbsolutePath, + getObjectFlags, + getOrUpdate, + getOriginalNode, + getOwnKeys, + getParameterSymbolFromJSDoc, + getParseTreeNode, + getPropertyAssignmentAliasLikeExpression, + getPropertyNameForPropertyNameNode, + getResolutionDiagnostic, + getResolutionModeOverrideForClause, + getResolvedExternalModuleName, + getResolvedModule, + getRestParameterElementType, + getRootDeclaration, + getScriptTargetFeatures, + getSelectedEffectiveModifierFlags, + getSemanticJsxChildren, + getSetAccessorValueParameter, + getSingleVariableOfVariableStatement, + getSourceFileOfModule, + getSourceFileOfNode, + getSpanOfTokenAtPosition, + getSpellingSuggestion, + getStrictOptionValue, + getSuperContainer, + getSymbolNameForPrivateIdentifier, + getTextOfIdentifierOrLiteral, + getTextOfJSDocComment, + getTextOfNode, + getTextOfPropertyName, + getThisContainer, + getThisParameter, + getTrailingSemicolonDeferringWriter, + getTypeParameterFromJsDoc, + getTypesPackageName, + getUseDefineForClassFields, + group, + hasAbstractModifier, + hasAccessorModifier, + hasAmbientModifier, + hasContextSensitiveParameters, + hasDecorators, + hasDynamicName, + hasEffectiveModifier, + hasEffectiveModifiers, + hasEffectiveReadonlyModifier, + hasExtension, + hasInitializer, + hasJSDocNodes, + hasJSDocParameterTags, + hasJsonModuleEmitEnabled, + hasOnlyExpressionInitializer, + hasOverrideModifier, + hasPossibleExternalModuleReference, + hasQuestionToken, + hasRestParameter, + hasScopeMarker, + hasStaticModifier, + hasSyntacticModifier, + hasSyntacticModifiers, + idText, + indexOfNode, + indicesOf, + introducesArgumentsExoticObject, + isAccessExpression, + isAccessor, + isAliasableExpression, + isAmbientModule, + isArray, + isArrayBindingPattern, + isArrayLiteralExpression, + isArrowFunction, + isAssertionExpression, + isAssignmentDeclaration, + isAssignmentExpression, + isAssignmentOperator, + isAssignmentPattern, + isAssignmentTarget, + isAsyncFunction, + isAutoAccessorPropertyDeclaration, + isBinaryExpression, + isBindableObjectDefinePropertyCall, + isBindableStaticElementAccessExpression, + isBindableStaticNameExpression, + isBindingElement, + isBindingPattern, + isBlock, + isBlockOrCatchScoped, + isBlockScopedContainerTopLevel, + isCallChain, + isCallExpression, + isCallLikeExpression, + isCallOrNewExpression, + isCallSignatureDeclaration, + isCatchClause, + isCatchClauseVariableDeclarationOrBindingElement, + isCheckJsEnabledForFile, + isChildOfNodeWithKind, + isClassDeclaration, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isCommaSequence, + isCommonJsExportPropertyAssignment, + isCommonJsExportedExpression, + isComputedNonLiteralName, + isComputedPropertyName, + isConstTypeReference, + isConstructorDeclaration, + isConstructorTypeNode, + isDeclaration, + isDeclarationName, + isDeclarationReadonly, + isDecorator, + isDefaultedExpandoInitializer, + isDeleteTarget, + isDottedName, + isDynamicName, + isEffectiveExternalModule, + isElementAccessExpression, + isEntityName, + isEntityNameExpression, + isEnumConst, + isEnumDeclaration, + isEnumMember, + isExclusivelyTypeOnlyImportOrExport, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isExportsIdentifier, + isExpression, + isExpressionNode, + isExpressionOfOptionalChainRoot, + isExpressionStatement, + isExpressionWithTypeArguments, + isExpressionWithTypeArgumentsInClassExtendsClause, + isExternalModule, + isExternalModuleAugmentation, + isExternalModuleImportEqualsDeclaration, + isExternalModuleIndicator, + isExternalModuleNameRelative, + isExternalModuleReference, + isExternalOrCommonJsModule, + isForInOrOfStatement, + isForInStatement, + isForOfStatement, + isForStatement, + isFunctionDeclaration, + isFunctionExpression, + isFunctionExpressionOrArrowFunction, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeOrClassStaticBlockDeclaration, + isFunctionOrModuleBlock, + isFunctionTypeNode, + isGeneratedIdentifier, + isGetAccessor, + isGetAccessorDeclaration, + isGetOrSetAccessorDeclaration, + isGlobalScopeAugmentation, + isHeritageClause, + isIdentifier, + isIdentifierStart, + isIdentifierText, + isIdentifierTypePredicate, + isIdentifierTypeReference, + isIfStatement, + isImportCall, + isImportClause, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isImportOrExportSpecifier, + isImportSpecifier, + isImportTypeNode, + isInExpressionContext, + isInJSDoc, + isInJSFile, + isInJsonFile, + isInTopLevelContext, + isIndexedAccessTypeNode, + isInfinityOrNaNString, + isInterfaceDeclaration, + isInternalModuleImportEqualsDeclaration, + isIntrinsicJsxName, + isIterationStatement, + isJSDocAllType, + isJSDocAugmentsTag, + isJSDocCallbackTag, + isJSDocConstructSignature, + isJSDocFunctionType, + isJSDocIndexSignature, + isJSDocLinkLike, + isJSDocMemberName, + isJSDocNameReference, + isJSDocNode, + isJSDocNonNullableType, + isJSDocNullableType, + isJSDocOptionalType, + isJSDocParameterTag, + isJSDocPropertyLikeTag, + isJSDocReturnTag, + isJSDocSignature, + isJSDocTemplateTag, + isJSDocTypeAlias, + isJSDocTypeAssertion, + isJSDocTypeExpression, + isJSDocTypeLiteral, + isJSDocTypeTag, + isJSDocTypedefTag, + isJSDocUnknownType, + isJSDocVariadicType, + isJSXTagName, + isJsonSourceFile, + isJsxAttribute, + isJsxAttributeLike, + isJsxAttributes, + isJsxElement, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxOpeningLikeElement, + isJsxSelfClosingElement, + isJsxSpreadAttribute, + isKnownSymbol, + isLateVisibilityPaintedStatement, + isLeftHandSideExpression, + isLet, + isLineBreak, + isLiteralComputedPropertyDeclarationName, + isLiteralExpressionOfObject, + isLiteralImportTypeNode, + isLiteralTypeNode, + isMetaProperty, + isMethodDeclaration, + isMethodSignature, + isModifier, + isModuleBlock, + isModuleDeclaration, + isModuleExportsAccessExpression, + isModuleIdentifier, + isModuleOrEnumDeclaration, + isModuleWithStringLiteralName, + isNamedDeclaration, + isNamedExports, + isNamedTupleMember, + isNamespaceExport, + isNamespaceExportDeclaration, + isNamespaceReexportDeclaration, + isNewExpression, + isNightly, + isNodeDescendantOf, + isNullishCoalesce, + isNumericLiteral, + isNumericLiteralName, + isObjectBindingPattern, + isObjectLiteralElementLike, + isObjectLiteralExpression, + isObjectLiteralMethod, + isObjectLiteralOrClassExpressionMethodOrAccessor, + isOmittedExpression, + isOptionalChain, + isOptionalChainRoot, + isOptionalJSDocPropertyLikeTag, + isOptionalTypeNode, + isOutermostOptionalChain, + isParameter, + isParameterDeclaration, + isParameterOrCatchClauseVariable, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isParenthesizedTypeNode, + isPartOfTypeNode, + isPartOfTypeQuery, + isPlainJsFile, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPrivateIdentifierPropertyAccessExpression, + isPropertyAccessEntityNameExpression, + isPropertyAccessExpression, + isPropertyAccessOrQualifiedNameOrImportTypeNode, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isPropertyNameLiteral, + isPropertySignature, + isPrototypeAccess, + isPrototypePropertyAssignment, + isPushOrUnshiftIdentifier, + isQualifiedName, + isRequireCall, + isRestParameter, + isRestTypeNode, + isRightSideOfQualifiedNameOrPropertyAccess, + isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName, + isSameEntityName, + isSetAccessor, + isShorthandAmbientModuleSymbol, + isShorthandPropertyAssignment, + isSingleOrDoubleQuote, + isSourceFile, + isSourceFileJS, + isSpreadAssignment, + isSpreadElement, + isStatement, + isStatementWithLocals, + isStatic, + isString, + isStringANonContextualKeyword, + isStringLiteral, + isStringLiteralLike, + isStringOrNumericLiteralLike, + isSuperCall, + isSuperProperty, + isTaggedTemplateExpression, + isTemplateSpan, + isThisContainerOrFunctionBlock, + isThisIdentifier, + isThisInTypeQuery, + isThisInitializedDeclaration, + isThisInitializedObjectBindingExpression, + isThisProperty, + isThisTypeParameter, + isTransientSymbol, + isTupleTypeNode, + isTypeAlias, + isTypeAliasDeclaration, + isTypeDeclaration, + isTypeLiteralNode, + isTypeNode, + isTypeNodeKind, + isTypeOfExpression, + isTypeOnlyImportOrExportDeclaration, + isTypeOperatorNode, + isTypeParameterDeclaration, + isTypePredicateNode, + isTypeQueryNode, + isTypeReferenceNode, + isTypeReferenceType, + isUMDExportSymbol, + isValidESSymbolDeclaration, + isValidTypeOnlyAliasUseSite, + isValueSignatureDeclaration, + isVarConst, + isVariableDeclaration, + isVariableDeclarationInVariableStatement, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableDeclarationList, + isVariableLike, + isVariableLikeOrAccessor, + isVariableStatement, + isWriteAccess, + isWriteOnlyAccess, + last, + lastOrUndefined, + length, + mangleScopedPackageName, + map, + mapDefined, + maybeBind, + memoize, + minAndMax, + modifierToFlag, + modifiersToFlags, + needsScopeMarker, + noTruncationMaximumTruncationLength, + nodeCanBeDecorated, + nodeHasName, + nodeIsDecorated, + nodeIsMissing, + nodeIsPresent, + nodeIsSynthesized, + nodeStartsNewLexicalEnvironment, + not, + nullTransformationContext, + objectAllocator, + or, + orderedRemoveItemAt, + outFile, + parameterIsThisKeyword, + parseIsolatedEntityName, + parseNodeFactory, + parsePseudoBigInt, + pathIsRelative, + pseudoBigIntToString, + pushIfUnique, + rangeEquals, + rangeOfNode, + rangeOfTypeParameters, + reduceLeft, + relativeComplement, + removeExtension, + removePrefix, + replaceElement, + resolutionExtensionIsTSOrJson, + resolveTripleslashReference, + resolvingEmptyArray, + sameMap, + setCommentRange, + setEmitFlags, + setNodeFlags, + setOriginalNode, + setParent, + setSyntheticLeadingComments, + setTextRange, + setTextRangePosEnd, + setValueDeclaration, + shouldPreserveConstEnums, + singleElementArray, + skipOuterExpressions, + skipParentheses, + skipTrivia, + skipTypeChecking, + some, + startsWith, + stringContains, + stripQuotes, + sum, + symbolName, + textRangeContainsPositionInclusive, + textSpanContainsPosition, + textSpanEnd, + tokenToString, + tracing, + tryAddToSet, + tryCast, + tryExtractTSExtension, + tryGetClassImplementingOrExtendingExpressionWithTypeArguments, + tryGetExtensionFromPath, + tryGetModuleSpecifierFromDeclaration, + tryGetPropertyAccessOrIdentifierToString, + unescapeLeadingUnderscores, + usingSingleLineStringWriter, + visitEachChild, + visitNode, + visitNodes, + walkUpBindingElementsAndPatterns, + walkUpParenthesizedExpressions, + walkUpParenthesizedTypes, + walkUpParenthesizedTypesAndGetParentAndChild, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers"; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a9e808dadee17..55db718e997a2 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,24 +1,123 @@ import { - AlternateModeDiagnostics, append, arrayFrom, ArrayLiteralExpression, arrayToMap, assign, BuildOptions, - changeExtension, CharacterCodes, combinePaths, CommandLineOption, CommandLineOptionOfCustomType, - CommandLineOptionOfListType, CompilerOptions, CompilerOptionsValue, ConfigFileSpecs, containsPath, - convertToRelativePath, createCompilerDiagnostic, createDiagnosticForNodeInSourceFile, createGetCanonicalFileName, - Debug, Diagnostic, DiagnosticMessage, Diagnostics, DidYouMeanOptionsDiagnostics, directorySeparator, emptyArray, - endsWith, ensureTrailingDirectorySeparator, every, Expression, extend, Extension, FileExtensionInfo, - fileExtensionIs, fileExtensionIsOneOf, filter, filterMutate, find, findIndex, firstDefined, flatten, forEach, - forEachEntry, getBaseFileName, getDirectoryPath, getEntries, getFileMatcherPatterns, getLocaleSpecificMessage, - getNormalizedAbsolutePath, getRegexFromPattern, getRegularExpressionForWildcard, getRegularExpressionsForWildcards, - getRelativePathFromFile, getSpellingSuggestion, getSupportedExtensions, - getSupportedExtensionsWithJsonIfResolveJsonModule, getTextOfPropertyName, getTsConfigPropArray, - getTsConfigPropArrayElementValue, hasExtension, hasProperty, ImportsNotUsedAsValues, isArray, - isArrayLiteralExpression, isComputedNonLiteralName, isImplicitGlob, isObjectLiteralExpression, isRootedDiskPath, - isString, isStringDoubleQuoted, isStringLiteral, JsonSourceFile, JsxEmit, length, map, mapDefined, mapIterator, - MapLike, ModuleDetectionKind, ModuleKind, ModuleResolutionKind, NewLineKind, Node, NodeArray, - nodeModuleNameResolver, normalizePath, normalizeSlashes, NumericLiteral, ObjectLiteralExpression, ParseConfigHost, - ParsedCommandLine, parseJsonText, Path, PollingWatchKind, PrefixUnaryExpression, ProjectReference, PropertyName, - Push, removeTrailingDirectorySeparator, returnTrue, ScriptTarget, startsWith, StringLiteral, SyntaxKind, sys, - toFileNameLowerCase, toPath, tracing, trimString, TsConfigOnlyOption, TsConfigSourceFile, TypeAcquisition, - unescapeLeadingUnderscores, WatchDirectoryFlags, WatchDirectoryKind, WatchFileKind, WatchOptions, + AlternateModeDiagnostics, + ArrayLiteralExpression, + BuildOptions, + CharacterCodes, + CommandLineOption, + CommandLineOptionOfCustomType, + CommandLineOptionOfListType, + CompilerOptions, + CompilerOptionsValue, + ConfigFileSpecs, + Debug, + Diagnostic, + DiagnosticMessage, + Diagnostics, + DidYouMeanOptionsDiagnostics, + Expression, + Extension, + FileExtensionInfo, + ImportsNotUsedAsValues, + JsonSourceFile, + JsxEmit, + MapLike, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, + NewLineKind, + Node, + NodeArray, + NumericLiteral, + ObjectLiteralExpression, + ParseConfigHost, + ParsedCommandLine, + Path, + PollingWatchKind, + PrefixUnaryExpression, + ProjectReference, + PropertyName, + Push, + ScriptTarget, + StringLiteral, + SyntaxKind, + TsConfigOnlyOption, + TsConfigSourceFile, + TypeAcquisition, + WatchDirectoryFlags, + WatchDirectoryKind, + WatchFileKind, + WatchOptions, + append, + arrayFrom, + arrayToMap, + assign, + changeExtension, + combinePaths, + containsPath, + convertToRelativePath, + createCompilerDiagnostic, + createDiagnosticForNodeInSourceFile, + createGetCanonicalFileName, + directorySeparator, + emptyArray, + endsWith, + ensureTrailingDirectorySeparator, + every, + extend, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + filterMutate, + find, + findIndex, + firstDefined, + flatten, + forEach, + forEachEntry, + getBaseFileName, + getDirectoryPath, + getEntries, + getFileMatcherPatterns, + getLocaleSpecificMessage, + getNormalizedAbsolutePath, + getRegexFromPattern, + getRegularExpressionForWildcard, + getRegularExpressionsForWildcards, + getRelativePathFromFile, + getSpellingSuggestion, + getSupportedExtensions, + getSupportedExtensionsWithJsonIfResolveJsonModule, + getTextOfPropertyName, + getTsConfigPropArray, + getTsConfigPropArrayElementValue, + hasExtension, + hasProperty, + isArray, + isArrayLiteralExpression, + isComputedNonLiteralName, + isImplicitGlob, + isObjectLiteralExpression, + isRootedDiskPath, + isString, + isStringDoubleQuoted, + isStringLiteral, + length, + map, + mapDefined, + mapIterator, + nodeModuleNameResolver, + normalizePath, + normalizeSlashes, + parseJsonText, + removeTrailingDirectorySeparator, + returnTrue, + startsWith, + sys, + toFileNameLowerCase, + toPath, + tracing, + trimString, + unescapeLeadingUnderscores, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 73f6076a21bda..d256371dbbf16 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,7 +1,18 @@ import { - __String, CharacterCodes, Comparer, Comparison, Debug, EqualityComparer, isWhiteSpaceLike, - MapLike, Push, Queue, SortedArray, SortedReadonlyArray, TextSpan, + CharacterCodes, + Comparer, + Comparison, + Debug, + EqualityComparer, + MapLike, + Push, + Queue, + SortedArray, + SortedReadonlyArray, + TextSpan, UnderscoreEscapedMap, + __String, + isWhiteSpaceLike, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index f649a246c9424..f0eb1166c6026 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -1,19 +1,95 @@ import * as ts from "./_namespaces/ts"; import { - AnyFunction, AssertionLevel, BigIntLiteralType, CheckMode, compareValues, EmitFlags, every, FlowFlags, FlowLabel, FlowNode, - FlowNodeBase, FlowSwitchClause, getEffectiveModifierFlagsNoCache, getEmitFlags, getOwnKeys, - getParseTreeNode, getSourceFileOfNode, getSourceTextOfNodeFromSourceFile, hasProperty, idText, IntrinsicType, - isArrayTypeNode, isBigIntLiteral, isCallSignatureDeclaration, isConditionalTypeNode, isConstructorDeclaration, - isConstructorTypeNode, isConstructSignatureDeclaration, isDefaultClause, isFunctionTypeNode, isGeneratedIdentifier, - isGetAccessorDeclaration, isIdentifier, isImportTypeNode, isIndexedAccessTypeNode, isIndexSignatureDeclaration, - isInferTypeNode, isIntersectionTypeNode, isLiteralTypeNode, isMappedTypeNode, isNamedTupleMember, isNumericLiteral, - isOptionalTypeNode, isParameter, isParenthesizedTypeNode, isParseTreeNode, isPrivateIdentifier, isRestTypeNode, - isSetAccessorDeclaration, isStringLiteral, isThisTypeNode, isTupleTypeNode, isTypeLiteralNode, isTypeOperatorNode, - isTypeParameterDeclaration, isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, isUnionTypeNode, LiteralType, - map, MatchingKeys, ModifierFlags, Node, NodeArray, NodeFlags, nodeIsSynthesized, noop, objectAllocator, - ObjectFlags, ObjectType, RelationComparisonResult, Signature, SignatureCheckMode, - SignatureFlags, SnippetKind, SortedReadonlyArray, stableSort, Symbol, SymbolFlags, symbolName, SyntaxKind, - TransformFlags, Type, TypeFacts, TypeFlags, TypeMapKind, TypeMapper, unescapeLeadingUnderscores, VarianceFlags, + AnyFunction, + AssertionLevel, + BigIntLiteralType, + CheckMode, + EmitFlags, + FlowFlags, + FlowLabel, + FlowNode, + FlowNodeBase, + FlowSwitchClause, + IntrinsicType, + LiteralType, + MatchingKeys, + ModifierFlags, + Node, + NodeArray, + NodeFlags, + ObjectFlags, + ObjectType, + RelationComparisonResult, + Signature, + SignatureCheckMode, + SignatureFlags, + SnippetKind, + SortedReadonlyArray, + Symbol, + SymbolFlags, + SyntaxKind, + TransformFlags, + Type, + TypeFacts, + TypeFlags, + TypeMapKind, + TypeMapper, + VarianceFlags, + compareValues, + every, + getEffectiveModifierFlagsNoCache, + getEmitFlags, + getOwnKeys, + getParseTreeNode, + getSourceFileOfNode, + getSourceTextOfNodeFromSourceFile, + hasProperty, + idText, + isArrayTypeNode, + isBigIntLiteral, + isCallSignatureDeclaration, + isConditionalTypeNode, + isConstructSignatureDeclaration, + isConstructorDeclaration, + isConstructorTypeNode, + isDefaultClause, + isFunctionTypeNode, + isGeneratedIdentifier, + isGetAccessorDeclaration, + isIdentifier, + isImportTypeNode, + isIndexSignatureDeclaration, + isIndexedAccessTypeNode, + isInferTypeNode, + isIntersectionTypeNode, + isLiteralTypeNode, + isMappedTypeNode, + isNamedTupleMember, + isNumericLiteral, + isOptionalTypeNode, + isParameter, + isParenthesizedTypeNode, + isParseTreeNode, + isPrivateIdentifier, + isRestTypeNode, + isSetAccessorDeclaration, + isStringLiteral, + isThisTypeNode, + isTupleTypeNode, + isTypeLiteralNode, + isTypeOperatorNode, + isTypeParameterDeclaration, + isTypePredicateNode, + isTypeQueryNode, + isTypeReferenceNode, + isUnionTypeNode, + map, + nodeIsSynthesized, + noop, + objectAllocator, + stableSort, + symbolName, + unescapeLeadingUnderscores, zipWith, } from "./_namespaces/ts"; diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index ebc9bcaec9917..daaa68073ea77 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1,83 +1,447 @@ import * as ts from "./_namespaces/ts"; import { - AccessorDeclaration, ArrayBindingPattern, ArrayLiteralExpression, arrayToMap, ArrayTypeNode, ArrowFunction, - AsExpression, AssertClause, AssertEntry, AwaitExpression, base64encode, BigIntLiteral, BinaryExpression, - BinaryOperatorToken, BindingElement, BindingPattern, Block, BlockLike, BreakStatement, BuildInfo, Bundle, - BundleBuildInfo, BundleFileInfo, BundleFileSectionKind, BundleFileTextLike, BundleFileTextLikeKind, CallExpression, - CallSignatureDeclaration, CaseBlock, CaseClause, CaseOrDefaultClause, cast, CatchClause, changeExtension, - CharacterCodes, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, clone, combinePaths, - CommaListExpression, CommentRange, compareEmitHelpers, comparePaths, Comparison, CompilerHost, CompilerOptions, - computeCommonSourceDirectoryOfFilenames, ComputedPropertyName, computeLineStarts, computeSignature, - ConditionalExpression, ConditionalTypeNode, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, contains, ContinueStatement, createBinaryExpressionTrampoline, - createDiagnosticCollection, createGetCanonicalFileName, createInputFilesWithFileTexts, createMultiMap, - createPrependNodes, createSourceMapGenerator, createTextWriter, CustomTransformers, Debug, DebuggerStatement, - DeclarationName, Decorator, DefaultClause, DeleteExpression, directorySeparator, DoStatement, DotToken, - ElementAccessExpression, emitDetachedComments, EmitFileNames, EmitFlags, EmitHint, EmitHost, - emitNewLineBeforeLeadingCommentOfPosition, EmitOnly, EmitResolver, EmitResult, EmitTextWriter, EmitTransformers, - emptyArray, ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, EntityName, EnumDeclaration, EnumMember, - escapeJsxAttributeString, escapeLeadingUnderscores, escapeNonAsciiString, escapeString, every, - ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, ExpressionWithTypeArguments, - Extension, ExternalModuleReference, factory, fileExtensionIs, fileExtensionIsOneOf, FileReference, filter, - findIndex, firstOrUndefined, forEach, forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, - ForInOrOfStatement, ForInStatement, formatGeneratedName, formatGeneratedNamePart, ForOfStatement, ForStatement, - FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, FunctionTypeNode, GeneratedIdentifier, - GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, getAreDeclarationMapsEnabled, - getBaseFileName, GetCanonicalFileName, getCommentRange, getConstantValue, getContainingNodeArray, - getDeclarationEmitExtensionForPath, getDeclarationEmitOutputFilePath, getDirectoryPath, getEmitDeclarations, - getEmitFlags, getEmitHelpers, getEmitModuleKind, getExternalHelpersModuleName, getExternalModuleName, - getLeadingCommentRanges, getLineAndCharacterOfPosition, getLinesBetweenPositionAndNextNonWhitespaceCharacter, - getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, getLinesBetweenRangeEndAndRangeStart, getLineStarts, - getLiteralText, GetLiteralTextFlags, getNewLineCharacter, getNodeForGeneratedName, getNodeId, - getNormalizedAbsolutePath, getOriginalNode, getOwnEmitOutputFilePath, getParseTreeNode, - getRelativePathFromDirectory, getRelativePathToDirectoryOrUrl, getRootLength, getShebang, getSnippetElement, - getSourceFileOfNode, getSourceFilePathInNewDir, getSourceFilesToEmit, getSourceMapRange, - getSourceTextOfNodeFromSourceFile, getStartsOnNewLine, getSyntheticLeadingComments, getSyntheticTrailingComments, - getTextOfJSDocComment, getTrailingCommentRanges, getTrailingSemicolonDeferringWriter, getTransformers, getTypeNode, - guessIndentation, hasRecordedExternalHelpers, HeritageClause, Identifier, idText, IfStatement, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, - isAccessExpression, isArray, isArrowFunction, isBinaryExpression, isBindingPattern, isBlock, isBundle, - isBundleFileTextLike, isDeclaration, isDeclarationFileName, isDecorator, isEmptyStatement, isExportAssignment, - isExportSpecifier, isExpression, isFunctionLike, isGeneratedIdentifier, isGeneratedPrivateIdentifier, isIdentifier, - isIncrementalCompilation, isInJsonFile, isInternalDeclaration, isJSDocLikeText, isJsonSourceFile, - isJsxClosingElement, isJsxOpeningElement, isKeyword, isLet, isLiteralExpression, isMemberName, isModifier, - isModuleDeclaration, isNodeDescendantOf, isNumericLiteral, isParenthesizedExpression, isPartiallyEmittedExpression, - isPinnedComment, isPrivateIdentifier, isPrologueDirective, isRecognizedTripleSlashComment, isSourceFile, - isSourceFileNotJson, isStringLiteral, isTemplateLiteralKind, isTokenKind, isTypeParameterDeclaration, - isUnparsedNode, isUnparsedPrepend, isUnparsedSource, isVarConst, isVariableStatement, JSDoc, JSDocAugmentsTag, - JSDocCallbackTag, JSDocComment, JSDocEnumTag, JSDocFunctionType, JSDocImplementsTag, JSDocNameReference, - JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocPropertyLikeTag, JSDocReturnTag, JSDocSeeTag, - JSDocSignature, JSDocTag, JSDocTemplateTag, JSDocThisTag, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, - JSDocTypeTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, - JsxEmit, JsxExpression, JsxFragment, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, - JsxSpreadAttribute, JsxTagNameExpression, JsxText, LabeledStatement, last, lastOrUndefined, LateBoundDeclaration, - length, ListFormat, LiteralExpression, LiteralLikeNode, LiteralTypeNode, makeIdentifierFromModuleName, - MappedTypeNode, maybeBind, memoize, MetaProperty, MethodDeclaration, MethodSignature, Modifier, ModifierLike, - ModuleBlock, ModuleDeclaration, ModuleKind, ModuleReference, NamedDeclaration, NamedExports, NamedImports, - NamedImportsOrExports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, - NewExpression, Node, NodeArray, NodeFlags, nodeIsSynthesized, noEmitNotification, noEmitSubstitution, - NonNullExpression, normalizePath, normalizeSlashes, notImplemented, NumericLiteral, ObjectBindingPattern, - ObjectLiteralExpression, OptionalTypeNode, outFile, OutputFile, ParameterDeclaration, ParenthesizedExpression, - ParenthesizedTypeNode, ParsedCommandLine, PartiallyEmittedExpression, Placeholder, positionIsSynthesized, - positionsAreOnSameLine, PostfixUnaryExpression, PrefixUnaryExpression, Printer, PrinterOptions, PrintHandlers, - PrivateIdentifier, ProgramBuildInfo, ProgramBundleEmitBuildInfo, ProjectReference, PropertyAccessExpression, - PropertyAssignment, PropertyDeclaration, PropertySignature, QualifiedName, rangeEndIsOnSameLineAsRangeStart, - rangeEndPositionsAreOnSameLine, rangeIsOnSingleLine, rangeStartPositionsAreOnSameLine, readJsonOrUndefined, - removeFileExtension, resolvePath, RestTypeNode, returnFalse, ReturnStatement, returnUndefined, SatisfiesExpression, - ScriptTarget, setEachParent, setOriginalNode, setParent, setTextRange, setTextRangePosEnd, - setTextRangePosWidth, ShorthandPropertyAssignment, SignatureDeclaration, singleOrUndefined, - skipPartiallyEmittedExpressions, skipTrivia, SnippetElement, SnippetKind, some, SourceFile, - SourceFilePrologueDirective, SourceFilePrologueInfo, SourceMapEmitResult, SourceMapGenerator, SourceMapSource, - SpreadAssignment, SpreadElement, stableSort, Statement, stringContains, StringLiteral, supportedJSExtensionsFlat, - SwitchStatement, Symbol, SymbolFlags, SyntaxKind, SynthesizedComment, sys, TabStop, TaggedTemplateExpression, - TemplateExpression, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, TextRange, ThrowStatement, - tokenToString, tracing, TransformationResult, transformNodes, tryParseRawSourceMap, TryStatement, TupleTypeNode, - TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeNode, TypeOfExpression, TypeOperatorNode, - TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, UnparsedNode, - UnparsedPrepend, UnparsedPrologue, UnparsedSource, UnparsedSyntheticReference, UnparsedTextLike, - VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, - writeCommentRange, writeFile, WriteFileCallbackData, YieldExpression, + AccessorDeclaration, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AwaitExpression, + BigIntLiteral, + BinaryExpression, + BinaryOperatorToken, + BindingElement, + BindingPattern, + Block, + BlockLike, + BreakStatement, + BuildInfo, + Bundle, + BundleBuildInfo, + BundleFileInfo, + BundleFileSectionKind, + BundleFileTextLike, + BundleFileTextLikeKind, + CallExpression, + CallSignatureDeclaration, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + CharacterCodes, + ClassDeclaration, + ClassExpression, + ClassStaticBlockDeclaration, + CommaListExpression, + CommentRange, + Comparison, + CompilerHost, + CompilerOptions, + ComputedPropertyName, + ConditionalExpression, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + ContinueStatement, + CustomTransformers, + Debug, + DebuggerStatement, + DeclarationName, + Decorator, + DefaultClause, + DeleteExpression, + DoStatement, + DotToken, + ElementAccessExpression, + EmitFileNames, + EmitFlags, + EmitHint, + EmitHost, + EmitOnly, + EmitResolver, + EmitResult, + EmitTextWriter, + EmitTransformers, + EntityName, + EnumDeclaration, + EnumMember, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalModuleReference, + FileReference, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + FunctionTypeNode, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GeneratedPrivateIdentifier, + GetCanonicalFileName, + GetLiteralTextFlags, + HeritageClause, + Identifier, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IndexSignatureDeclaration, + IndexedAccessTypeNode, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocNameReference, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocPropertyLikeTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocTypedefTag, + JSDocVariadicType, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxEmit, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxText, + LabeledStatement, + LateBoundDeclaration, + ListFormat, + LiteralExpression, + LiteralLikeNode, + LiteralTypeNode, + MappedTypeNode, + MetaProperty, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleReference, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFlags, + NonNullExpression, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralExpression, + OptionalTypeNode, + OutputFile, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + ParsedCommandLine, + PartiallyEmittedExpression, + Placeholder, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrintHandlers, + Printer, + PrinterOptions, + PrivateIdentifier, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProjectReference, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + QualifiedName, + RestTypeNode, + ReturnStatement, + SatisfiesExpression, + ScriptTarget, + ShorthandPropertyAssignment, + SignatureDeclaration, + SnippetElement, + SnippetKind, + SourceFile, + SourceFilePrologueDirective, + SourceFilePrologueInfo, + SourceMapEmitResult, + SourceMapGenerator, + SourceMapSource, + SpreadAssignment, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + Symbol, + SymbolFlags, + SyntaxKind, + SynthesizedComment, + TabStop, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + ThrowStatement, + TransformationResult, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionTypeNode, + UnparsedNode, + UnparsedPrepend, + UnparsedPrologue, + UnparsedSource, + UnparsedSyntheticReference, + UnparsedTextLike, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, + WriteFileCallbackData, + YieldExpression, + arrayToMap, + base64encode, + cast, + changeExtension, + clone, + combinePaths, + compareEmitHelpers, + comparePaths, + computeCommonSourceDirectoryOfFilenames, + computeLineStarts, + computeSignature, + contains, + createBinaryExpressionTrampoline, + createDiagnosticCollection, + createGetCanonicalFileName, + createInputFilesWithFileTexts, + createMultiMap, + createPrependNodes, + createSourceMapGenerator, + createTextWriter, + directorySeparator, + emitDetachedComments, + emitNewLineBeforeLeadingCommentOfPosition, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + escapeJsxAttributeString, + escapeLeadingUnderscores, + escapeNonAsciiString, + escapeString, + every, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + findIndex, + firstOrUndefined, + forEach, + forEachChild, + forEachLeadingCommentRange, + forEachTrailingCommentRange, + formatGeneratedName, + formatGeneratedNamePart, + getAreDeclarationMapsEnabled, + getBaseFileName, + getCommentRange, + getConstantValue, + getContainingNodeArray, + getDeclarationEmitExtensionForPath, + getDeclarationEmitOutputFilePath, + getDirectoryPath, + getEmitDeclarations, + getEmitFlags, + getEmitHelpers, + getEmitModuleKind, + getExternalHelpersModuleName, + getExternalModuleName, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLineStarts, + getLinesBetweenPositionAndNextNonWhitespaceCharacter, + getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter, + getLinesBetweenRangeEndAndRangeStart, + getLiteralText, + getNewLineCharacter, + getNodeForGeneratedName, + getNodeId, + getNormalizedAbsolutePath, + getOriginalNode, + getOwnEmitOutputFilePath, + getParseTreeNode, + getRelativePathFromDirectory, + getRelativePathToDirectoryOrUrl, + getRootLength, + getShebang, + getSnippetElement, + getSourceFileOfNode, + getSourceFilePathInNewDir, + getSourceFilesToEmit, + getSourceMapRange, + getSourceTextOfNodeFromSourceFile, + getStartsOnNewLine, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTextOfJSDocComment, + getTrailingCommentRanges, + getTrailingSemicolonDeferringWriter, + getTransformers, + getTypeNode, + guessIndentation, + hasRecordedExternalHelpers, + idText, + isAccessExpression, + isArray, + isArrowFunction, + isBinaryExpression, + isBindingPattern, + isBlock, + isBundle, + isBundleFileTextLike, + isDeclaration, + isDeclarationFileName, + isDecorator, + isEmptyStatement, + isExportAssignment, + isExportSpecifier, + isExpression, + isFunctionLike, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isIdentifier, + isInJsonFile, + isIncrementalCompilation, + isInternalDeclaration, + isJSDocLikeText, + isJsonSourceFile, + isJsxClosingElement, + isJsxOpeningElement, + isKeyword, + isLet, + isLiteralExpression, + isMemberName, + isModifier, + isModuleDeclaration, + isNodeDescendantOf, + isNumericLiteral, + isParenthesizedExpression, + isPartiallyEmittedExpression, + isPinnedComment, + isPrivateIdentifier, + isPrologueDirective, + isRecognizedTripleSlashComment, + isSourceFile, + isSourceFileNotJson, + isStringLiteral, + isTemplateLiteralKind, + isTokenKind, + isTypeParameterDeclaration, + isUnparsedNode, + isUnparsedPrepend, + isUnparsedSource, + isVarConst, + isVariableStatement, + last, + lastOrUndefined, + length, + makeIdentifierFromModuleName, + maybeBind, + memoize, + noEmitNotification, + noEmitSubstitution, + nodeIsSynthesized, + normalizePath, + normalizeSlashes, + notImplemented, + outFile, + positionIsSynthesized, + positionsAreOnSameLine, + rangeEndIsOnSameLineAsRangeStart, + rangeEndPositionsAreOnSameLine, + rangeIsOnSingleLine, + rangeStartPositionsAreOnSameLine, + readJsonOrUndefined, + removeFileExtension, + resolvePath, + returnFalse, + returnUndefined, + setEachParent, + setOriginalNode, + setParent, + setTextRange, + setTextRangePosEnd, + setTextRangePosWidth, + singleOrUndefined, + skipPartiallyEmittedExpressions, + skipTrivia, + some, + stableSort, + stringContains, + supportedJSExtensionsFlat, + sys, + tokenToString, + tracing, + transformNodes, + tryParseRawSourceMap, + writeCommentRange, + writeFile, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/factory/baseNodeFactory.ts b/src/compiler/factory/baseNodeFactory.ts index 39b9490fba770..600de9bb0dff7 100644 --- a/src/compiler/factory/baseNodeFactory.ts +++ b/src/compiler/factory/baseNodeFactory.ts @@ -1,4 +1,8 @@ -import { Node, objectAllocator, SyntaxKind } from "../_namespaces/ts"; +import { + Node, + SyntaxKind, + objectAllocator, +} from "../_namespaces/ts"; /** * A `BaseNodeFactory` is an abstraction over an `ObjectAllocator` that handles caching `Node` constructors diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index dc60dae44814b..63b764018c495 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -1,10 +1,37 @@ import { - __String, ArrayLiteralExpression, arrayToMap, BindingOrAssignmentElement, Block, compareValues, Comparison, - createExpressionFromEntityName, Debug, EmitFlags, EmitHelper, EmitHelperUniqueNameCallback, EmitNode, EntityName, - Expression, FunctionExpression, GeneratedIdentifierFlags, getEmitFlags, getEmitScriptTarget, - getPropertyNameOfBindingOrAssignmentElement, Identifier, isCallExpression, isComputedPropertyName, isIdentifier, - memoize, PrivateIdentifierKind, ScriptTarget, setEmitFlags, setTextRange, SyntaxKind, TextRange, - TransformationContext, UnscopedEmitHelper, + ArrayLiteralExpression, + BindingOrAssignmentElement, + Block, + Comparison, + Debug, + EmitFlags, + EmitHelper, + EmitHelperUniqueNameCallback, + EmitNode, + EntityName, + Expression, + FunctionExpression, + GeneratedIdentifierFlags, + Identifier, + PrivateIdentifierKind, + ScriptTarget, + SyntaxKind, + TextRange, + TransformationContext, + UnscopedEmitHelper, + __String, + arrayToMap, + compareValues, + createExpressionFromEntityName, + getEmitFlags, + getEmitScriptTarget, + getPropertyNameOfBindingOrAssignmentElement, + isCallExpression, + isComputedPropertyName, + isIdentifier, + memoize, + setEmitFlags, + setTextRange, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/factory/emitNode.ts b/src/compiler/factory/emitNode.ts index 693094489a67e..2bb7140bc60d9 100644 --- a/src/compiler/factory/emitNode.ts +++ b/src/compiler/factory/emitNode.ts @@ -1,7 +1,24 @@ import { - AccessExpression, append, appendIfUnique, Debug, EmitFlags, EmitHelper, EmitNode, getParseTreeNode, - getSourceFileOfNode, isParseTreeNode, Node, orderedRemoveItem, SnippetElement, some, SourceFile, SourceMapRange, - SyntaxKind, SynthesizedComment, TextRange, TypeNode, + AccessExpression, + Debug, + EmitFlags, + EmitHelper, + EmitNode, + Node, + SnippetElement, + SourceFile, + SourceMapRange, + SyntaxKind, + SynthesizedComment, + TextRange, + TypeNode, + append, + appendIfUnique, + getParseTreeNode, + getSourceFileOfNode, + isParseTreeNode, + orderedRemoveItem, + some, } from "../_namespaces/ts"; /** diff --git a/src/compiler/factory/nodeConverters.ts b/src/compiler/factory/nodeConverters.ts index 74cddf31527b5..66c8170f03e9f 100644 --- a/src/compiler/factory/nodeConverters.ts +++ b/src/compiler/factory/nodeConverters.ts @@ -1,10 +1,36 @@ import { - ArrayBindingOrAssignmentElement, ArrayBindingOrAssignmentPattern, AssignmentPattern, - BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, Block, cast, ConciseBody, Debug, Expression, - FunctionDeclaration, getStartsOnNewLine, isArrayBindingPattern, isArrayLiteralExpression, isBindingElement, - isBindingPattern, isBlock, isExpression, isIdentifier, isObjectBindingPattern, isObjectLiteralElementLike, - isObjectLiteralExpression, map, NodeConverters, NodeFactory, notImplemented, ObjectBindingOrAssignmentElement, - ObjectBindingOrAssignmentPattern, setOriginalNode, setStartsOnNewLine, setTextRange, SyntaxKind, + ArrayBindingOrAssignmentElement, + ArrayBindingOrAssignmentPattern, + AssignmentPattern, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + Block, + ConciseBody, + Debug, + Expression, + FunctionDeclaration, + NodeConverters, + NodeFactory, + ObjectBindingOrAssignmentElement, + ObjectBindingOrAssignmentPattern, + SyntaxKind, + cast, + getStartsOnNewLine, + isArrayBindingPattern, + isArrayLiteralExpression, + isBindingElement, + isBindingPattern, + isBlock, + isExpression, + isIdentifier, + isObjectBindingPattern, + isObjectLiteralElementLike, + isObjectLiteralExpression, + map, + notImplemented, + setOriginalNode, + setStartsOnNewLine, + setTextRange, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index afa240bd0b392..19bef1d352b62 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -1,83 +1,471 @@ import { - addRange, append, appendIfUnique, ArrayBindingElement, ArrayBindingPattern, ArrayLiteralExpression, ArrayTypeNode, - ArrowFunction, AsExpression, AssertClause, AssertEntry, AssertionKey, AssertsKeyword, AssignmentPattern, - AsteriskToken, AwaitExpression, AwaitKeyword, BaseNodeFactory, BigIntLiteral, BinaryExpression, BinaryOperator, - BinaryOperatorToken, BindingElement, BindingName, BindingPattern, Block, BooleanLiteral, BreakStatement, BuildInfo, - Bundle, BundleFileHasNoDefaultLib, BundleFileInfo, BundleFileReference, BundleFileSectionKind, CallBinding, - CallChain, CallExpression, CallSignatureDeclaration, canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, - cast, CatchClause, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, - ClassStaticBlockDeclaration, ColonToken, CommaListExpression, CompilerHost, CompilerOptions, ComputedPropertyName, - ConciseBody, ConditionalExpression, ConditionalTypeNode, ConstructorDeclaration, ConstructorTypeNode, - ConstructSignatureDeclaration, ContinueStatement, createBaseNodeFactory, createNodeConverters, - createParenthesizerRules, createScanner, Debug, DebuggerStatement, Declaration, DeclarationName, Decorator, - DefaultClause, DeleteExpression, DoStatement, DotDotDotToken, ElementAccessChain, ElementAccessExpression, - EmitFlags, EmitNode, emptyArray, EmptyStatement, EndOfDeclarationMarker, EndOfFileToken, EntityName, - EnumDeclaration, EnumMember, EqualsGreaterThanToken, escapeLeadingUnderscores, every, ExclamationToken, - ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, ExpressionWithTypeArguments, - ExternalModuleReference, FalseLiteral, FileReference, findUseStrictPrologue, forEach, ForInitializer, - ForInStatement, formatGeneratedName, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, - FunctionLikeDeclaration, FunctionTypeNode, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, - GetAccessorDeclaration, getAllUnscopedEmitHelpers, getBuildInfo, getCommentRange, - getElementsOfBindingOrAssignmentPattern, getEmitFlags, getJSDocTypeAliasName, getLineAndCharacterOfPosition, - getNameOfDeclaration, getNodeId, getSourceMapRange, getSyntheticLeadingComments, getSyntheticTrailingComments, - getTargetOfBindingOrAssignmentElement, getTextOfIdentifierOrLiteral, hasInvalidEscape, HasModifiers, hasProperty, - hasStaticModifier, hasSyntacticModifier, HeritageClause, Identifier, idText, IfStatement, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeAssertionContainer, ImportTypeNode, - IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, InputFiles, InterfaceDeclaration, - IntersectionTypeNode, isArray, isArrayLiteralExpression, isArrowFunction, isAssignmentPattern, isBinaryExpression, - isCallChain, isClassDeclaration, isClassExpression, isCommaListExpression, isCommaToken, isComputedPropertyName, - isConstructorDeclaration, isConstructorTypeNode, isCustomPrologue, isElementAccessChain, isElementAccessExpression, - isEnumDeclaration, isExclamationToken, isExportAssignment, isExportDeclaration, isExternalModuleReference, - isFunctionDeclaration, isFunctionExpression, isGeneratedIdentifier, isGetAccessorDeclaration, isHoistedFunction, - isHoistedVariableStatement, isIdentifier, isImportDeclaration, isImportEqualsDeclaration, isImportKeyword, - isIndexSignatureDeclaration, isInterfaceDeclaration, isLabeledStatement, isLocalName, - isLogicalOrCoalescingAssignmentOperator, isMemberName, isMethodDeclaration, isMethodSignature, isModuleDeclaration, - isNamedDeclaration, isNodeArray, isNodeKind, isNonNullChain, isNotEmittedStatement, isObjectLiteralExpression, - isOmittedExpression, isOuterExpression, isParameter, isParenthesizedExpression, isParseTreeNode, - isPrivateIdentifier, isPrologueDirective, isPropertyAccessChain, isPropertyAccessExpression, isPropertyDeclaration, - isPropertyName, isPropertySignature, isQuestionToken, isSetAccessorDeclaration, isSourceFile, isStatement, - isStatementOrBlock, isString, isStringLiteral, isSuperKeyword, isSuperProperty, isThisIdentifier, - isTypeAliasDeclaration, isTypeParameterDeclaration, isVariableDeclaration, isVariableStatement, JSDoc, JSDocAllType, - JSDocAugmentsTag, JSDocAuthorTag, JSDocCallbackTag, JSDocClassTag, JSDocComment, JSDocDeprecatedTag, JSDocEnumTag, - JSDocFunctionType, JSDocImplementsTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, JSDocNamepathType, - JSDocNameReference, JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, - JSDocOverrideTag, JSDocParameterTag, JSDocPrivateTag, JSDocPropertyLikeTag, JSDocPropertyTag, JSDocProtectedTag, - JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSeeTag, JSDocSignature, JSDocTag, JSDocTemplateTag, - JSDocText, JSDocThisTag, JSDocType, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, - JSDocUnknownTag, JSDocUnknownType, JSDocVariadicType, JsxAttribute, JsxAttributeLike, JsxAttributes, - JsxAttributeValue, JsxChild, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, - JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, JsxTagNameExpression, JsxText, - KeywordSyntaxKind, KeywordToken, KeywordTypeNode, KeywordTypeSyntaxKind, LabeledStatement, LanguageVariant, - lastOrUndefined, LeftHandSideExpression, LiteralToken, LiteralTypeNode, map, MappedTypeNode, - memoize, memoizeOne, MergeDeclarationMarker, MetaProperty, MethodDeclaration, MethodSignature, MinusToken, - MissingDeclaration, Modifier, ModifierFlags, ModifierLike, modifiersToFlags, ModifierSyntaxKind, ModifierToken, - ModuleBlock, ModuleBody, ModuleDeclaration, ModuleKind, ModuleName, ModuleReference, Mutable, MutableNodeArray, - NamedDeclaration, NamedExportBindings, NamedExports, NamedImportBindings, NamedImports, NamedTupleMember, - NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, Node, NodeArray, NodeFactory, - NodeFlags, nodeIsSynthesized, NonNullChain, NonNullExpression, NoSubstitutionTemplateLiteral, NotEmittedStatement, - NullLiteral, nullNodeConverters, nullParenthesizerRules, NumericLiteral, objectAllocator, ObjectBindingPattern, - ObjectLiteralElementLike, ObjectLiteralExpression, OmittedExpression, OptionalTypeNode, OuterExpression, - OuterExpressionKinds, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, parseNodeFactory, - PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, PrefixUnaryExpression, - PrefixUnaryOperator, PrimaryExpression, PrivateIdentifier, PrologueDirective, PropertyAccessChain, - PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyDescriptorAttributes, PropertyName, - PropertyNameLiteral, PropertySignature, PseudoBigInt, pseudoBigIntToString, PunctuationSyntaxKind, PunctuationToken, - Push, QualifiedName, QuestionDotToken, QuestionToken, ReadonlyKeyword, reduceLeft, RegularExpressionLiteral, - RestTypeNode, ReturnStatement, returnTrue, sameFlatMap, SatisfiesExpression, Scanner, ScriptTarget, - SemicolonClassElement, SetAccessorDeclaration, setEachParent, setEmitFlags, setParent, setTextRange, - setTextRangePosEnd, setTextRangePosWidth, ShorthandPropertyAssignment, SignatureDeclarationBase, singleOrUndefined, - skipOuterExpressions, skipParentheses, some, SourceFile, SourceMapSource, SpreadAssignment, SpreadElement, - startOnNewLine, startsWith, Statement, StringLiteral, StringLiteralLike, stringToToken, SuperExpression, - SwitchStatement, SyntaxKind, SyntaxList, SyntheticExpression, SyntheticReferenceExpression, - TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteral, TemplateLiteralLikeNode, - TemplateLiteralToken, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateMiddle, TemplateSpan, TemplateTail, - TextRange, ThisExpression, ThisTypeNode, ThrowStatement, Token, TokenFlags, TransformFlags, TrueLiteral, - TryStatement, TupleTypeNode, Type, TypeAliasDeclaration, TypeAssertion, TypeElement, TypeLiteralNode, TypeNode, - TypeOfExpression, TypeOfTag, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, - TypeReferenceNode, UnionOrIntersectionTypeNode, UnionTypeNode, UnparsedNode, UnparsedPrepend, UnparsedPrologue, - UnparsedSource, UnparsedSourceText, UnparsedSyntheticReference, UnparsedTextLike, UnscopedEmitHelper, - VariableDeclaration, VariableDeclarationList, VariableStatement, visitNode, VisitResult, VoidExpression, - WhileStatement, WithStatement, YieldExpression, + ArrayBindingElement, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AssertionKey, + AssertsKeyword, + AssignmentPattern, + AsteriskToken, + AwaitExpression, + AwaitKeyword, + BaseNodeFactory, + BigIntLiteral, + BinaryExpression, + BinaryOperator, + BinaryOperatorToken, + BindingElement, + BindingName, + BindingPattern, + Block, + BooleanLiteral, + BreakStatement, + BuildInfo, + Bundle, + BundleFileHasNoDefaultLib, + BundleFileInfo, + BundleFileReference, + BundleFileSectionKind, + CallBinding, + CallChain, + CallExpression, + CallSignatureDeclaration, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + ColonToken, + CommaListExpression, + CompilerHost, + CompilerOptions, + ComputedPropertyName, + ConciseBody, + ConditionalExpression, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + ContinueStatement, + Debug, + DebuggerStatement, + Declaration, + DeclarationName, + Decorator, + DefaultClause, + DeleteExpression, + DoStatement, + DotDotDotToken, + ElementAccessChain, + ElementAccessExpression, + EmitFlags, + EmitNode, + EmptyStatement, + EndOfDeclarationMarker, + EndOfFileToken, + EntityName, + EnumDeclaration, + EnumMember, + EqualsGreaterThanToken, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + ExternalModuleReference, + FalseLiteral, + FileReference, + ForInStatement, + ForInitializer, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + FunctionTypeNode, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GetAccessorDeclaration, + HasModifiers, + HeritageClause, + Identifier, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexSignatureDeclaration, + IndexedAccessTypeNode, + InferTypeNode, + InputFiles, + InterfaceDeclaration, + IntersectionTypeNode, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocComment, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNameReference, + JSDocNamepathType, + JSDocNamespaceDeclaration, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocText, + JSDocThisTag, + JSDocType, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocTypedefTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsxAttribute, + JsxAttributeLike, + JsxAttributeValue, + JsxAttributes, + JsxChild, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxText, + KeywordSyntaxKind, + KeywordToken, + KeywordTypeNode, + KeywordTypeSyntaxKind, + LabeledStatement, + LanguageVariant, + LeftHandSideExpression, + LiteralToken, + LiteralTypeNode, + MappedTypeNode, + MergeDeclarationMarker, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + ModifierSyntaxKind, + ModifierToken, + ModuleBlock, + ModuleBody, + ModuleDeclaration, + ModuleKind, + ModuleName, + ModuleReference, + Mutable, + MutableNodeArray, + NamedDeclaration, + NamedExportBindings, + NamedExports, + NamedImportBindings, + NamedImports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + NodeFactory, + NodeFlags, + NonNullChain, + NonNullExpression, + NotEmittedStatement, + NullLiteral, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OmittedExpression, + OptionalTypeNode, + OuterExpression, + OuterExpressionKinds, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + PlusToken, + PostfixUnaryExpression, + PostfixUnaryOperator, + PrefixUnaryExpression, + PrefixUnaryOperator, + PrimaryExpression, + PrivateIdentifier, + PrologueDirective, + PropertyAccessChain, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyDescriptorAttributes, + PropertyName, + PropertyNameLiteral, + PropertySignature, + PseudoBigInt, + PunctuationSyntaxKind, + PunctuationToken, + Push, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, + RegularExpressionLiteral, + RestTypeNode, + ReturnStatement, + SatisfiesExpression, + Scanner, + ScriptTarget, + SemicolonClassElement, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SignatureDeclarationBase, + SourceFile, + SourceMapSource, + SpreadAssignment, + SpreadElement, + Statement, + StringLiteral, + StringLiteralLike, + SuperExpression, + SwitchStatement, + SyntaxKind, + SyntaxList, + SyntheticExpression, + SyntheticReferenceExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralToken, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + TextRange, + ThisExpression, + ThisTypeNode, + ThrowStatement, + Token, + TokenFlags, + TransformFlags, + TrueLiteral, + TryStatement, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeElement, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOfTag, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionOrIntersectionTypeNode, + UnionTypeNode, + UnparsedNode, + UnparsedPrepend, + UnparsedPrologue, + UnparsedSource, + UnparsedSourceText, + UnparsedSyntheticReference, + UnparsedTextLike, + UnscopedEmitHelper, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VisitResult, + VoidExpression, + WhileStatement, + WithStatement, + YieldExpression, + addRange, + append, + appendIfUnique, + canHaveModifiers, + cast, + createBaseNodeFactory, + createNodeConverters, + createParenthesizerRules, + createScanner, + emptyArray, + escapeLeadingUnderscores, + every, + findUseStrictPrologue, + forEach, + formatGeneratedName, + getAllUnscopedEmitHelpers, + getBuildInfo, + getCommentRange, + getElementsOfBindingOrAssignmentPattern, + getEmitFlags, + getJSDocTypeAliasName, + getLineAndCharacterOfPosition, + getNameOfDeclaration, + getNodeId, + getSourceMapRange, + getSyntheticLeadingComments, + getSyntheticTrailingComments, + getTargetOfBindingOrAssignmentElement, + getTextOfIdentifierOrLiteral, + hasInvalidEscape, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, + idText, + isArray, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentPattern, + isBinaryExpression, + isCallChain, + isClassDeclaration, + isClassExpression, + isCommaListExpression, + isCommaToken, + isComputedPropertyName, + isConstructorDeclaration, + isConstructorTypeNode, + isCustomPrologue, + isElementAccessChain, + isElementAccessExpression, + isEnumDeclaration, + isExclamationToken, + isExportAssignment, + isExportDeclaration, + isExternalModuleReference, + isFunctionDeclaration, + isFunctionExpression, + isGeneratedIdentifier, + isGetAccessorDeclaration, + isHoistedFunction, + isHoistedVariableStatement, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isLabeledStatement, + isLocalName, + isLogicalOrCoalescingAssignmentOperator, + isMemberName, + isMethodDeclaration, + isMethodSignature, + isModuleDeclaration, + isNamedDeclaration, + isNodeArray, + isNodeKind, + isNonNullChain, + isNotEmittedStatement, + isObjectLiteralExpression, + isOmittedExpression, + isOuterExpression, + isParameter, + isParenthesizedExpression, + isParseTreeNode, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAccessChain, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertyName, + isPropertySignature, + isQuestionToken, + isSetAccessorDeclaration, + isSourceFile, + isStatement, + isStatementOrBlock, + isString, + isStringLiteral, + isSuperKeyword, + isSuperProperty, + isThisIdentifier, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, + isVariableStatement, + lastOrUndefined, + map, + memoize, + memoizeOne, + modifiersToFlags, + nodeIsSynthesized, + nullNodeConverters, + nullParenthesizerRules, + objectAllocator, + parseNodeFactory, + pseudoBigIntToString, + reduceLeft, + returnTrue, + sameFlatMap, + setEachParent, + setEmitFlags, + setParent, + setTextRange, + setTextRangePosEnd, + setTextRangePosWidth, + singleOrUndefined, + skipOuterExpressions, + skipParentheses, + some, + startOnNewLine, + startsWith, + stringToToken, + visitNode, } from "../_namespaces/ts"; let nextAutoGenerateId = 0; diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index f391dbb1edb59..800751735be96 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -1,41 +1,226 @@ import { - AbstractKeyword, AccessorKeyword, ArrayBindingPattern, ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, - AsExpression, AssertClause, AssertEntry, AssertsKeyword, AsteriskToken, AsyncKeyword, AwaitExpression, AwaitKeyword, - BigIntLiteral, BinaryExpression, BindingElement, Block, BreakStatement, Bundle, CallExpression, - CallSignatureDeclaration, CaseBlock, CaseClause, CatchClause, ClassDeclaration, ClassExpression, - ClassStaticBlockDeclaration, ColonToken, CommaListExpression, ComputedPropertyName, ConditionalExpression, - ConditionalTypeNode, ConstructorDeclaration, ConstructorTypeNode, ConstructSignatureDeclaration, ContinueStatement, - DebuggerStatement, Decorator, DefaultClause, DeleteExpression, DoStatement, DotDotDotToken, ElementAccessExpression, - EmptyStatement, EndOfDeclarationMarker, EnumDeclaration, EnumMember, EqualsGreaterThanToken, ExclamationToken, - ExportAssignment, ExportDeclaration, ExportKeyword, ExportSpecifier, ExpressionStatement, - ExpressionWithTypeArguments, ExternalModuleReference, ForInStatement, ForOfStatement, ForStatement, - FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, - IfStatement, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportExpression, ImportSpecifier, - ImportTypeAssertionContainer, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, - InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAllType, JSDocAugmentsTag, JSDocAuthorTag, JSDocCallbackTag, - JSDocClassTag, JSDocDeprecatedTag, JSDocEnumTag, JSDocFunctionType, JSDocImplementsTag, JSDocLink, JSDocLinkCode, - JSDocLinkPlain, JSDocMemberName, JSDocNamepathType, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, - JSDocOptionalType, JSDocOverrideTag, JSDocParameterTag, JSDocPrivateTag, JSDocPropertyTag, JSDocProtectedTag, - JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, - JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, JSDocUnknownTag, JSDocUnknownType, - JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, - JsxFragment, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, JsxText, - LabeledStatement, LiteralTypeNode, MappedTypeNode, MergeDeclarationMarker, MetaProperty, MethodDeclaration, - MethodSignature, MinusToken, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, - NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, Node, - NonNullExpression, NoSubstitutionTemplateLiteral, NotEmittedStatement, NumericLiteral, ObjectBindingPattern, - ObjectLiteralExpression, OmittedExpression, OptionalTypeNode, OverrideKeyword, ParameterDeclaration, - ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PlusToken, PostfixUnaryExpression, - PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, - PropertySignature, QualifiedName, QuestionDotToken, QuestionToken, ReadonlyKeyword, RegularExpressionLiteral, - RestTypeNode, ReturnStatement, SatisfiesExpression, SemicolonClassElement, SetAccessorDeclaration, - ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, StaticKeyword, StringLiteral, - SuperExpression, SwitchStatement, SyntaxKind, SyntaxList, SyntheticExpression, SyntheticReferenceExpression, - TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, - TemplateMiddle, TemplateSpan, TemplateTail, ThisTypeNode, ThrowStatement, Token, TryStatement, TupleTypeNode, - TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, - TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, UnparsedPrepend, UnparsedSource, - VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, + AbstractKeyword, + AccessorKeyword, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AssertsKeyword, + AsteriskToken, + AsyncKeyword, + AwaitExpression, + AwaitKeyword, + BigIntLiteral, + BinaryExpression, + BindingElement, + Block, + BreakStatement, + Bundle, + CallExpression, + CallSignatureDeclaration, + CaseBlock, + CaseClause, + CatchClause, + ClassDeclaration, + ClassExpression, + ClassStaticBlockDeclaration, + ColonToken, + CommaListExpression, + ComputedPropertyName, + ConditionalExpression, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + ContinueStatement, + DebuggerStatement, + Decorator, + DefaultClause, + DeleteExpression, + DoStatement, + DotDotDotToken, + ElementAccessExpression, + EmptyStatement, + EndOfDeclarationMarker, + EnumDeclaration, + EnumMember, + EqualsGreaterThanToken, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportKeyword, + ExportSpecifier, + ExpressionStatement, + ExpressionWithTypeArguments, + ExternalModuleReference, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionTypeNode, + GetAccessorDeclaration, + HeritageClause, + Identifier, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportExpression, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexSignatureDeclaration, + IndexedAccessTypeNode, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNameReference, + JSDocNamepathType, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocTypedefTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxText, + LabeledStatement, + LiteralTypeNode, + MappedTypeNode, + MergeDeclarationMarker, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + ModuleBlock, + ModuleDeclaration, + NamedExports, + NamedImports, + NamedTupleMember, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + NoSubstitutionTemplateLiteral, + Node, + NonNullExpression, + NotEmittedStatement, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralExpression, + OmittedExpression, + OptionalTypeNode, + OverrideKeyword, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, + RegularExpressionLiteral, + RestTypeNode, + ReturnStatement, + SatisfiesExpression, + SemicolonClassElement, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SourceFile, + SpreadAssignment, + SpreadElement, + StaticKeyword, + StringLiteral, + SuperExpression, + SwitchStatement, + SyntaxKind, + SyntaxList, + SyntheticExpression, + SyntheticReferenceExpression, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + ThisTypeNode, + ThrowStatement, + Token, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeLiteralNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnionTypeNode, + UnparsedPrepend, + UnparsedSource, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, YieldExpression, } from "../_namespaces/ts"; diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 0f697835674a5..c1c0f96a8d4fd 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -1,13 +1,53 @@ import { - Associativity, BinaryExpression, BinaryOperator, cast, compareValues, Comparison, ConciseBody, Expression, - getExpressionAssociativity, getExpressionPrecedence, getLeftmostExpression, getOperatorAssociativity, - getOperatorPrecedence, identity, isBinaryExpression, isBlock, isCallExpression, isCommaSequence, - isConditionalTypeNode, isConstructorTypeNode, isFunctionOrConstructorTypeNode, isFunctionTypeNode, isInferTypeNode, - isIntersectionTypeNode, isJSDocNullableType, isLeftHandSideExpression, isLiteralKind, isNamedTupleMember, - isNodeArray, isOptionalChain, isTypeOperatorNode, isUnaryExpression, isUnionTypeNode, last, LeftHandSideExpression, - NamedTupleMember, NewExpression, NodeArray, NodeFactory, OperatorPrecedence, OuterExpressionKinds, - ParenthesizerRules, sameMap, setTextRange, skipPartiallyEmittedExpressions, some, SyntaxKind, TypeNode, + Associativity, + BinaryExpression, + BinaryOperator, + Comparison, + ConciseBody, + Expression, + LeftHandSideExpression, + NamedTupleMember, + NewExpression, + NodeArray, + NodeFactory, + OperatorPrecedence, + OuterExpressionKinds, + ParenthesizerRules, + SyntaxKind, + TypeNode, UnaryExpression, + cast, + compareValues, + getExpressionAssociativity, + getExpressionPrecedence, + getLeftmostExpression, + getOperatorAssociativity, + getOperatorPrecedence, + identity, + isBinaryExpression, + isBlock, + isCallExpression, + isCommaSequence, + isConditionalTypeNode, + isConstructorTypeNode, + isFunctionOrConstructorTypeNode, + isFunctionTypeNode, + isInferTypeNode, + isIntersectionTypeNode, + isJSDocNullableType, + isLeftHandSideExpression, + isLiteralKind, + isNamedTupleMember, + isNodeArray, + isOptionalChain, + isTypeOperatorNode, + isUnaryExpression, + isUnionTypeNode, + last, + sameMap, + setTextRange, + skipPartiallyEmittedExpressions, + some, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index b6c97f8f3b857..c6e2c43bfbe4a 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -1,35 +1,171 @@ import { - AccessorDeclaration, addEmitFlags, AdditiveOperator, AdditiveOperatorOrHigher, AssertionLevel, - AssignmentOperatorOrHigher, BinaryExpression, BinaryOperator, BinaryOperatorToken, BindingOrAssignmentElement, - BindingOrAssignmentElementRestIndicator, BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, - BitwiseOperator, BitwiseOperatorOrHigher, Block, BooleanLiteral, CharacterCodes, CommaListExpression, - compareStringsCaseSensitive, CompilerOptions, Debug, Declaration, EmitFlags, EmitHelperFactory, EmitHost, - EmitResolver, EntityName, EqualityOperator, EqualityOperatorOrHigher, ExclamationToken, ExponentiationOperator, - ExportDeclaration, Expression, ExpressionStatement, externalHelpersModuleNameText, first, firstOrUndefined, - ForInitializer, GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, + AccessorDeclaration, + AdditiveOperator, + AdditiveOperatorOrHigher, + AssertionLevel, + AssignmentOperatorOrHigher, + BinaryExpression, + BinaryOperator, + BinaryOperatorToken, + BindingOrAssignmentElement, + BindingOrAssignmentElementRestIndicator, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + BitwiseOperator, + BitwiseOperatorOrHigher, + Block, + BooleanLiteral, + CharacterCodes, + CommaListExpression, + CompilerOptions, + Debug, + Declaration, + EmitFlags, + EmitHelperFactory, + EmitHost, + EmitResolver, + EntityName, + EqualityOperator, + EqualityOperatorOrHigher, + ExclamationToken, + ExponentiationOperator, + ExportDeclaration, + Expression, + ExpressionStatement, + ForInitializer, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAllAccessorDeclarations, getEmitFlags, getEmitHelpers, getEmitModuleKind, getESModuleInterop, - getExternalModuleName, getExternalModuleNameFromPath, getJSDocType, getJSDocTypeTag, getModifiers, - getNamespaceDeclarationNode, getOrCreateEmitNode, getOriginalNode, getParseTreeNode, - getSourceTextOfNodeFromSourceFile, HasIllegalDecorators, HasIllegalModifiers, HasIllegalType, - HasIllegalTypeParameters, Identifier, idText, ImportCall, ImportDeclaration, ImportEqualsDeclaration, - isAssignmentExpression, isAssignmentOperator, isBlock, isComputedPropertyName, isDeclarationBindingElement, - isDefaultImport, isEffectiveExternalModule, isExclamationToken, isExportNamespaceAsDefaultDeclaration, - isFileLevelUniqueName, isGeneratedIdentifier, isGeneratedPrivateIdentifier, isIdentifier, isInJSFile, - isLiteralExpression, isMemberName, isMinusToken, isObjectLiteralElementLike, isParenthesizedExpression, isPlusToken, - isPostfixUnaryExpression, isPrefixUnaryExpression, isPrivateIdentifier, isPrologueDirective, isPropertyAssignment, - isPropertyName, isQualifiedName, isQuestionToken, isReadonlyKeyword, isShorthandPropertyAssignment, isSourceFile, - isSpreadAssignment, isSpreadElement, isStringLiteral, isThisTypeNode, isTypeNode, isTypeParameterDeclaration, - isVariableDeclarationList, JSDocNamespaceBody, JSDocTypeAssertion, JsxOpeningFragment, JsxOpeningLikeElement, - LeftHandSideExpression, LiteralExpression, LogicalOperator, LogicalOperatorOrHigher, map, MemberExpression, - MethodDeclaration, MinusToken, ModifiersArray, ModuleKind, ModuleName, MultiplicativeOperator, - MultiplicativeOperatorOrHigher, Mutable, NamedImportBindings, Node, NodeArray, NodeFactory, NullLiteral, - NumericLiteral, ObjectLiteralElementLike, ObjectLiteralExpression, or, OuterExpression, OuterExpressionKinds, - outFile, parseNodeFactory, PlusToken, PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, - PropertyAssignment, PropertyDeclaration, PropertyName, pushIfUnique, QuestionToken, ReadonlyKeyword, - RelationalOperator, RelationalOperatorOrHigher, SetAccessorDeclaration, setOriginalNode, setParent, setStartsOnNewLine, setTextRange, - ShiftOperator, ShiftOperatorOrHigher, ShorthandPropertyAssignment, some, SourceFile, Statement, StringLiteral, - SyntaxKind, TextRange, ThisTypeNode, Token, TypeNode, TypeParameterDeclaration, + HasIllegalDecorators, + HasIllegalModifiers, + HasIllegalType, + HasIllegalTypeParameters, + Identifier, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + JSDocNamespaceBody, + JSDocTypeAssertion, + JsxOpeningFragment, + JsxOpeningLikeElement, + LeftHandSideExpression, + LiteralExpression, + LogicalOperator, + LogicalOperatorOrHigher, + MemberExpression, + MethodDeclaration, + MinusToken, + ModifiersArray, + ModuleKind, + ModuleName, + MultiplicativeOperator, + MultiplicativeOperatorOrHigher, + Mutable, + NamedImportBindings, + Node, + NodeArray, + NodeFactory, + NullLiteral, + NumericLiteral, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OuterExpression, + OuterExpressionKinds, + PlusToken, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + QuestionToken, + ReadonlyKeyword, + RelationalOperator, + RelationalOperatorOrHigher, + SetAccessorDeclaration, + ShiftOperator, + ShiftOperatorOrHigher, + ShorthandPropertyAssignment, + SourceFile, + Statement, + StringLiteral, + SyntaxKind, + TextRange, + ThisTypeNode, + Token, + TypeNode, + TypeParameterDeclaration, + addEmitFlags, + compareStringsCaseSensitive, + externalHelpersModuleNameText, + first, + firstOrUndefined, + getAllAccessorDeclarations, + getESModuleInterop, + getEmitFlags, + getEmitHelpers, + getEmitModuleKind, + getExternalModuleName, + getExternalModuleNameFromPath, + getJSDocType, + getJSDocTypeTag, + getModifiers, + getNamespaceDeclarationNode, + getOrCreateEmitNode, + getOriginalNode, + getParseTreeNode, + getSourceTextOfNodeFromSourceFile, + idText, + isAssignmentExpression, + isAssignmentOperator, + isBlock, + isComputedPropertyName, + isDeclarationBindingElement, + isDefaultImport, + isEffectiveExternalModule, + isExclamationToken, + isExportNamespaceAsDefaultDeclaration, + isFileLevelUniqueName, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isIdentifier, + isInJSFile, + isLiteralExpression, + isMemberName, + isMinusToken, + isObjectLiteralElementLike, + isParenthesizedExpression, + isPlusToken, + isPostfixUnaryExpression, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrologueDirective, + isPropertyAssignment, + isPropertyName, + isQualifiedName, + isQuestionToken, + isReadonlyKeyword, + isShorthandPropertyAssignment, + isSourceFile, + isSpreadAssignment, + isSpreadElement, + isStringLiteral, + isThisTypeNode, + isTypeNode, + isTypeParameterDeclaration, + isVariableDeclarationList, + map, + or, + outFile, + parseNodeFactory, + pushIfUnique, + setOriginalNode, + setParent, + setStartsOnNewLine, + setTextRange, + some, } from "../_namespaces/ts"; // Compound nodes diff --git a/src/compiler/factory/utilitiesPublic.ts b/src/compiler/factory/utilitiesPublic.ts index d679f8f34b649..66b71eaa6a0b9 100644 --- a/src/compiler/factory/utilitiesPublic.ts +++ b/src/compiler/factory/utilitiesPublic.ts @@ -1,4 +1,11 @@ -import { HasDecorators, HasModifiers, Node, setTextRangePosEnd, SyntaxKind, TextRange } from "../_namespaces/ts"; +import { + HasDecorators, + HasModifiers, + Node, + SyntaxKind, + TextRange, + setTextRangePosEnd, +} from "../_namespaces/ts"; export function setTextRange(range: T, location: TextRange | undefined): T { return location ? setTextRangePosEnd(range, location.pos, location.end) : range; diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 6364309fc2d77..57acdf388a970 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,23 +1,111 @@ import { - append, appendIfUnique, arrayFrom, changeAnyExtension, CharacterCodes, combinePaths, comparePaths, Comparison, - CompilerOptions, contains, containsPath, createCompilerDiagnostic, Debug, Diagnostic, DiagnosticMessage, - DiagnosticReporter, Diagnostics, directoryProbablyExists, directorySeparator, emptyArray, endsWith, - ensureTrailingDirectorySeparator, every, Extension, extensionIsTS, fileExtensionIs, fileExtensionIsOneOf, - FileReference, filter, firstDefined, forEach, forEachAncestorDirectory, formatMessage, getBaseFileName, - GetCanonicalFileName, getCommonSourceDirectory, getDirectoryPath, GetEffectiveTypeRootsHost, getEmitModuleKind, - getEmitModuleResolutionKind, getModeForUsageLocation, getNormalizedAbsolutePath, getOwnKeys, getPathComponents, - getPathFromPathComponents, getPathsBasePath, getPossibleOriginalInputExtensionForExtension, - getRelativePathFromDirectory, getRootLength, hasJSFileExtension, hasProperty, hasTrailingDirectorySeparator, - hostGetCanonicalFileName, isArray, isExternalModuleNameRelative, isRootedDiskPath, isString, - isStringLiteralLike, lastOrUndefined, length, MapLike, matchedText, MatchingKeys, matchPatternOrExact, - ModuleKind, ModuleResolutionHost, ModuleResolutionKind, noop, noopPush, normalizePath, normalizeSlashes, - optionsHaveModuleResolutionChanges, PackageId, packageIdToString, ParsedCommandLine, Path, pathIsRelative, Pattern, - patternText, perfLogger, Push, readJson, removeExtension, removeFileExtension, removePrefix, + CharacterCodes, + Comparison, + CompilerOptions, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + Extension, + FileReference, + GetCanonicalFileName, + GetEffectiveTypeRootsHost, + MapLike, + MatchingKeys, + ModuleKind, + ModuleResolutionHost, + ModuleResolutionKind, + PackageId, + ParsedCommandLine, + Path, + Pattern, + Push, ResolutionMode, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, some, sort, SourceFile, startsWith, stringContains, - StringLiteralLike, supportedDeclarationExtensions, supportedTSImplementationExtensions, toFileNameLowerCase, toPath, tryExtractTSExtension, tryGetExtensionFromPath, - tryParsePatterns, version, Version, versionMajorMinor, VersionRange, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SourceFile, + StringLiteralLike, + Version, + VersionRange, + append, + appendIfUnique, + arrayFrom, + changeAnyExtension, + combinePaths, + comparePaths, + contains, + containsPath, + createCompilerDiagnostic, + directoryProbablyExists, + directorySeparator, + emptyArray, + endsWith, + ensureTrailingDirectorySeparator, + every, + extensionIsTS, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + firstDefined, + forEach, + forEachAncestorDirectory, + formatMessage, + getBaseFileName, + getCommonSourceDirectory, + getDirectoryPath, + getEmitModuleKind, + getEmitModuleResolutionKind, + getModeForUsageLocation, + getNormalizedAbsolutePath, + getOwnKeys, + getPathComponents, + getPathFromPathComponents, + getPathsBasePath, + getPossibleOriginalInputExtensionForExtension, + getRelativePathFromDirectory, + getRootLength, + hasJSFileExtension, + hasProperty, + hasTrailingDirectorySeparator, + hostGetCanonicalFileName, + isArray, + isExternalModuleNameRelative, + isRootedDiskPath, + isString, + isStringLiteralLike, + lastOrUndefined, + length, + matchPatternOrExact, + matchedText, + noop, + noopPush, + normalizePath, + normalizeSlashes, + optionsHaveModuleResolutionChanges, + packageIdToString, + pathIsRelative, + patternText, + perfLogger, + readJson, + removeExtension, + removeFileExtension, + removePrefix, + some, + sort, + startsWith, + stringContains, + supportedDeclarationExtensions, + supportedTSImplementationExtensions, + toFileNameLowerCase, + toPath, + tryExtractTSExtension, + tryGetExtensionFromPath, + tryParsePatterns, + version, + versionMajorMinor, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index daffd3fc1f746..5f583ed5bfe4f 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -1,22 +1,107 @@ import { - __String, allKeysStartWithDot, AmbientModuleDeclaration, append, arrayFrom, CharacterCodes, combinePaths, - compareBooleans, compareNumberOfDirectorySeparators, comparePaths, Comparison, CompilerOptions, containsIgnoredPath, - containsPath, createGetCanonicalFileName, Debug, directorySeparator, emptyArray, endsWith, - ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, every, ExportAssignment, Extension, extensionFromPath, - fileExtensionIsOneOf, FileIncludeKind, firstDefined, flatMap, flatten, forEach, forEachAncestorDirectory, - GetCanonicalFileName, getDirectoryPath, getEmitModuleResolutionKind, getImpliedNodeFormatForFile, - getModeForResolutionAtIndex, getModuleNameStringLiteralAt, getNodeModulePathParts, getNormalizedAbsolutePath, - getOwnKeys, getPackageJsonTypesVersionsPaths, getPackageNameFromTypesPackageName, getPathsBasePath, - getRelativePathFromDirectory, getRelativePathToDirectoryOrUrl, getSourceFileOfModule, getSupportedExtensions, - getTextOfIdentifierOrLiteral, hasJSFileExtension, hasTSFileExtension, hostGetCanonicalFileName, Identifier, - isAmbientModule, isApplicableVersionedTypesKey, isExternalModuleAugmentation, isExternalModuleNameRelative, - isModuleBlock, isModuleDeclaration, isNonGlobalAmbientModule, isRootedDiskPath, isSourceFile, isString, JsxEmit, - map, mapDefined, MapLike, matchPatternOrExact, min, ModuleDeclaration, ModuleKind, ModulePath, - ModuleResolutionHost, ModuleResolutionKind, ModuleSpecifierCache, ModuleSpecifierOptions, - ModuleSpecifierResolutionHost, NodeFlags, NodeModulePathParts, normalizePath, Path, pathContainsNodeModules, - pathIsBareSpecifier, pathIsRelative, PropertyAccessExpression, removeFileExtension, removeSuffix, resolvePath, - ScriptKind, some, SourceFile, startsWith, startsWithDirectory, stringContains, StringLiteral, Symbol, SymbolFlags, - toPath, tryGetExtensionFromPath, tryParsePatterns, TypeChecker, UserPreferences, ResolutionMode, + AmbientModuleDeclaration, + CharacterCodes, + Comparison, + CompilerOptions, + Debug, + ExportAssignment, + Extension, + FileIncludeKind, + GetCanonicalFileName, + Identifier, + JsxEmit, + MapLike, + ModuleDeclaration, + ModuleKind, + ModulePath, + ModuleResolutionHost, + ModuleResolutionKind, + ModuleSpecifierCache, + ModuleSpecifierOptions, + ModuleSpecifierResolutionHost, + NodeFlags, + NodeModulePathParts, + Path, + PropertyAccessExpression, + ResolutionMode, + ScriptKind, + SourceFile, + StringLiteral, + Symbol, + SymbolFlags, + TypeChecker, + UserPreferences, + __String, + allKeysStartWithDot, + append, + arrayFrom, + combinePaths, + compareBooleans, + compareNumberOfDirectorySeparators, + comparePaths, + containsIgnoredPath, + containsPath, + createGetCanonicalFileName, + directorySeparator, + emptyArray, + endsWith, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + every, + extensionFromPath, + fileExtensionIsOneOf, + firstDefined, + flatMap, + flatten, + forEach, + forEachAncestorDirectory, + getDirectoryPath, + getEmitModuleResolutionKind, + getImpliedNodeFormatForFile, + getModeForResolutionAtIndex, + getModuleNameStringLiteralAt, + getNodeModulePathParts, + getNormalizedAbsolutePath, + getOwnKeys, + getPackageJsonTypesVersionsPaths, + getPackageNameFromTypesPackageName, + getPathsBasePath, + getRelativePathFromDirectory, + getRelativePathToDirectoryOrUrl, + getSourceFileOfModule, + getSupportedExtensions, + getTextOfIdentifierOrLiteral, + hasJSFileExtension, + hasTSFileExtension, + hostGetCanonicalFileName, + isAmbientModule, + isApplicableVersionedTypesKey, + isExternalModuleAugmentation, + isExternalModuleNameRelative, + isModuleBlock, + isModuleDeclaration, + isNonGlobalAmbientModule, + isRootedDiskPath, + isSourceFile, + isString, + map, + mapDefined, + matchPatternOrExact, + min, + normalizePath, + pathContainsNodeModules, + pathIsBareSpecifier, + pathIsRelative, + removeFileExtension, + removeSuffix, + resolvePath, + some, + startsWith, + startsWithDirectory, + stringContains, + toPath, + tryGetExtensionFromPath, + tryParsePatterns, } from "./_namespaces/ts"; // Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers. diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 417f2719bdd01..392467212a7ff 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,69 +1,388 @@ import * as ts from "./_namespaces/ts"; import { - AccessorDeclaration, addRange, addRelatedInfo, AmdDependency, append, ArrayBindingElement, ArrayBindingPattern, - ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AssertClause, AssertEntry, AssertionLevel, - AsteriskToken, attachFileToDiagnostics, AwaitExpression, BaseNodeFactory, BinaryExpression, BinaryOperatorToken, - BindingElement, BindingName, BindingPattern, Block, BooleanLiteral, BreakOrContinueStatement, BreakStatement, - CallExpression, CallSignatureDeclaration, canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, - CharacterCodes, CheckJsDirective, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, - ClassStaticBlockDeclaration, CommaListExpression, CommentDirective, commentPragmas, CommentRange, - ComputedPropertyName, concatenate, ConditionalExpression, ConditionalTypeNode, ConstructorDeclaration, - ConstructorTypeNode, ConstructSignatureDeclaration, containsParseError, ContinueStatement, convertToObjectWorker, - createDetachedDiagnostic, createNodeFactory, createScanner, createTextChangeRange, createTextSpanFromBounds, Debug, - Decorator, DefaultClause, DeleteExpression, Diagnostic, DiagnosticMessage, Diagnostics, - DiagnosticWithDetachedLocation, DoStatement, DotDotDotToken, ElementAccessExpression, emptyArray, emptyMap, - EndOfFileToken, ensureScriptKind, EntityName, EnumDeclaration, EnumMember, ExclamationToken, - ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, ExpressionWithTypeArguments, - ExternalModuleReference, fileExtensionIsOneOf, FileReference, findIndex, forEach, ForEachChildNodes, - ForInOrOfStatement, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, - FunctionOrConstructorTypeNode, FunctionTypeNode, GetAccessorDeclaration, getBinaryOperatorPrecedence, getFullWidth, - getJSDocCommentRanges, getLanguageVariant, getLastChild, getLeadingCommentRanges, getSpellingSuggestion, - getTextOfNodeFromSourceText, HasJSDoc, hasJSDocNodes, HasModifiers, HeritageClause, Identifier, idText, IfStatement, - ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeAssertionContainer, ImportTypeNode, IndexedAccessTypeNode, IndexSignatureDeclaration, InferTypeNode, - InterfaceDeclaration, IntersectionTypeNode, isArray, isAssignmentOperator, isAsyncModifier, isClassMemberModifier, - isExportAssignment, isExportDeclaration, isExportModifier, isExpressionWithTypeArguments, isExternalModuleReference, - isFunctionTypeNode, isIdentifierText, isImportDeclaration, isImportEqualsDeclaration, isJSDocFunctionType, - isJSDocNullableType, isJSDocReturnTag, isJSDocTypeTag, isJsxOpeningElement, isJsxOpeningFragment, isKeyword, - isLeftHandSideExpression, isLiteralKind, isMetaProperty, isModifierKind, isNonNullExpression, isPrivateIdentifier, - isSetAccessorDeclaration, isStringOrNumericLiteralLike, isTaggedTemplateExpression, isTemplateLiteralKind, - isTypeReferenceNode, IterationStatement, JSDoc, JSDocAllType, JSDocAugmentsTag, JSDocAuthorTag, JSDocCallbackTag, - JSDocClassTag, JSDocComment, JSDocContainer, JSDocDeprecatedTag, JSDocEnumTag, JSDocFunctionType, - JSDocImplementsTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocMemberName, JSDocNameReference, - JSDocNamespaceDeclaration, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverrideTag, - JSDocParameterTag, JSDocPrivateTag, JSDocPropertyLikeTag, JSDocPropertyTag, JSDocProtectedTag, JSDocPublicTag, - JSDocReadonlyTag, JSDocReturnTag, JSDocSeeTag, JSDocSignature, JSDocSyntaxKind, JSDocTag, JSDocTemplateTag, - JSDocText, JSDocThisTag, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeLiteral, JSDocTypeTag, JSDocUnknownTag, - JSDocUnknownType, JSDocVariadicType, JsonMinusNumericLiteral, JsonObjectExpressionStatement, JsonSourceFile, - JsxAttribute, JsxAttributes, JsxAttributeValue, JsxChild, JsxClosingElement, JsxClosingFragment, JsxElement, - JsxExpression, JsxFragment, JsxOpeningElement, JsxOpeningFragment, JsxOpeningLikeElement, JsxSelfClosingElement, - JsxSpreadAttribute, JsxTagNameExpression, JsxTagNamePropertyAccess, JsxText, JsxTokenSyntaxKind, LabeledStatement, - LanguageVariant, lastOrUndefined, LeftHandSideExpression, LiteralExpression, LiteralLikeNode, LiteralTypeNode, map, - mapDefined, MappedTypeNode, MemberExpression, MetaProperty, MethodDeclaration, MethodSignature, MinusToken, - MissingDeclaration, Modifier, ModifierFlags, ModifierLike, ModifiersArray, modifiersToFlags, ModuleBlock, - ModuleDeclaration, ModuleKind, Mutable, NamedExportBindings, NamedExports, NamedImports, NamedImportsOrExports, - NamedTupleMember, NamespaceDeclaration, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, - Node, NodeArray, NodeFactoryFlags, NodeFlags, nodeIsMissing, nodeIsPresent, NonNullExpression, noop, normalizePath, - NoSubstitutionTemplateLiteral, NullLiteral, NumericLiteral, objectAllocator, ObjectBindingPattern, - ObjectLiteralElementLike, ObjectLiteralExpression, OperatorPrecedence, OptionalTypeNode, PackageJsonInfo, - ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, perfLogger, - PlusToken, PostfixUnaryExpression, PostfixUnaryOperator, PragmaDefinition, PragmaKindFlags, PragmaMap, - PragmaPseudoMap, PragmaPseudoMapEntry, PrefixUnaryExpression, PrefixUnaryOperator, PrimaryExpression, - PrivateIdentifier, PropertyAccessEntityNameExpression, PropertyAccessExpression, PropertyAssignment, - PropertyDeclaration, PropertyName, PropertySignature, QualifiedName, QuestionDotToken, QuestionToken, - ReadonlyKeyword, ReadonlyPragmaMap, ReadonlyTextRange, ResolutionMode, RestTypeNode, ReturnStatement, SatisfiesExpression, - ScriptKind, ScriptTarget, SetAccessorDeclaration, setParent, setParentRecursive, setTextRange, setTextRangePos, - setTextRangePosEnd, setTextRangePosWidth, ShorthandPropertyAssignment, skipTrivia, some, SourceFile, - SpreadAssignment, SpreadElement, startsWith, Statement, StringLiteral, supportedDeclarationExtensions, - SwitchStatement, SyntaxKind, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralToken, - TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateMiddle, TemplateSpan, TemplateTail, TextChangeRange, - textChangeRangeIsUnchanged, textChangeRangeNewSpan, TextRange, textSpanEnd, textToKeywordObj, ThisExpression, - ThisTypeNode, ThrowStatement, toArray, Token, TokenFlags, tokenIsIdentifierOrKeyword, - tokenIsIdentifierOrKeywordOrGreaterThan, tokenToString, tracing, TransformFlags, trimString, TryStatement, - TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeElement, TypeLiteralNode, TypeNode, TypeOfExpression, - TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnaryExpression, - UnionOrIntersectionTypeNode, UnionTypeNode, UpdateExpression, VariableDeclaration, VariableDeclarationList, - VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, + AccessorDeclaration, + AmdDependency, + ArrayBindingElement, + ArrayBindingPattern, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertClause, + AssertEntry, + AssertionLevel, + AsteriskToken, + AwaitExpression, + BaseNodeFactory, + BinaryExpression, + BinaryOperatorToken, + BindingElement, + BindingName, + BindingPattern, + Block, + BooleanLiteral, + BreakOrContinueStatement, + BreakStatement, + CallExpression, + CallSignatureDeclaration, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + CharacterCodes, + CheckJsDirective, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CommaListExpression, + CommentDirective, + CommentRange, + ComputedPropertyName, + ConditionalExpression, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + ContinueStatement, + Debug, + Decorator, + DefaultClause, + DeleteExpression, + Diagnostic, + DiagnosticMessage, + DiagnosticWithDetachedLocation, + Diagnostics, + DoStatement, + DotDotDotToken, + ElementAccessExpression, + EndOfFileToken, + EntityName, + EnumDeclaration, + EnumMember, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + ExternalModuleReference, + FileReference, + ForEachChildNodes, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + FunctionOrConstructorTypeNode, + FunctionTypeNode, + GetAccessorDeclaration, + HasJSDoc, + HasModifiers, + HeritageClause, + Identifier, + IfStatement, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeAssertionContainer, + ImportTypeNode, + IndexSignatureDeclaration, + IndexedAccessTypeNode, + InferTypeNode, + InterfaceDeclaration, + IntersectionTypeNode, + IterationStatement, + JSDoc, + JSDocAllType, + JSDocAugmentsTag, + JSDocAuthorTag, + JSDocCallbackTag, + JSDocClassTag, + JSDocComment, + JSDocContainer, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocFunctionType, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocMemberName, + JSDocNameReference, + JSDocNamespaceDeclaration, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocPropertyTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocSignature, + JSDocSyntaxKind, + JSDocTag, + JSDocTemplateTag, + JSDocText, + JSDocThisTag, + JSDocTypeExpression, + JSDocTypeLiteral, + JSDocTypeTag, + JSDocTypedefTag, + JSDocUnknownTag, + JSDocUnknownType, + JSDocVariadicType, + JsonMinusNumericLiteral, + JsonObjectExpressionStatement, + JsonSourceFile, + JsxAttribute, + JsxAttributeValue, + JsxAttributes, + JsxChild, + JsxClosingElement, + JsxClosingFragment, + JsxElement, + JsxExpression, + JsxFragment, + JsxOpeningElement, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxTagNameExpression, + JsxTagNamePropertyAccess, + JsxText, + JsxTokenSyntaxKind, + LabeledStatement, + LanguageVariant, + LeftHandSideExpression, + LiteralExpression, + LiteralLikeNode, + LiteralTypeNode, + MappedTypeNode, + MemberExpression, + MetaProperty, + MethodDeclaration, + MethodSignature, + MinusToken, + MissingDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + ModifiersArray, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + Mutable, + NamedExportBindings, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamedTupleMember, + NamespaceDeclaration, + NamespaceExport, + NamespaceExportDeclaration, + NamespaceImport, + NewExpression, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + NodeFactoryFlags, + NodeFlags, + NonNullExpression, + NullLiteral, + NumericLiteral, + ObjectBindingPattern, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OperatorPrecedence, + OptionalTypeNode, + PackageJsonInfo, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + PlusToken, + PostfixUnaryExpression, + PostfixUnaryOperator, + PragmaDefinition, + PragmaKindFlags, + PragmaMap, + PragmaPseudoMap, + PragmaPseudoMapEntry, + PrefixUnaryExpression, + PrefixUnaryOperator, + PrimaryExpression, + PrivateIdentifier, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + QualifiedName, + QuestionDotToken, + QuestionToken, + ReadonlyKeyword, + ReadonlyPragmaMap, + ReadonlyTextRange, + ResolutionMode, + RestTypeNode, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SourceFile, + SpreadAssignment, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TemplateHead, + TemplateLiteralToken, + TemplateLiteralTypeNode, + TemplateLiteralTypeSpan, + TemplateMiddle, + TemplateSpan, + TemplateTail, + TextChangeRange, + TextRange, + ThisExpression, + ThisTypeNode, + ThrowStatement, + Token, + TokenFlags, + TransformFlags, + TryStatement, + TupleTypeNode, + TypeAliasDeclaration, + TypeAssertion, + TypeElement, + TypeLiteralNode, + TypeNode, + TypeOfExpression, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + TypeQueryNode, + TypeReferenceNode, + UnaryExpression, + UnionOrIntersectionTypeNode, + UnionTypeNode, + UpdateExpression, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VoidExpression, + WhileStatement, + WithStatement, + YieldExpression, + addRange, + addRelatedInfo, + append, + attachFileToDiagnostics, + canHaveModifiers, + commentPragmas, + concatenate, + containsParseError, + convertToObjectWorker, + createDetachedDiagnostic, + createNodeFactory, + createScanner, + createTextChangeRange, + createTextSpanFromBounds, + emptyArray, + emptyMap, + ensureScriptKind, + fileExtensionIsOneOf, + findIndex, + forEach, + getBinaryOperatorPrecedence, + getFullWidth, + getJSDocCommentRanges, + getLanguageVariant, + getLastChild, + getLeadingCommentRanges, + getSpellingSuggestion, + getTextOfNodeFromSourceText, + hasJSDocNodes, + idText, + isArray, + isAssignmentOperator, + isAsyncModifier, + isClassMemberModifier, + isExportAssignment, + isExportDeclaration, + isExportModifier, + isExpressionWithTypeArguments, + isExternalModuleReference, + isFunctionTypeNode, + isIdentifierText, + isImportDeclaration, + isImportEqualsDeclaration, + isJSDocFunctionType, + isJSDocNullableType, + isJSDocReturnTag, + isJSDocTypeTag, + isJsxOpeningElement, + isJsxOpeningFragment, + isKeyword, + isLeftHandSideExpression, + isLiteralKind, + isMetaProperty, + isModifierKind, + isNonNullExpression, + isPrivateIdentifier, + isSetAccessorDeclaration, + isStringOrNumericLiteralLike, + isTaggedTemplateExpression, + isTemplateLiteralKind, + isTypeReferenceNode, + lastOrUndefined, + map, + mapDefined, + modifiersToFlags, + nodeIsMissing, + nodeIsPresent, + noop, + normalizePath, + objectAllocator, + perfLogger, + setParent, + setParentRecursive, + setTextRange, + setTextRangePos, + setTextRangePosEnd, + setTextRangePosWidth, + skipTrivia, + some, + startsWith, + supportedDeclarationExtensions, + textChangeRangeIsUnchanged, + textChangeRangeNewSpan, + textSpanEnd, + textToKeywordObj, + toArray, + tokenIsIdentifierOrKeyword, + tokenIsIdentifierOrKeywordOrGreaterThan, + tokenToString, + tracing, + trimString, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/path.ts b/src/compiler/path.ts index 7f84ae19c6a9b..e87e30aa4c3c2 100644 --- a/src/compiler/path.ts +++ b/src/compiler/path.ts @@ -1,7 +1,21 @@ import { - CharacterCodes, compareStringsCaseInsensitive, compareStringsCaseSensitive, compareValues, Comparison, Debug, - endsWith, equateStringsCaseInsensitive, equateStringsCaseSensitive, GetCanonicalFileName, getStringComparer, - identity, lastOrUndefined, Path, some, startsWith, stringContains, + CharacterCodes, + Comparison, + Debug, + GetCanonicalFileName, + Path, + compareStringsCaseInsensitive, + compareStringsCaseSensitive, + compareValues, + endsWith, + equateStringsCaseInsensitive, + equateStringsCaseSensitive, + getStringComparer, + identity, + lastOrUndefined, + some, + startsWith, + stringContains, } from "./_namespaces/ts"; /** diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index 2f0892b17dc1d..1076eb2705baa 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -1,5 +1,12 @@ import { - Debug, noop, Performance, PerformanceHooks, sys, System, timestamp, tryGetNativePerformanceHooks, + Debug, + Performance, + PerformanceHooks, + System, + noop, + sys, + timestamp, + tryGetNativePerformanceHooks, } from "./_namespaces/ts"; /** Performance measurements for the compiler. */ diff --git a/src/compiler/performanceCore.ts b/src/compiler/performanceCore.ts index 3788da62b9072..e124311b376f8 100644 --- a/src/compiler/performanceCore.ts +++ b/src/compiler/performanceCore.ts @@ -1,4 +1,8 @@ -import { isNodeLikeSystem, Version, VersionRange } from "./_namespaces/ts"; +import { + Version, + VersionRange, + isNodeLikeSystem, +} from "./_namespaces/ts"; // The following definitions provide the minimum compatible support for the Web Performance User Timings API // between browsers and NodeJS: diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c87abb6fc2d87..e2f470d144dbc 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,64 +1,318 @@ import * as ts from "./_namespaces/ts"; import { - __String, addEmitFlags, addRange, append, arrayFrom, arrayIsEqualTo, AsExpression, AssertClause, BuilderProgram, - CancellationToken, canHaveModifiers, chainDiagnosticMessages, changeExtension, changesAffectingProgramStructure, - changesAffectModuleResolution, clone, combinePaths, CommentDirective, CommentDirectivesMap, compareDataObjects, - comparePaths, compareValues, Comparison, CompilerHost, CompilerOptions, computeLineAndCharacterOfPosition, - concatenate, contains, containsIgnoredPath, containsPath, convertToRelativePath, createCommentDirectivesMap, - createCompilerDiagnostic, createCompilerDiagnosticFromMessageChain, createDiagnosticCollection, - createDiagnosticForNodeInSourceFile, createDiagnosticForRange, createFileDiagnostic, - createFileDiagnosticFromMessageChain, createGetCanonicalFileName, createInputFilesWithFilePaths, - createModeAwareCache, createModuleResolutionCache, createMultiMap, CreateProgramOptions, createSourceFile, - CreateSourceFileOptions, createSymlinkCache, createTypeChecker, createTypeReferenceDirectiveResolutionCache, - CustomTransformers, Debug, DeclarationWithTypeParameterChildren, Diagnostic, DiagnosticCategory, - diagnosticCategoryName, DiagnosticMessage, DiagnosticMessageChain, DiagnosticReporter, Diagnostics, - DiagnosticWithLocation, directorySeparator, DirectoryStructureHost, emitFiles, EmitFlags, EmitHost, EmitOnly, - EmitResult, emptyArray, ensureTrailingDirectorySeparator, equateStringsCaseInsensitive, equateStringsCaseSensitive, - explainIfFileIsRedirectAndImpliedFormat, ExportAssignment, ExportDeclaration, Extension, extensionFromPath, - externalHelpersModuleNameText, factory, fileExtensionIs, fileExtensionIsOneOf, FileIncludeKind, FileIncludeReason, - fileIncludeReasonToDiagnostics, FilePreprocessingDiagnostics, FilePreprocessingDiagnosticsKind, FileReference, - filter, find, firstDefined, firstDefinedIterator, flatMap, flatten, forEach, forEachAncestorDirectory, forEachChild, - forEachChildRecursively, forEachEmittedFile, forEachEntry, forEachKey, FunctionLikeDeclaration, - getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, getBaseFileName, GetCanonicalFileName, - getCommonSourceDirectoryOfConfig, getDefaultLibFileName, getDirectoryPath, getEmitDeclarations, getEmitModuleKind, - getEmitModuleResolutionKind, getEmitScriptTarget, getErrorSpanForNode, getExternalModuleName, - getJSXImplicitImportBase, getJSXRuntimeImport, getLineAndCharacterOfPosition, getLineStarts, getMatchedFileSpec, - getMatchedIncludeSpec, getNewLineCharacter, getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot, - getNormalizedPathComponents, getOutputDeclarationFileName, getOutputPathsForBundle, getPackageScopeForPath, - getPathFromPathComponents, getPositionOfLineAndCharacter, getPropertyArrayElementValue, getPropertyAssignment, - getResolutionMode, getResolutionName, getResolvedModule, getRootLength, getSetExternalModuleIndicator, - getSpellingSuggestion, getStrictOptionValue, getSupportedExtensions, - getSupportedExtensionsWithJsonIfResolveJsonModule, getTemporaryModuleResolutionState, getTextOfIdentifierOrLiteral, - getTransformers, getTsBuildInfoEmitOutputFilePath, getTsConfigObjectLiteralExpression, getTsConfigPropArray, - getTsConfigPropArrayElementValue, HasChangedAutomaticTypeDirectiveNames, hasChangesInResolutions, hasExtension, - HasInvalidatedResolutions, hasJSDocNodes, hasJSFileExtension, hasJsonModuleEmitEnabled, hasProperty, - hasSyntacticModifier, hasZeroOrOneAsteriskCharacter, HeritageClause, Identifier, identity, ImportClause, - ImportDeclaration, ImportOrExportSpecifier, InputFiles, inverseJsxOptionMap, isAmbientModule, isAnyImportOrReExport, - isArray, isArrayLiteralExpression, isBuildInfoFile, isCheckJsEnabledForFile, isDeclarationFileName, isDecorator, - isExportDeclaration, isExternalModule, isExternalModuleNameRelative, isIdentifierText, isImportCall, - isImportDeclaration, isImportEqualsDeclaration, isImportSpecifier, isImportTypeNode, isIncrementalCompilation, - isInJSFile, isLiteralImportTypeNode, isModifier, isModuleDeclaration, isObjectLiteralExpression, isPlainJsFile, - isRequireCall, isRootedDiskPath, isSourceFileJS, isString, isStringLiteral, isStringLiteralLike, isTraceEnabled, - JsonSourceFile, JsxEmit, length, libMap, libs, mapDefined, mapDefinedIterator, maybeBind, memoize, - MethodDeclaration, ModifierFlags, ModifierLike, ModuleBlock, ModuleDeclaration, ModuleKind, ModuleResolutionCache, - ModuleResolutionHost, ModuleResolutionInfo, moduleResolutionIsEqualTo, ModuleResolutionKind, Mutable, Node, - NodeArray, NodeFlags, nodeModulesPathPart, NodeWithTypeArguments, noop, normalizePath, notImplementedResolver, - noTransformers, ObjectLiteralExpression, OperationCanceledException, optionsHaveChanges, outFile, PackageId, - packageIdToPackageName, packageIdToString, PackageJsonInfoCache, padLeft, ParameterDeclaration, ParseConfigFileHost, - ParsedCommandLine, parseIsolatedEntityName, parseJsonSourceFileConfigFileContent, Path, pathIsAbsolute, - pathIsRelative, Program, ProgramHost, ProjectReference, ProjectReferenceFile, projectReferenceIsEqualTo, - PropertyDeclaration, ReferencedFile, removeFileExtension, removePrefix, removeSuffix, resolutionExtensionIsTSOrJson, - resolveConfigFileProjectName, ResolvedConfigFileName, ResolvedModuleFull, ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, ResolvedTypeReferenceDirective, resolveModuleName, resolveModuleNameFromCache, - resolveTypeReferenceDirective, returnFalse, returnUndefined, SatisfiesExpression, ScriptKind, ScriptTarget, - setParent, setParentRecursive, setResolvedModule, setResolvedTypeReferenceDirective, skipTrivia, skipTypeChecking, - some, sortAndDeduplicateDiagnostics, SortedReadonlyArray, SourceFile, sourceFileAffectingCompilerOptions, - sourceFileMayBeEmitted, SourceOfProjectReferenceRedirect, stableSort, startsWith, Statement, stringContains, - StringLiteral, StringLiteralLike, StructureIsReused, supportedJSExtensionsFlat, SymlinkCache, SyntaxKind, sys, - targetOptionDeclaration, toFileNameLowerCase, tokenToString, trace, tracing, trimStringEnd, TsConfigSourceFile, - TypeChecker, typeDirectiveIsEqualTo, TypeReferenceDirectiveResolutionCache, UnparsedSource, VariableDeclaration, - VariableStatement, walkUpParenthesizedExpressions, WriteFileCallback, WriteFileCallbackData, - writeFileEnsuringDirectories, zipToModeAwareCache, TypeReferenceDirectiveResolutionInfo, getResolvedTypeReferenceDirective, ResolutionMode, + AsExpression, + AssertClause, + BuilderProgram, + CancellationToken, + CommentDirective, + CommentDirectivesMap, + Comparison, + CompilerHost, + CompilerOptions, + CreateProgramOptions, + CreateSourceFileOptions, + CustomTransformers, + Debug, + DeclarationWithTypeParameterChildren, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticReporter, + DiagnosticWithLocation, + Diagnostics, + DirectoryStructureHost, + EmitFlags, + EmitHost, + EmitOnly, + EmitResult, + ExportAssignment, + ExportDeclaration, + Extension, + FileIncludeKind, + FileIncludeReason, + FilePreprocessingDiagnostics, + FilePreprocessingDiagnosticsKind, + FileReference, + FunctionLikeDeclaration, + GetCanonicalFileName, + HasChangedAutomaticTypeDirectiveNames, + HasInvalidatedResolutions, + HeritageClause, + Identifier, + ImportClause, + ImportDeclaration, + ImportOrExportSpecifier, + InputFiles, + JsonSourceFile, + JsxEmit, + MethodDeclaration, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + ModuleResolutionKind, + Mutable, + Node, + NodeArray, + NodeFlags, + NodeWithTypeArguments, + ObjectLiteralExpression, + OperationCanceledException, + PackageId, + PackageJsonInfoCache, + ParameterDeclaration, + ParseConfigFileHost, + ParsedCommandLine, + Path, + Program, + ProgramHost, + ProjectReference, + ProjectReferenceFile, + PropertyDeclaration, + ReferencedFile, + ResolutionMode, + ResolvedConfigFileName, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SortedReadonlyArray, + SourceFile, + SourceOfProjectReferenceRedirect, + Statement, + StringLiteral, + StringLiteralLike, + StructureIsReused, + SymlinkCache, + SyntaxKind, + TsConfigSourceFile, + TypeChecker, + TypeReferenceDirectiveResolutionCache, + TypeReferenceDirectiveResolutionInfo, + UnparsedSource, + VariableDeclaration, + VariableStatement, + WriteFileCallback, + WriteFileCallbackData, + __String, + addEmitFlags, + addRange, + append, + arrayFrom, + arrayIsEqualTo, + canHaveModifiers, + chainDiagnosticMessages, + changeExtension, + changesAffectModuleResolution, + changesAffectingProgramStructure, + clone, + combinePaths, + compareDataObjects, + comparePaths, + compareValues, + computeLineAndCharacterOfPosition, + concatenate, + contains, + containsIgnoredPath, + containsPath, + convertToRelativePath, + createCommentDirectivesMap, + createCompilerDiagnostic, + createCompilerDiagnosticFromMessageChain, + createDiagnosticCollection, + createDiagnosticForNodeInSourceFile, + createDiagnosticForRange, + createFileDiagnostic, + createFileDiagnosticFromMessageChain, + createGetCanonicalFileName, + createInputFilesWithFilePaths, + createModeAwareCache, + createModuleResolutionCache, + createMultiMap, + createSourceFile, + createSymlinkCache, + createTypeChecker, + createTypeReferenceDirectiveResolutionCache, + diagnosticCategoryName, + directorySeparator, + emitFiles, + emptyArray, + ensureTrailingDirectorySeparator, + equateStringsCaseInsensitive, + equateStringsCaseSensitive, + explainIfFileIsRedirectAndImpliedFormat, + extensionFromPath, + externalHelpersModuleNameText, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + fileIncludeReasonToDiagnostics, + filter, + find, + firstDefined, + firstDefinedIterator, + flatMap, + flatten, + forEach, + forEachAncestorDirectory, + forEachChild, + forEachChildRecursively, + forEachEmittedFile, + forEachEntry, + forEachKey, + getAllowJSCompilerOption, + getAutomaticTypeDirectiveNames, + getBaseFileName, + getCommonSourceDirectoryOfConfig, + getDefaultLibFileName, + getDirectoryPath, + getEmitDeclarations, + getEmitModuleKind, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getErrorSpanForNode, + getExternalModuleName, + getJSXImplicitImportBase, + getJSXRuntimeImport, + getLineAndCharacterOfPosition, + getLineStarts, + getMatchedFileSpec, + getMatchedIncludeSpec, + getNewLineCharacter, + getNormalizedAbsolutePath, + getNormalizedAbsolutePathWithoutRoot, + getNormalizedPathComponents, + getOutputDeclarationFileName, + getOutputPathsForBundle, + getPackageScopeForPath, + getPathFromPathComponents, + getPositionOfLineAndCharacter, + getPropertyArrayElementValue, + getPropertyAssignment, + getResolutionMode, + getResolutionName, + getResolvedModule, + getResolvedTypeReferenceDirective, + getRootLength, + getSetExternalModuleIndicator, + getSpellingSuggestion, + getStrictOptionValue, + getSupportedExtensions, + getSupportedExtensionsWithJsonIfResolveJsonModule, + getTemporaryModuleResolutionState, + getTextOfIdentifierOrLiteral, + getTransformers, + getTsBuildInfoEmitOutputFilePath, + getTsConfigObjectLiteralExpression, + getTsConfigPropArray, + getTsConfigPropArrayElementValue, + hasChangesInResolutions, + hasExtension, + hasJSDocNodes, + hasJSFileExtension, + hasJsonModuleEmitEnabled, + hasProperty, + hasSyntacticModifier, + hasZeroOrOneAsteriskCharacter, + identity, + inverseJsxOptionMap, + isAmbientModule, + isAnyImportOrReExport, + isArray, + isArrayLiteralExpression, + isBuildInfoFile, + isCheckJsEnabledForFile, + isDeclarationFileName, + isDecorator, + isExportDeclaration, + isExternalModule, + isExternalModuleNameRelative, + isIdentifierText, + isImportCall, + isImportDeclaration, + isImportEqualsDeclaration, + isImportSpecifier, + isImportTypeNode, + isInJSFile, + isIncrementalCompilation, + isLiteralImportTypeNode, + isModifier, + isModuleDeclaration, + isObjectLiteralExpression, + isPlainJsFile, + isRequireCall, + isRootedDiskPath, + isSourceFileJS, + isString, + isStringLiteral, + isStringLiteralLike, + isTraceEnabled, + length, + libMap, + libs, + mapDefined, + mapDefinedIterator, + maybeBind, + memoize, + moduleResolutionIsEqualTo, + noTransformers, + nodeModulesPathPart, + noop, + normalizePath, + notImplementedResolver, + optionsHaveChanges, + outFile, + packageIdToPackageName, + packageIdToString, + padLeft, + parseIsolatedEntityName, + parseJsonSourceFileConfigFileContent, + pathIsAbsolute, + pathIsRelative, + projectReferenceIsEqualTo, + removeFileExtension, + removePrefix, + removeSuffix, + resolutionExtensionIsTSOrJson, + resolveConfigFileProjectName, + resolveModuleName, + resolveModuleNameFromCache, + resolveTypeReferenceDirective, + returnFalse, + returnUndefined, + setParent, + setParentRecursive, + setResolvedModule, + setResolvedTypeReferenceDirective, + skipTrivia, + skipTypeChecking, + some, + sortAndDeduplicateDiagnostics, + sourceFileAffectingCompilerOptions, + sourceFileMayBeEmitted, + stableSort, + startsWith, + stringContains, + supportedJSExtensionsFlat, + sys, + targetOptionDeclaration, + toFileNameLowerCase, + tokenToString, + trace, + tracing, + trimStringEnd, + typeDirectiveIsEqualTo, + walkUpParenthesizedExpressions, + writeFileEnsuringDirectories, + zipToModeAwareCache, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index ab3d8a880ec91..1f72a2c3367e5 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,21 +1,90 @@ import * as ts from "./_namespaces/ts"; import { - arrayToMap, CachedDirectoryStructureHost, CacheWithRedirects, CharacterCodes, clearMap, closeFileWatcher, - closeFileWatcherOf, CompilerOptions, contains, createCacheWithRedirects, createModeAwareCache, - createModuleResolutionCache, createMultiMap, createTypeReferenceDirectiveResolutionCache, Debug, Diagnostics, - directorySeparator, DirectoryWatcherCallback, emptyArray, emptyIterator, endsWith, Extension, extensionIsTS, - fileExtensionIs, fileExtensionIsOneOf, FileReference, FileWatcher, FileWatcherCallback, firstDefinedIterator, - GetCanonicalFileName, getDirectoryPath, getEffectiveTypeRoots, getModeForFileReference, getModeForResolutionAtIndex, - getModeForUsageLocation, getNormalizedAbsolutePath, getResolutionName, getRootLength, HasInvalidatedResolutions, - ignoredPaths, inferredTypesContainingFile, isEmittedFileOfProgram, isExternalModuleNameRelative, - isExternalOrCommonJsModule, isNodeModulesDirectory, isRootedDiskPath, isString, isStringLiteralLike, isTraceEnabled, - length, loadModuleFromGlobalCache, memoize, MinimalResolutionCacheHost, ModeAwareCache, - ModuleResolutionCache, ModuleResolutionHost, ModuleResolutionInfo, mutateMap, noopFileWatcher, normalizePath, - PackageId, packageIdToString, parseNodeModuleFromPath, Path, pathContainsNodeModules, PerModuleNameCache, Program, - removeSuffix, removeTrailingDirectorySeparator, resolutionExtensionIsTSOrJson, ResolutionMode, ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirective, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnTrue, some, SourceFile, startsWith, - stringContains, trace, TypeReferenceDirectiveResolutionInfo, unorderedRemoveItem, WatchDirectoryFlags, + CacheWithRedirects, + CachedDirectoryStructureHost, + CharacterCodes, + CompilerOptions, + Debug, + Diagnostics, + DirectoryWatcherCallback, + Extension, + FileReference, + FileWatcher, + FileWatcherCallback, + GetCanonicalFileName, + HasInvalidatedResolutions, + MinimalResolutionCacheHost, + ModeAwareCache, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + PackageId, + Path, + PerModuleNameCache, + Program, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + SourceFile, + TypeReferenceDirectiveResolutionInfo, + WatchDirectoryFlags, + arrayToMap, + clearMap, + closeFileWatcher, + closeFileWatcherOf, + contains, + createCacheWithRedirects, + createModeAwareCache, + createModuleResolutionCache, + createMultiMap, + createTypeReferenceDirectiveResolutionCache, + directorySeparator, + emptyArray, + emptyIterator, + endsWith, + extensionIsTS, + fileExtensionIs, + fileExtensionIsOneOf, + firstDefinedIterator, + getDirectoryPath, + getEffectiveTypeRoots, + getModeForFileReference, + getModeForResolutionAtIndex, + getModeForUsageLocation, + getNormalizedAbsolutePath, + getResolutionName, + getRootLength, + ignoredPaths, + inferredTypesContainingFile, + isEmittedFileOfProgram, + isExternalModuleNameRelative, + isExternalOrCommonJsModule, + isNodeModulesDirectory, + isRootedDiskPath, + isString, + isStringLiteralLike, + isTraceEnabled, + length, + loadModuleFromGlobalCache, + memoize, + mutateMap, + noopFileWatcher, + normalizePath, + packageIdToString, + parseNodeModuleFromPath, + pathContainsNodeModules, + removeSuffix, + removeTrailingDirectorySeparator, + resolutionExtensionIsTSOrJson, + returnTrue, + some, + startsWith, + stringContains, + trace, + unorderedRemoveItem, } from "./_namespaces/ts"; /** diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 643df8727844c..eec80e9eede43 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1,8 +1,31 @@ import { - append, arraysEqual, binarySearch, CharacterCodes, CommentDirective, CommentDirectiveType, CommentKind, - CommentRange, compareValues, Debug, DiagnosticMessage, Diagnostics, getEntries, identity, JSDocSyntaxKind, - JsxTokenSyntaxKind, KeywordSyntaxKind, LanguageVariant, LineAndCharacter, MapLike, parsePseudoBigInt, - positionIsSynthesized, ScriptTarget, SourceFileLike, SyntaxKind, TokenFlags, trimStringStart, + CharacterCodes, + CommentDirective, + CommentDirectiveType, + CommentKind, + CommentRange, + Debug, + DiagnosticMessage, + Diagnostics, + JSDocSyntaxKind, + JsxTokenSyntaxKind, + KeywordSyntaxKind, + LanguageVariant, + LineAndCharacter, + MapLike, + ScriptTarget, + SourceFileLike, + SyntaxKind, + TokenFlags, + append, + arraysEqual, + binarySearch, + compareValues, + getEntries, + identity, + parsePseudoBigInt, + positionIsSynthesized, + trimStringStart, } from "./_namespaces/ts"; export type ErrorCallback = (message: DiagnosticMessage, length: number) => void; diff --git a/src/compiler/semver.ts b/src/compiler/semver.ts index c91595719b743..77f3477327541 100644 --- a/src/compiler/semver.ts +++ b/src/compiler/semver.ts @@ -1,5 +1,14 @@ import { - compareStringsCaseSensitive, compareValues, Comparison, Debug, emptyArray, every, isArray, map, some, trimString, + Comparison, + Debug, + compareStringsCaseSensitive, + compareValues, + emptyArray, + every, + isArray, + map, + some, + trimString, } from "./_namespaces/ts"; // https://semver.org/#spec-item-2 diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 3c86ba8564dc2..0ee96bf209fd5 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,9 +1,30 @@ import { - arrayFrom, binarySearchKey, CharacterCodes, combinePaths, compareValues, Debug, DocumentPosition, - DocumentPositionMapper, DocumentPositionMapperHost, EmitHost, emptyArray, every, getDirectoryPath, - getNormalizedAbsolutePath, getPositionOfLineAndCharacter, getRelativePathToDirectoryOrUrl, identity, isArray, - isString, LineAndCharacter, RawSourceMap, some, sortAndDeduplicate, SortedReadonlyArray, - SourceMapGenerator, trimStringEnd, + CharacterCodes, + Debug, + DocumentPosition, + DocumentPositionMapper, + DocumentPositionMapperHost, + EmitHost, + LineAndCharacter, + RawSourceMap, + SortedReadonlyArray, + SourceMapGenerator, + arrayFrom, + binarySearchKey, + combinePaths, + compareValues, + emptyArray, + every, + getDirectoryPath, + getNormalizedAbsolutePath, + getPositionOfLineAndCharacter, + getRelativePathToDirectoryOrUrl, + identity, + isArray, + isString, + some, + sortAndDeduplicate, + trimStringEnd, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/symbolWalker.ts b/src/compiler/symbolWalker.ts index 71277f27d7d5c..70fd4b0d75b2f 100644 --- a/src/compiler/symbolWalker.ts +++ b/src/compiler/symbolWalker.ts @@ -1,7 +1,29 @@ import { - clear, EntityNameOrEntityNameExpression, forEach, getOwnValues, getSymbolId, Identifier, IndexedAccessType, - IndexType, InterfaceType, MappedType, Node, ObjectFlags, ObjectType, ResolvedType, Signature, Symbol, SymbolWalker, - SyntaxKind, Type, TypeFlags, TypeParameter, TypePredicate, TypeQueryNode, TypeReference, UnionOrIntersectionType, + EntityNameOrEntityNameExpression, + Identifier, + IndexType, + IndexedAccessType, + InterfaceType, + MappedType, + Node, + ObjectFlags, + ObjectType, + ResolvedType, + Signature, + Symbol, + SymbolWalker, + SyntaxKind, + Type, + TypeFlags, + TypeParameter, + TypePredicate, + TypeQueryNode, + TypeReference, + UnionOrIntersectionType, + clear, + forEach, + getOwnValues, + getSymbolId, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 31df7422cd14e..ab28c7e572c93 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,11 +1,51 @@ import { - AssertionLevel, closeFileWatcher, closeFileWatcherOf, combinePaths, Comparison, contains, containsPath, - createGetCanonicalFileName, createMultiMap, Debug, directorySeparator, emptyArray, emptyFileSystemEntries, endsWith, - enumerateInsertsAndDeletes, FileSystemEntries, getDirectoryPath, getFallbackOptions, - getNormalizedAbsolutePath, getRelativePathToDirectoryOrUrl, getRootLength, getStringComparer, isArray, isNodeLikeSystem, isString, - mapDefined, matchesExclude, matchFiles, memoize, noop, normalizePath, normalizeSlashes, orderedRemoveItem, - Path, perfLogger, PollingWatchKind, RequireResult, resolveJSModule, some, startsWith, stringContains, timestamp, - unorderedRemoveItem, WatchDirectoryKind, WatchFileKind, WatchOptions, writeFileEnsuringDirectories, + AssertionLevel, + Comparison, + Debug, + FileSystemEntries, + Path, + PollingWatchKind, + RequireResult, + WatchDirectoryKind, + WatchFileKind, + WatchOptions, + closeFileWatcher, + closeFileWatcherOf, + combinePaths, + contains, + containsPath, + createGetCanonicalFileName, + createMultiMap, + directorySeparator, + emptyArray, + emptyFileSystemEntries, + endsWith, + enumerateInsertsAndDeletes, + getDirectoryPath, + getFallbackOptions, + getNormalizedAbsolutePath, + getRelativePathToDirectoryOrUrl, + getRootLength, + getStringComparer, + isArray, + isNodeLikeSystem, + isString, + mapDefined, + matchFiles, + matchesExclude, + memoize, + noop, + normalizePath, + normalizeSlashes, + orderedRemoveItem, + perfLogger, + resolveJSModule, + some, + startsWith, + stringContains, + timestamp, + unorderedRemoveItem, + writeFileEnsuringDirectories, } from "./_namespaces/ts"; declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; diff --git a/src/compiler/tracing.ts b/src/compiler/tracing.ts index f53b477c5dac4..6626294c00bc7 100644 --- a/src/compiler/tracing.ts +++ b/src/compiler/tracing.ts @@ -1,7 +1,25 @@ import { - combinePaths, ConditionalType, Debug, EvolvingArrayType, getLineAndCharacterOfPosition, getSourceFileOfNode, - IndexedAccessType, IndexType, IntersectionType, LineAndCharacter, Node, ObjectFlags, Path, ReverseMappedType, - SubstitutionType, timestamp, Type, TypeFlags, TypeReference, unescapeLeadingUnderscores, UnionType, + ConditionalType, + Debug, + EvolvingArrayType, + IndexType, + IndexedAccessType, + IntersectionType, + LineAndCharacter, + Node, + ObjectFlags, + Path, + ReverseMappedType, + SubstitutionType, + Type, + TypeFlags, + TypeReference, + UnionType, + combinePaths, + getLineAndCharacterOfPosition, + getSourceFileOfNode, + timestamp, + unescapeLeadingUnderscores, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 72cc5fde5ad36..eda2672939caa 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,15 +1,76 @@ import { - addRange, append, Bundle, chainBundle, CompilerOptions, createEmitHelperFactory, CustomTransformer, - CustomTransformerFactory, CustomTransformers, Debug, DiagnosticWithLocation, disposeEmitNodes, EmitFlags, - EmitHelper, EmitHint, EmitHost, EmitOnly, EmitResolver, EmitTransformers, emptyArray, factory, FunctionDeclaration, - getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getJSXTransformEnabled, getParseTreeNode, getSourceFileOfNode, - Identifier, isBundle, isSourceFile, LexicalEnvironmentFlags, map, memoize, ModuleKind, Node, NodeFactory, NodeFlags, - noop, notImplemented, returnUndefined, ScriptTarget, setEmitFlags, some, SourceFile, Statement, SyntaxKind, tracing, - TransformationContext, TransformationResult, transformClassFields, transformDeclarations, transformECMAScriptModule, - Transformer, TransformerFactory, transformES2015, transformES2016, transformES2017, transformES2018, - transformES2019, transformES2020, transformES2021, transformES5, transformESNext, transformGenerators, transformJsx, - transformLegacyDecorators, transformModule, transformNodeModule, transformSystemModule, transformTypeScript, + Bundle, + CompilerOptions, + CustomTransformer, + CustomTransformerFactory, + CustomTransformers, + Debug, + DiagnosticWithLocation, + EmitFlags, + EmitHelper, + EmitHint, + EmitHost, + EmitOnly, + EmitResolver, + EmitTransformers, + FunctionDeclaration, + Identifier, + LexicalEnvironmentFlags, + ModuleKind, + Node, + NodeFactory, + NodeFlags, + ScriptTarget, + SourceFile, + Statement, + SyntaxKind, + TransformationContext, + TransformationResult, + Transformer, + TransformerFactory, VariableDeclaration, + addRange, + append, + chainBundle, + createEmitHelperFactory, + disposeEmitNodes, + emptyArray, + factory, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getJSXTransformEnabled, + getParseTreeNode, + getSourceFileOfNode, + isBundle, + isSourceFile, + map, + memoize, + noop, + notImplemented, + returnUndefined, + setEmitFlags, + some, + tracing, + transformClassFields, + transformDeclarations, + transformECMAScriptModule, + transformES2015, + transformES2016, + transformES2017, + transformES2018, + transformES2019, + transformES2020, + transformES2021, + transformES5, + transformESNext, + transformGenerators, + transformJsx, + transformLegacyDecorators, + transformModule, + transformNodeModule, + transformSystemModule, + transformTypeScript, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index e007a7d7475a8..4a150992b040b 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -1,39 +1,175 @@ import { - __String, AccessorDeclaration, addEmitFlags, addEmitHelpers, addRange, append, AssignmentOperator, - AssignmentPattern, AutoAccessorPropertyDeclaration, BinaryExpression, BindingOrAssignmentElement, CallExpression, - chainBundle, ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, - classOrConstructorParameterIsDecorated, ClassStaticBlockDeclaration, compact, ComputedPropertyName, - ConstructorDeclaration, createAccessorPropertyBackingField, createAccessorPropertyGetRedirector, - createAccessorPropertySetRedirector, createMemberAccessForPropertyName, Debug, ElementAccessExpression, EmitFlags, - EmitHint, expandPreOrPostfixIncrementOrDecrementExpression, Expression, ExpressionStatement, - ExpressionWithTypeArguments, factory, filter, findSuperStatementIndex, ForStatement, GeneratedIdentifier, - GeneratedIdentifierFlags, GeneratedNamePart, GeneratedPrivateIdentifier, GetAccessorDeclaration, getCommentRange, - getEffectiveBaseTypeNode, getEmitFlags, getEmitScriptTarget, getInitializerOfBindingOrAssignmentElement, - getNameOfDeclaration, getNodeForGeneratedName, getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, - getOriginalNodeId, getProperties, getSourceMapRange, getStaticPropertiesAndClassStaticBlock, - getTargetOfBindingOrAssignmentElement, getUseDefineForClassFields, hasAbstractModifier, hasAccessorModifier, - hasDecorators, hasStaticModifier, hasSyntacticModifier, Identifier, InKeyword, isAccessorModifier, - isArrayLiteralExpression, isArrowFunction, isAssignmentExpression, isAutoAccessorPropertyDeclaration, isCallChain, - isClassDeclaration, isClassElement, isClassStaticBlockDeclaration, isCompoundAssignment, isComputedPropertyName, - isConstructorDeclaration, isDestructuringAssignment, isElementAccessExpression, isExpression, isForInitializer, - isGeneratedIdentifier, isGeneratedPrivateIdentifier, isGetAccessor, isGetAccessorDeclaration, isHeritageClause, - isIdentifier, isInitializedProperty, isMethodDeclaration, isModifier, isModifierLike, - isNonStaticMethodOrAccessorWithPrivateName, isObjectBindingOrAssignmentElement, isObjectLiteralElementLike, - isParameterPropertyDeclaration, isParenthesizedExpression, isPrefixUnaryExpression, isPrivateIdentifier, - isPrivateIdentifierClassElementDeclaration, isPrivateIdentifierPropertyAccessExpression, isPropertyAccessExpression, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isSetAccessor, isSetAccessorDeclaration, - isShorthandPropertyAssignment, isSimpleCopiableExpression, isSimpleInlineableExpression, isSpreadAssignment, - isSpreadElement, isStatement, isStatic, isStaticModifier, isSuperProperty, isTemplateLiteral, isThisProperty, - LeftHandSideExpression, map, MethodDeclaration, Modifier, ModifierFlags, moveRangePastModifiers, moveRangePos, - Node, NodeCheckFlags, nodeIsSynthesized, ObjectLiteralElementLike, PostfixUnaryExpression, PrefixUnaryExpression, - PrivateIdentifier, PrivateIdentifierPropertyAccessExpression, PrivateIdentifierPropertyDeclaration, - PropertyAccessExpression, PropertyDeclaration, PropertyName, ScriptTarget, SetAccessorDeclaration, setCommentRange, - setEmitFlags, setOriginalNode, setSourceMapRange, setSyntheticLeadingComments, setSyntheticTrailingComments, - setTextRange, skipOuterExpressions, skipParentheses, skipPartiallyEmittedExpressions, some, SourceFile, - startOnNewLine, Statement, SuperProperty, SyntaxKind, TaggedTemplateExpression, ThisExpression, - TransformationContext, TransformFlags, tryGetTextOfPropertyName, UnderscoreEscapedMap, unescapeLeadingUnderscores, - VariableStatement, visitArray, visitEachChild, visitFunctionBody, visitIterationBody, visitNode, visitNodes, - visitParameterList, VisitResult, Bundle, + AccessorDeclaration, + AssignmentOperator, + AssignmentPattern, + AutoAccessorPropertyDeclaration, + BinaryExpression, + BindingOrAssignmentElement, + Bundle, + CallExpression, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + ComputedPropertyName, + ConstructorDeclaration, + Debug, + ElementAccessExpression, + EmitFlags, + EmitHint, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + ForStatement, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedNamePart, + GeneratedPrivateIdentifier, + GetAccessorDeclaration, + Identifier, + InKeyword, + LeftHandSideExpression, + MethodDeclaration, + Modifier, + ModifierFlags, + Node, + NodeCheckFlags, + ObjectLiteralElementLike, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateIdentifier, + PrivateIdentifierPropertyAccessExpression, + PrivateIdentifierPropertyDeclaration, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + ScriptTarget, + SetAccessorDeclaration, + SourceFile, + Statement, + SuperProperty, + SyntaxKind, + TaggedTemplateExpression, + ThisExpression, + TransformFlags, + TransformationContext, + UnderscoreEscapedMap, + VariableStatement, + VisitResult, + __String, + addEmitFlags, + addEmitHelpers, + addRange, + append, + chainBundle, + classOrConstructorParameterIsDecorated, + compact, + createAccessorPropertyBackingField, + createAccessorPropertyGetRedirector, + createAccessorPropertySetRedirector, + createMemberAccessForPropertyName, + expandPreOrPostfixIncrementOrDecrementExpression, + factory, + filter, + findSuperStatementIndex, + getCommentRange, + getEffectiveBaseTypeNode, + getEmitFlags, + getEmitScriptTarget, + getInitializerOfBindingOrAssignmentElement, + getNameOfDeclaration, + getNodeForGeneratedName, + getNonAssignmentOperatorForCompoundAssignment, + getOriginalNode, + getOriginalNodeId, + getProperties, + getSourceMapRange, + getStaticPropertiesAndClassStaticBlock, + getTargetOfBindingOrAssignmentElement, + getUseDefineForClassFields, + hasAbstractModifier, + hasAccessorModifier, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + isAccessorModifier, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentExpression, + isAutoAccessorPropertyDeclaration, + isCallChain, + isClassDeclaration, + isClassElement, + isClassStaticBlockDeclaration, + isCompoundAssignment, + isComputedPropertyName, + isConstructorDeclaration, + isDestructuringAssignment, + isElementAccessExpression, + isExpression, + isForInitializer, + isGeneratedIdentifier, + isGeneratedPrivateIdentifier, + isGetAccessor, + isGetAccessorDeclaration, + isHeritageClause, + isIdentifier, + isInitializedProperty, + isMethodDeclaration, + isModifier, + isModifierLike, + isNonStaticMethodOrAccessorWithPrivateName, + isObjectBindingOrAssignmentElement, + isObjectLiteralElementLike, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPrivateIdentifierPropertyAccessExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isSetAccessor, + isSetAccessorDeclaration, + isShorthandPropertyAssignment, + isSimpleCopiableExpression, + isSimpleInlineableExpression, + isSpreadAssignment, + isSpreadElement, + isStatement, + isStatic, + isStaticModifier, + isSuperProperty, + isTemplateLiteral, + isThisProperty, + map, + moveRangePastModifiers, + moveRangePos, + nodeIsSynthesized, + setCommentRange, + setEmitFlags, + setOriginalNode, + setSourceMapRange, + setSyntheticLeadingComments, + setSyntheticTrailingComments, + setTextRange, + skipOuterExpressions, + skipParentheses, + skipPartiallyEmittedExpressions, + some, + startOnNewLine, + tryGetTextOfPropertyName, + unescapeLeadingUnderscores, + visitArray, + visitEachChild, + visitFunctionBody, + visitIterationBody, + visitNode, + visitNodes, + visitParameterList, } from "../_namespaces/ts"; const enum ClassPropertySubstitutionFlags { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 2a4f521e8881f..665c2ecded638 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,43 +1,215 @@ import { - AccessorDeclaration, addRelatedInfo, AllAccessorDeclarations, AnyImportSyntax, append, ArrayBindingElement, - arrayFrom, AssertClause, BindingElement, BindingName, BindingPattern, Bundle, CallSignatureDeclaration, - canHaveModifiers, canProduceDiagnostics, ClassDeclaration, CommentRange, compact, concatenate, ConditionalTypeNode, - ConstructorDeclaration, ConstructorTypeNode, ConstructSignatureDeclaration, contains, createDiagnosticForNode, - createEmptyExports, createGetSymbolAccessibilityDiagnosticForNode, - createGetSymbolAccessibilityDiagnosticForNodeName, createSymbolTable, createUnparsedSourceFile, Debug, Declaration, - DeclarationDiagnosticProducing, DeclarationName, declarationNameToString, Diagnostics, DiagnosticWithLocation, - EmitFlags, EmitHost, EmitResolver, emptyArray, EntityNameOrEntityNameExpression, EnumDeclaration, - ExportAssignment, ExportDeclaration, ExpressionWithTypeArguments, factory, FileReference, filter, flatMap, flatten, - forEach, FunctionDeclaration, FunctionTypeNode, GeneratedIdentifierFlags, GetAccessorDeclaration, getCommentRange, - getDirectoryPath, getEffectiveBaseTypeNode, getEffectiveModifierFlags, - getExternalModuleImportEqualsDeclarationExpression, getExternalModuleNameFromDeclaration, - getFirstConstructorWithBody, getLeadingCommentRanges, getLeadingCommentRangesOfNode, getLineAndCharacterOfPosition, - getNameOfDeclaration, getOriginalNodeId, getOutputPathsFor, getParseTreeNode, getRelativePathToDirectoryOrUrl, - getResolutionModeOverrideForClause, getResolvedExternalModuleName, getSetAccessorValueParameter, - getSourceFileOfNode, GetSymbolAccessibilityDiagnostic, getTextOfNode, getThisParameter, getTrailingCommentRanges, - hasDynamicName, hasEffectiveModifier, hasExtension, hasJSDocNodes, HasModifiers, hasSyntacticModifier, - HeritageClause, Identifier, ImportDeclaration, ImportEqualsDeclaration, ImportTypeNode, IndexSignatureDeclaration, - InterfaceDeclaration, isAnyImportSyntax, isArray, isBindingPattern, isClassDeclaration, isDeclaration, isEntityName, - isEntityNameExpression, isExportAssignment, isExportDeclaration, isExternalModule, isExternalModuleAugmentation, - isExternalModuleIndicator, isExternalModuleReference, isExternalOrCommonJsModule, isFunctionDeclaration, - isFunctionLike, isGlobalScopeAugmentation, isIdentifier, isImportDeclaration, isImportEqualsDeclaration, - isIndexSignatureDeclaration, isInterfaceDeclaration, isJsonSourceFile, isLateVisibilityPaintedStatement, - isLiteralImportTypeNode, isMappedTypeNode, isMethodDeclaration, isMethodSignature, isModifier, isModuleDeclaration, - isNightly, isOmittedExpression, isPrivateIdentifier, isPropertyAccessExpression, isPropertySignature, - isSemicolonClassElement, isSetAccessorDeclaration, isSourceFile, isSourceFileJS, isSourceFileNotJson, - isStringANonContextualKeyword, isStringLiteral, isStringLiteralLike, isTupleTypeNode, isTypeAliasDeclaration, - isTypeNode, isTypeParameterDeclaration, isTypeQueryNode, isUnparsedSource, last, LateBoundDeclaration, - LateVisibilityPaintedStatement, length, map, mapDefined, MethodDeclaration, MethodSignature, Modifier, - ModifierFlags, ModuleBody, ModuleDeclaration, NamedDeclaration, NamespaceDeclaration, - needsScopeMarker, Node, NodeArray, NodeBuilderFlags, NodeFlags, NodeId, normalizeSlashes, OmittedExpression, - orderedRemoveItem, ParameterDeclaration, parseNodeFactory, pathContainsNodeModules, pathIsRelative, - PropertyDeclaration, PropertySignature, pushIfUnique, removeAllComments, ResolutionMode, SetAccessorDeclaration, - setCommentRange, setEmitFlags, setOriginalNode, setParent, setTextRange, SignatureDeclaration, skipTrivia, some, - SourceFile, startsWith, Statement, stringContains, StringLiteral, Symbol, SymbolAccessibility, - SymbolAccessibilityResult, SymbolFlags, SymbolTracker, SyntaxKind, toFileNameLowerCase, toPath, - TransformationContext, transformNodes, tryCast, TypeAliasDeclaration, TypeNode, TypeParameterDeclaration, - TypeReferenceNode, unescapeLeadingUnderscores, UnparsedSource, VariableDeclaration, VariableStatement, visitArray, - visitEachChild, visitNode, visitNodes, VisitResult, + AccessorDeclaration, + AllAccessorDeclarations, + AnyImportSyntax, + ArrayBindingElement, + AssertClause, + BindingElement, + BindingName, + BindingPattern, + Bundle, + CallSignatureDeclaration, + ClassDeclaration, + CommentRange, + ConditionalTypeNode, + ConstructSignatureDeclaration, + ConstructorDeclaration, + ConstructorTypeNode, + Debug, + Declaration, + DeclarationDiagnosticProducing, + DeclarationName, + DiagnosticWithLocation, + Diagnostics, + EmitFlags, + EmitHost, + EmitResolver, + EntityNameOrEntityNameExpression, + EnumDeclaration, + ExportAssignment, + ExportDeclaration, + ExpressionWithTypeArguments, + FileReference, + FunctionDeclaration, + FunctionTypeNode, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + GetSymbolAccessibilityDiagnostic, + HasModifiers, + HeritageClause, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportTypeNode, + IndexSignatureDeclaration, + InterfaceDeclaration, + LateBoundDeclaration, + LateVisibilityPaintedStatement, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierFlags, + ModuleBody, + ModuleDeclaration, + NamedDeclaration, + NamespaceDeclaration, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + NodeId, + OmittedExpression, + ParameterDeclaration, + PropertyDeclaration, + PropertySignature, + ResolutionMode, + SetAccessorDeclaration, + SignatureDeclaration, + SourceFile, + Statement, + StringLiteral, + Symbol, + SymbolAccessibility, + SymbolAccessibilityResult, + SymbolFlags, + SymbolTracker, + SyntaxKind, + TransformationContext, + TypeAliasDeclaration, + TypeNode, + TypeParameterDeclaration, + TypeReferenceNode, + UnparsedSource, + VariableDeclaration, + VariableStatement, + VisitResult, + addRelatedInfo, + append, + arrayFrom, + canHaveModifiers, + canProduceDiagnostics, + compact, + concatenate, + contains, + createDiagnosticForNode, + createEmptyExports, + createGetSymbolAccessibilityDiagnosticForNode, + createGetSymbolAccessibilityDiagnosticForNodeName, + createSymbolTable, + createUnparsedSourceFile, + declarationNameToString, + emptyArray, + factory, + filter, + flatMap, + flatten, + forEach, + getCommentRange, + getDirectoryPath, + getEffectiveBaseTypeNode, + getEffectiveModifierFlags, + getExternalModuleImportEqualsDeclarationExpression, + getExternalModuleNameFromDeclaration, + getFirstConstructorWithBody, + getLeadingCommentRanges, + getLeadingCommentRangesOfNode, + getLineAndCharacterOfPosition, + getNameOfDeclaration, + getOriginalNodeId, + getOutputPathsFor, + getParseTreeNode, + getRelativePathToDirectoryOrUrl, + getResolutionModeOverrideForClause, + getResolvedExternalModuleName, + getSetAccessorValueParameter, + getSourceFileOfNode, + getTextOfNode, + getThisParameter, + getTrailingCommentRanges, + hasDynamicName, + hasEffectiveModifier, + hasExtension, + hasJSDocNodes, + hasSyntacticModifier, + isAnyImportSyntax, + isArray, + isBindingPattern, + isClassDeclaration, + isDeclaration, + isEntityName, + isEntityNameExpression, + isExportAssignment, + isExportDeclaration, + isExternalModule, + isExternalModuleAugmentation, + isExternalModuleIndicator, + isExternalModuleReference, + isExternalOrCommonJsModule, + isFunctionDeclaration, + isFunctionLike, + isGlobalScopeAugmentation, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isJsonSourceFile, + isLateVisibilityPaintedStatement, + isLiteralImportTypeNode, + isMappedTypeNode, + isMethodDeclaration, + isMethodSignature, + isModifier, + isModuleDeclaration, + isNightly, + isOmittedExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertySignature, + isSemicolonClassElement, + isSetAccessorDeclaration, + isSourceFile, + isSourceFileJS, + isSourceFileNotJson, + isStringANonContextualKeyword, + isStringLiteral, + isStringLiteralLike, + isTupleTypeNode, + isTypeAliasDeclaration, + isTypeNode, + isTypeParameterDeclaration, + isTypeQueryNode, + isUnparsedSource, + last, + length, + map, + mapDefined, + needsScopeMarker, + normalizeSlashes, + orderedRemoveItem, + parseNodeFactory, + pathContainsNodeModules, + pathIsRelative, + pushIfUnique, + removeAllComments, + setCommentRange, + setEmitFlags, + setOriginalNode, + setParent, + setTextRange, + skipTrivia, + some, + startsWith, + stringContains, + toFileNameLowerCase, + toPath, + transformNodes, + tryCast, + unescapeLeadingUnderscores, + visitArray, + visitEachChild, + visitNode, + visitNodes, } from "../_namespaces/ts"; import * as moduleSpecifiers from "../_namespaces/ts.moduleSpecifiers"; diff --git a/src/compiler/transformers/declarations/diagnostics.ts b/src/compiler/transformers/declarations/diagnostics.ts index bdd9903796ea4..ca62ec25c82c6 100644 --- a/src/compiler/transformers/declarations/diagnostics.ts +++ b/src/compiler/transformers/declarations/diagnostics.ts @@ -1,17 +1,64 @@ import { - BindingElement, CallSignatureDeclaration, ConstructorDeclaration, ConstructSignatureDeclaration, Debug, Declaration, - DeclarationName, DiagnosticMessage, Diagnostics, ExpressionWithTypeArguments, FunctionDeclaration, - GetAccessorDeclaration, getNameOfDeclaration, hasSyntacticModifier, ImportEqualsDeclaration, - IndexSignatureDeclaration, isBindingElement, isCallSignatureDeclaration, isClassDeclaration, - isConstructorDeclaration, isConstructSignatureDeclaration, isExpressionWithTypeArguments, isFunctionDeclaration, - isGetAccessor, isHeritageClause, isImportEqualsDeclaration, isIndexSignatureDeclaration, isJSDocTypeAlias, - isMethodDeclaration, isMethodSignature, isParameter, isParameterPropertyDeclaration, isPropertyAccessExpression, - isPropertyDeclaration, isPropertySignature, isSetAccessor, isStatic, isTypeAliasDeclaration, - isTypeParameterDeclaration, isVariableDeclaration, JSDocCallbackTag, JSDocEnumTag, JSDocTypedefTag, - MethodDeclaration, MethodSignature, ModifierFlags, NamedDeclaration, Node, ParameterDeclaration, - PropertyAccessExpression, PropertyDeclaration, PropertySignature, QualifiedName, SetAccessorDeclaration, - SymbolAccessibility, SymbolAccessibilityResult, SyntaxKind, TypeAliasDeclaration, TypeParameterDeclaration, + BindingElement, + CallSignatureDeclaration, + ConstructSignatureDeclaration, + ConstructorDeclaration, + Debug, + Declaration, + DeclarationName, + DiagnosticMessage, + Diagnostics, + ExpressionWithTypeArguments, + FunctionDeclaration, + GetAccessorDeclaration, + ImportEqualsDeclaration, + IndexSignatureDeclaration, + JSDocCallbackTag, + JSDocEnumTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + ModifierFlags, + NamedDeclaration, + Node, + ParameterDeclaration, + PropertyAccessExpression, + PropertyDeclaration, + PropertySignature, + QualifiedName, + SetAccessorDeclaration, + SymbolAccessibility, + SymbolAccessibilityResult, + SyntaxKind, + TypeAliasDeclaration, + TypeParameterDeclaration, VariableDeclaration, + getNameOfDeclaration, + hasSyntacticModifier, + isBindingElement, + isCallSignatureDeclaration, + isClassDeclaration, + isConstructSignatureDeclaration, + isConstructorDeclaration, + isExpressionWithTypeArguments, + isFunctionDeclaration, + isGetAccessor, + isHeritageClause, + isImportEqualsDeclaration, + isIndexSignatureDeclaration, + isJSDocTypeAlias, + isMethodDeclaration, + isMethodSignature, + isParameter, + isParameterPropertyDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isSetAccessor, + isStatic, + isTypeAliasDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index b4f4739a803bd..0f3044b63462b 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -1,17 +1,65 @@ import { - __String, addRange, append, ArrayBindingElement, ArrayBindingOrAssignmentPattern, BindingElement, BindingName, - BindingOrAssignmentElement, BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, Debug, - DestructuringAssignment, ElementAccessExpression, every, Expression, factory, forEach, - getElementsOfBindingOrAssignmentPattern, getInitializerOfBindingOrAssignmentElement, - getPropertyNameOfBindingOrAssignmentElement, getRestIndicatorOfBindingOrAssignmentElement, - getTargetOfBindingOrAssignmentElement, Identifier, idText, isArrayBindingElement, isArrayBindingOrAssignmentPattern, - isBindingElement, isBindingName, isBindingOrAssignmentPattern, isComputedPropertyName, isDeclarationBindingElement, - isDestructuringAssignment, isEmptyArrayLiteral, isEmptyObjectLiteral, isExpression, isIdentifier, - isLiteralExpression, isObjectBindingOrAssignmentPattern, isOmittedExpression, isPropertyNameLiteral, - isSimpleInlineableExpression, isStringOrNumericLiteralLike, isVariableDeclaration, last, LeftHandSideExpression, - map, Node, NodeFactory, nodeIsSynthesized, ObjectBindingOrAssignmentPattern, ParameterDeclaration, PropertyName, - setTextRange, some, TextRange, TransformationContext, TransformFlags, - tryGetPropertyNameOfBindingOrAssignmentElement, VariableDeclaration, visitNode, VisitResult, + ArrayBindingElement, + ArrayBindingOrAssignmentPattern, + BindingElement, + BindingName, + BindingOrAssignmentElement, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + Debug, + DestructuringAssignment, + ElementAccessExpression, + Expression, + Identifier, + LeftHandSideExpression, + Node, + NodeFactory, + ObjectBindingOrAssignmentPattern, + ParameterDeclaration, + PropertyName, + TextRange, + TransformFlags, + TransformationContext, + VariableDeclaration, + VisitResult, + __String, + addRange, + append, + every, + factory, + forEach, + getElementsOfBindingOrAssignmentPattern, + getInitializerOfBindingOrAssignmentElement, + getPropertyNameOfBindingOrAssignmentElement, + getRestIndicatorOfBindingOrAssignmentElement, + getTargetOfBindingOrAssignmentElement, + idText, + isArrayBindingElement, + isArrayBindingOrAssignmentPattern, + isBindingElement, + isBindingName, + isBindingOrAssignmentPattern, + isComputedPropertyName, + isDeclarationBindingElement, + isDestructuringAssignment, + isEmptyArrayLiteral, + isEmptyObjectLiteral, + isExpression, + isIdentifier, + isLiteralExpression, + isObjectBindingOrAssignmentPattern, + isOmittedExpression, + isPropertyNameLiteral, + isSimpleInlineableExpression, + isStringOrNumericLiteralLike, + isVariableDeclaration, + last, + map, + nodeIsSynthesized, + setTextRange, + some, + tryGetPropertyNameOfBindingOrAssignmentElement, + visitNode, } from "../_namespaces/ts"; interface FlattenContext { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 7168440df8da1..50910d77fed50 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,39 +1,209 @@ import { - __String, AccessorDeclaration, addEmitHelpers, addRange, addSyntheticLeadingComment, AllAccessorDeclarations, - append, arrayIsEqualTo, ArrayLiteralExpression, ArrowFunction, BinaryExpression, BindingElement, BindingPattern, - Block, BreakOrContinueStatement, CallExpression, CaseBlock, CaseClause, cast, CatchClause, chainBundle, - ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, CommaListExpression, ComputedPropertyName, - concatenate, ConstructorDeclaration, createExpressionForPropertyName, createMemberAccessForPropertyName, - createRange, createTokenRange, Debug, Declaration, DoStatement, elementAt, EmitFlags, EmitHint, emptyArray, - Expression, ExpressionStatement, ExpressionWithTypeArguments, filter, first, firstOrUndefined, flatMap, flatten, - flattenDestructuringAssignment, flattenDestructuringBinding, FlattenLevel, ForInStatement, ForOfStatement, - ForStatement, FunctionBody, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, - GeneratedIdentifierFlags, getAllAccessorDeclarations, getClassExtendsHeritageElement, getCombinedNodeFlags, - getCommentRange, getEmitFlags, getEnclosingBlockScopeContainer, getFirstConstructorWithBody, getNameOfDeclaration, - getOriginalNode, getParseTreeNode, getSourceMapRange, getSuperCallFromStatement, getUseDefineForClassFields, - hasStaticModifier, hasSyntacticModifier, Identifier, idText, IfStatement, insertStatementAfterCustomPrologue, - insertStatementsAfterCustomPrologue, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, - isArrowFunction, isAssignmentExpression, isBinaryExpression, isBindingPattern, isBlock, isCallExpression, - isCallToHelper, isCaseBlock, isCaseClause, isCatchClause, isClassElement, isClassLike, isComputedPropertyName, - isDefaultClause, isDestructuringAssignment, isExpression, isExpressionStatement, isForInitializer, isForStatement, - isFunctionExpression, isFunctionLike, isHoistedFunction, isHoistedVariableStatement, isIdentifier, - isIdentifierANonContextualKeyword, isIfStatement, isInternalName, isIterationStatement, isLabeledStatement, - isModifier, isObjectLiteralElementLike, isOmittedExpression, isPackedArrayLiteral, isPrivateIdentifier, - isPrologueDirective, isPropertyDeclaration, isPropertyName, isReturnStatement, isSpreadElement, isStatement, - isStatic, isSuperProperty, isSwitchStatement, isTryStatement, isVariableDeclarationList, isVariableStatement, - isWithStatement, IterationStatement, LabeledStatement, last, lastOrUndefined, LeftHandSideExpression, - LiteralExpression, map, MetaProperty, MethodDeclaration, ModifierFlags, moveRangeEnd, moveRangePos, - moveSyntheticComments, NamedDeclaration, NewExpression, Node, NodeArray, NodeCheckFlags, NodeFlags, - nodeIsSynthesized, NumericLiteral, ObjectLiteralElementLike, ObjectLiteralExpression, ParameterDeclaration, - ParenthesizedExpression, PrimaryExpression, ProcessLevel, processTaggedTemplateExpression, PropertyAssignment, - rangeEndIsOnSameLineAsRangeStart, ReturnStatement, SemicolonClassElement, setCommentRange, setEmitFlags, - setOriginalNode, setParent, setSourceMapRange, setTextRange, setTextRangeEnd, setTextRangePos, - setTokenSourceMapRange, ShorthandPropertyAssignment, singleOrMany, singleOrUndefined, skipOuterExpressions, - skipTrivia, some, SourceFile, spanMap, SpreadElement, startOnNewLine, Statement, StringLiteral, SwitchStatement, - SyntaxKind, TaggedTemplateExpression, takeWhile, TemplateExpression, TextRange, TokenFlags, TransformationContext, - TransformFlags, tryCast, unescapeLeadingUnderscores, unwrapInnermostStatementOfLabel, VariableDeclaration, - VariableDeclarationList, VariableStatement, visitEachChild, visitNode, visitNodes, visitParameterList, VisitResult, - VoidExpression, WhileStatement, YieldExpression, Bundle, + AccessorDeclaration, + AllAccessorDeclarations, + ArrayLiteralExpression, + ArrowFunction, + BinaryExpression, + BindingElement, + BindingPattern, + Block, + BreakOrContinueStatement, + Bundle, + CallExpression, + CaseBlock, + CaseClause, + CatchClause, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + CommaListExpression, + ComputedPropertyName, + ConstructorDeclaration, + Debug, + Declaration, + DoStatement, + EmitFlags, + EmitHint, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + FlattenLevel, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + Identifier, + IfStatement, + IterationStatement, + LabeledStatement, + LeftHandSideExpression, + LiteralExpression, + MetaProperty, + MethodDeclaration, + ModifierFlags, + NamedDeclaration, + NewExpression, + Node, + NodeArray, + NodeCheckFlags, + NodeFlags, + NumericLiteral, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + ParenthesizedExpression, + PrimaryExpression, + ProcessLevel, + PropertyAssignment, + ReturnStatement, + SemicolonClassElement, + ShorthandPropertyAssignment, + SourceFile, + SpreadElement, + Statement, + StringLiteral, + SwitchStatement, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TextRange, + TokenFlags, + TransformFlags, + TransformationContext, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VisitResult, + VoidExpression, + WhileStatement, + YieldExpression, + __String, + addEmitHelpers, + addRange, + addSyntheticLeadingComment, + append, + arrayIsEqualTo, + cast, + chainBundle, + concatenate, + createExpressionForPropertyName, + createMemberAccessForPropertyName, + createRange, + createTokenRange, + elementAt, + emptyArray, + filter, + first, + firstOrUndefined, + flatMap, + flatten, + flattenDestructuringAssignment, + flattenDestructuringBinding, + getAllAccessorDeclarations, + getClassExtendsHeritageElement, + getCombinedNodeFlags, + getCommentRange, + getEmitFlags, + getEnclosingBlockScopeContainer, + getFirstConstructorWithBody, + getNameOfDeclaration, + getOriginalNode, + getParseTreeNode, + getSourceMapRange, + getSuperCallFromStatement, + getUseDefineForClassFields, + hasStaticModifier, + hasSyntacticModifier, + idText, + insertStatementAfterCustomPrologue, + insertStatementsAfterCustomPrologue, + insertStatementsAfterStandardPrologue, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentExpression, + isBinaryExpression, + isBindingPattern, + isBlock, + isCallExpression, + isCallToHelper, + isCaseBlock, + isCaseClause, + isCatchClause, + isClassElement, + isClassLike, + isComputedPropertyName, + isDefaultClause, + isDestructuringAssignment, + isExpression, + isExpressionStatement, + isForInitializer, + isForStatement, + isFunctionExpression, + isFunctionLike, + isHoistedFunction, + isHoistedVariableStatement, + isIdentifier, + isIdentifierANonContextualKeyword, + isIfStatement, + isInternalName, + isIterationStatement, + isLabeledStatement, + isModifier, + isObjectLiteralElementLike, + isOmittedExpression, + isPackedArrayLiteral, + isPrivateIdentifier, + isPrologueDirective, + isPropertyDeclaration, + isPropertyName, + isReturnStatement, + isSpreadElement, + isStatement, + isStatic, + isSuperProperty, + isSwitchStatement, + isTryStatement, + isVariableDeclarationList, + isVariableStatement, + isWithStatement, + last, + lastOrUndefined, + map, + moveRangeEnd, + moveRangePos, + moveSyntheticComments, + nodeIsSynthesized, + processTaggedTemplateExpression, + rangeEndIsOnSameLineAsRangeStart, + setCommentRange, + setEmitFlags, + setOriginalNode, + setParent, + setSourceMapRange, + setTextRange, + setTextRangeEnd, + setTextRangePos, + setTokenSourceMapRange, + singleOrMany, + singleOrUndefined, + skipOuterExpressions, + skipTrivia, + some, + spanMap, + startOnNewLine, + takeWhile, + tryCast, + unescapeLeadingUnderscores, + unwrapInnermostStatementOfLabel, + visitEachChild, + visitNode, + visitNodes, + visitParameterList, } from "../_namespaces/ts"; const enum ES2015SubstitutionFlags { diff --git a/src/compiler/transformers/es2016.ts b/src/compiler/transformers/es2016.ts index ca3bbbb980432..ce6353ff8b0f0 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -1,7 +1,20 @@ import { - BinaryExpression, Bundle, chainBundle, Expression, isElementAccessExpression, isExpression, isPropertyAccessExpression, - Node, setTextRange, SourceFile, SyntaxKind, TransformationContext, TransformFlags, visitEachChild, visitNode, + BinaryExpression, + Bundle, + Expression, + Node, + SourceFile, + SyntaxKind, + TransformFlags, + TransformationContext, VisitResult, + chainBundle, + isElementAccessExpression, + isExpression, + isPropertyAccessExpression, + setTextRange, + visitEachChild, + visitNode, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 47a55560d5bf7..7a459426889e6 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -1,20 +1,100 @@ import { - __String, AccessorDeclaration, addEmitHelper, addEmitHelpers, advancedAsyncSuperHelper, ArrowFunction, - asyncSuperHelper, AwaitExpression, BindingElement, Block, CallExpression, CatchClause, chainBundle, - ClassDeclaration, concatenate, ConciseBody, ConstructorDeclaration, Debug, ElementAccessExpression, EmitFlags, - EmitHint, EmitResolver, Expression, forEach, ForInitializer, ForInStatement, ForOfStatement, ForStatement, - FunctionBody, FunctionDeclaration, FunctionExpression, FunctionFlags, FunctionLikeDeclaration, - GeneratedIdentifierFlags, GetAccessorDeclaration, getEmitScriptTarget, getEntityNameFromTypeNode, getFunctionFlags, - getInitializedVariables, getNodeId, getOriginalNode, insertStatementsAfterStandardPrologue, isBlock, isConciseBody, - isEffectiveStrictModeSourceFile, isEntityName, isExpression, isForInitializer, isFunctionLike, - isFunctionLikeDeclaration, isIdentifier, isModifierLike, isNodeWithPossibleHoistedDeclaration, isOmittedExpression, - isPropertyAccessExpression, isStatement, isSuperProperty, isToken, isVariableDeclarationList, - LeftHandSideExpression, map, MethodDeclaration, Node, NodeCheckFlags, NodeFactory, NodeFlags, ParameterDeclaration, - PropertyAccessExpression, PropertyAssignment, ScriptTarget, SetAccessorDeclaration, setEmitFlags, - setOriginalNode, setSourceMapRange, setTextRange, some, SourceFile, Statement, SyntaxKind, TextRange, - TransformationContext, TransformFlags, TypeNode, TypeReferenceSerializationKind, unescapeLeadingUnderscores, - VariableDeclaration, VariableDeclarationList, VariableStatement, visitEachChild, visitFunctionBody, - visitIterationBody, visitNode, visitNodes, visitParameterList, VisitResult, Bundle, + AccessorDeclaration, + ArrowFunction, + AwaitExpression, + BindingElement, + Block, + Bundle, + CallExpression, + CatchClause, + ClassDeclaration, + ConciseBody, + ConstructorDeclaration, + Debug, + ElementAccessExpression, + EmitFlags, + EmitHint, + EmitResolver, + Expression, + ForInStatement, + ForInitializer, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + LeftHandSideExpression, + MethodDeclaration, + Node, + NodeCheckFlags, + NodeFactory, + NodeFlags, + ParameterDeclaration, + PropertyAccessExpression, + PropertyAssignment, + ScriptTarget, + SetAccessorDeclaration, + SourceFile, + Statement, + SyntaxKind, + TextRange, + TransformFlags, + TransformationContext, + TypeNode, + TypeReferenceSerializationKind, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VisitResult, + __String, + addEmitHelper, + addEmitHelpers, + advancedAsyncSuperHelper, + asyncSuperHelper, + chainBundle, + concatenate, + forEach, + getEmitScriptTarget, + getEntityNameFromTypeNode, + getFunctionFlags, + getInitializedVariables, + getNodeId, + getOriginalNode, + insertStatementsAfterStandardPrologue, + isBlock, + isConciseBody, + isEffectiveStrictModeSourceFile, + isEntityName, + isExpression, + isForInitializer, + isFunctionLike, + isFunctionLikeDeclaration, + isIdentifier, + isModifierLike, + isNodeWithPossibleHoistedDeclaration, + isOmittedExpression, + isPropertyAccessExpression, + isStatement, + isSuperProperty, + isToken, + isVariableDeclarationList, + map, + setEmitFlags, + setOriginalNode, + setSourceMapRange, + setTextRange, + some, + unescapeLeadingUnderscores, + visitEachChild, + visitFunctionBody, + visitIterationBody, + visitNode, + visitNodes, + visitParameterList, } from "../_namespaces/ts"; type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration; diff --git a/src/compiler/transformers/es2018.ts b/src/compiler/transformers/es2018.ts index 7ef8dab1b6c4d..f3144fc4ee9eb 100644 --- a/src/compiler/transformers/es2018.ts +++ b/src/compiler/transformers/es2018.ts @@ -1,23 +1,115 @@ import { - __String, AccessorDeclaration, addEmitFlags, addEmitHelper, addEmitHelpers, addRange, advancedAsyncSuperHelper, - append, ArrowFunction, asyncSuperHelper, AwaitExpression, BinaryExpression, CallExpression, CatchClause, - chainBundle, CommaListExpression, concatenate, ConciseBody, ConstructorDeclaration, createForOfBindingStatement, - createSuperAccessVariableStatement, Debug, ElementAccessExpression, EmitFlags, EmitHint, Expression, - ExpressionStatement, flattenDestructuringAssignment, flattenDestructuringBinding, FlattenLevel, ForInitializer, - ForOfStatement, ForStatement, FunctionBody, FunctionDeclaration, FunctionExpression, FunctionFlags, - FunctionLikeDeclaration, GeneratedIdentifierFlags, GetAccessorDeclaration, getEmitScriptTarget, getFunctionFlags, - getNodeId, hasSyntacticModifier, Identifier, insertStatementsAfterStandardPrologue, isAssignmentPattern, - isBindingPattern, isBlock, isConciseBody, isDestructuringAssignment, isEffectiveStrictModeSourceFile, isExpression, - isForInitializer, isIdentifier, isModifier, isModifierLike, isObjectLiteralElementLike, isParameter, - isPropertyAccessExpression, isPropertyName, isStatement, isSuperProperty, isToken, isVariableDeclarationList, - LabeledStatement, LeftHandSideExpression, MethodDeclaration, ModifierFlags, Node, NodeCheckFlags, NodeFlags, - ObjectLiteralElementLike, ObjectLiteralExpression, ParameterDeclaration, ParenthesizedExpression, ProcessLevel, - processTaggedTemplateExpression, PropertyAccessExpression, ReturnStatement, ScriptTarget, - SetAccessorDeclaration, setEmitFlags, setOriginalNode, setSourceMapRange, setTextRange, SignatureDeclaration, - skipParentheses, some, SourceFile, startOnNewLine, Statement, SyntaxKind, TaggedTemplateExpression, TextRange, - Token, TransformationContext, TransformFlags, unwrapInnermostStatementOfLabel, VariableDeclaration, - VariableStatement, visitEachChild, visitIterationBody, visitLexicalEnvironment, visitNode, visitNodes, - visitParameterList, VisitResult, VoidExpression, YieldExpression, Bundle, + AccessorDeclaration, + ArrowFunction, + AwaitExpression, + BinaryExpression, + Bundle, + CallExpression, + CatchClause, + CommaListExpression, + ConciseBody, + ConstructorDeclaration, + Debug, + ElementAccessExpression, + EmitFlags, + EmitHint, + Expression, + ExpressionStatement, + FlattenLevel, + ForInitializer, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + GetAccessorDeclaration, + Identifier, + LabeledStatement, + LeftHandSideExpression, + MethodDeclaration, + ModifierFlags, + Node, + NodeCheckFlags, + NodeFlags, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + ParenthesizedExpression, + ProcessLevel, + PropertyAccessExpression, + ReturnStatement, + ScriptTarget, + SetAccessorDeclaration, + SignatureDeclaration, + SourceFile, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + Token, + TransformFlags, + TransformationContext, + VariableDeclaration, + VariableStatement, + VisitResult, + VoidExpression, + YieldExpression, + __String, + addEmitFlags, + addEmitHelper, + addEmitHelpers, + addRange, + advancedAsyncSuperHelper, + append, + asyncSuperHelper, + chainBundle, + concatenate, + createForOfBindingStatement, + createSuperAccessVariableStatement, + flattenDestructuringAssignment, + flattenDestructuringBinding, + getEmitScriptTarget, + getFunctionFlags, + getNodeId, + hasSyntacticModifier, + insertStatementsAfterStandardPrologue, + isAssignmentPattern, + isBindingPattern, + isBlock, + isConciseBody, + isDestructuringAssignment, + isEffectiveStrictModeSourceFile, + isExpression, + isForInitializer, + isIdentifier, + isModifier, + isModifierLike, + isObjectLiteralElementLike, + isParameter, + isPropertyAccessExpression, + isPropertyName, + isStatement, + isSuperProperty, + isToken, + isVariableDeclarationList, + processTaggedTemplateExpression, + setEmitFlags, + setOriginalNode, + setSourceMapRange, + setTextRange, + skipParentheses, + some, + startOnNewLine, + unwrapInnermostStatementOfLabel, + visitEachChild, + visitIterationBody, + visitLexicalEnvironment, + visitNode, + visitNodes, + visitParameterList, } from "../_namespaces/ts"; const enum ESNextSubstitutionFlags { diff --git a/src/compiler/transformers/es2019.ts b/src/compiler/transformers/es2019.ts index eaeb2f19d5381..921c13c4be80f 100644 --- a/src/compiler/transformers/es2019.ts +++ b/src/compiler/transformers/es2019.ts @@ -1,7 +1,16 @@ import { Bundle, - CatchClause, chainBundle, isBlock, Node, SourceFile, SyntaxKind, TransformationContext, TransformFlags, - visitEachChild, visitNode, VisitResult, + CatchClause, + Node, + SourceFile, + SyntaxKind, + TransformFlags, + TransformationContext, + VisitResult, + chainBundle, + isBlock, + visitEachChild, + visitNode, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2020.ts b/src/compiler/transformers/es2020.ts index ec48ca9433563..dae72e5bef773 100644 --- a/src/compiler/transformers/es2020.ts +++ b/src/compiler/transformers/es2020.ts @@ -1,10 +1,41 @@ import { - AccessExpression, addEmitFlags, BinaryExpression, Bundle, CallExpression, cast, chainBundle, Debug, DeleteExpression, - EmitFlags, Expression, isCallChain, isExpression, isGeneratedIdentifier, isIdentifier, isNonNullChain, - isOptionalChain, isParenthesizedExpression, isSimpleCopiableExpression, isSyntheticReference, - isTaggedTemplateExpression, Node, OptionalChain, OuterExpressionKinds, ParenthesizedExpression, setOriginalNode, - setTextRange, skipParentheses, skipPartiallyEmittedExpressions, SourceFile, SyntaxKind, TransformationContext, - TransformFlags, visitEachChild, visitNode, visitNodes, VisitResult, + AccessExpression, + BinaryExpression, + Bundle, + CallExpression, + Debug, + DeleteExpression, + EmitFlags, + Expression, + Node, + OptionalChain, + OuterExpressionKinds, + ParenthesizedExpression, + SourceFile, + SyntaxKind, + TransformFlags, + TransformationContext, + VisitResult, + addEmitFlags, + cast, + chainBundle, + isCallChain, + isExpression, + isGeneratedIdentifier, + isIdentifier, + isNonNullChain, + isOptionalChain, + isParenthesizedExpression, + isSimpleCopiableExpression, + isSyntheticReference, + isTaggedTemplateExpression, + setOriginalNode, + setTextRange, + skipParentheses, + skipPartiallyEmittedExpressions, + visitEachChild, + visitNode, + visitNodes, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es2021.ts b/src/compiler/transformers/es2021.ts index a63e4688a7244..903adf52ea469 100644 --- a/src/compiler/transformers/es2021.ts +++ b/src/compiler/transformers/es2021.ts @@ -1,9 +1,26 @@ import { - AssignmentExpression, BinaryExpression, Bundle, chainBundle, getNonAssignmentOperatorForCompoundAssignment, - isAccessExpression, isExpression, isLeftHandSideExpression, isLogicalOrCoalescingAssignmentExpression, - isPropertyAccessExpression, isSimpleCopiableExpression, LogicalOrCoalescingAssignmentOperator, Node, - skipParentheses, SourceFile, SyntaxKind, Token, TransformationContext, TransformFlags, visitEachChild, visitNode, + AssignmentExpression, + BinaryExpression, + Bundle, + LogicalOrCoalescingAssignmentOperator, + Node, + SourceFile, + SyntaxKind, + Token, + TransformFlags, + TransformationContext, VisitResult, + chainBundle, + getNonAssignmentOperatorForCompoundAssignment, + isAccessExpression, + isExpression, + isLeftHandSideExpression, + isLogicalOrCoalescingAssignmentExpression, + isPropertyAccessExpression, + isSimpleCopiableExpression, + skipParentheses, + visitEachChild, + visitNode, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index 8dd340255a0e6..d4f046418529f 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -1,9 +1,28 @@ import { Bundle, - chainBundle, EmitHint, Expression, getOriginalNodeId, Identifier, idText, isIdentifier, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyAssignment, JsxClosingElement, JsxEmit, JsxOpeningElement, - JsxSelfClosingElement, Node, nodeIsSynthesized, PropertyAccessExpression, PropertyAssignment, setTextRange, - SourceFile, stringToToken, SyntaxKind, TransformationContext, + EmitHint, + Expression, + Identifier, + JsxClosingElement, + JsxEmit, + JsxOpeningElement, + JsxSelfClosingElement, + Node, + PropertyAccessExpression, + PropertyAssignment, + SourceFile, + SyntaxKind, + TransformationContext, + chainBundle, + getOriginalNodeId, + idText, + isIdentifier, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + nodeIsSynthesized, + setTextRange, + stringToToken, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index 770153e4e62a5..bf56eec9b073b 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,6 +1,12 @@ import { Bundle, - chainBundle, Node, SourceFile, TransformationContext, TransformFlags, visitEachChild, VisitResult, + Node, + SourceFile, + TransformFlags, + TransformationContext, + VisitResult, + chainBundle, + visitEachChild, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 079e5b638ba73..c8265d760f6ea 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,21 +1,100 @@ import { - AccessorDeclaration, addEmitHelpers, addSyntheticTrailingComment, ArrayLiteralExpression, Associativity, - BinaryExpression, Block, BreakStatement, Bundle, CallExpression, CaseClause, chainBundle, CommaListExpression, - ConditionalExpression, ContinueStatement, createExpressionForObjectLiteralElementLike, Debug, DoStatement, - ElementAccessExpression, EmitFlags, EmitHint, Expression, ExpressionStatement, forEach, ForInStatement, - ForStatement, FunctionDeclaration, FunctionExpression, getEmitFlags, getEmitScriptTarget, - getExpressionAssociativity, getInitializedVariables, getNonAssignmentOperatorForCompoundAssignment, getOriginalNode, - getOriginalNodeId, Identifier, idText, IfStatement, InitializedVariableDeclaration, - insertStatementsAfterStandardPrologue, isBinaryExpression, isBlock, isCompoundAssignment, isExpression, - isFunctionLikeDeclaration, isGeneratedIdentifier, isIdentifier, isImportCall, isLeftHandSideExpression, - isLogicalOperator, isObjectLiteralElementLike, isStatement, isVariableDeclarationList, LabeledStatement, - lastOrUndefined, LeftHandSideExpression, LiteralExpression, map, Mutable, NewExpression, Node, NodeArray, - NumericLiteral, ObjectLiteralElementLike, ObjectLiteralExpression, PropertyAccessExpression, reduceLeft, - ReturnStatement, setCommentRange, setEmitFlags, setOriginalNode, setParent, setSourceMapRange, setTextRange, - SourceFile, startOnNewLine, Statement, SwitchStatement, SyntaxKind, TextRange, ThrowStatement, - TransformationContext, TransformFlags, TryStatement, VariableDeclaration, VariableDeclarationList, - VariableStatement, visitEachChild, visitIterationBody, visitNode, visitNodes, visitParameterList, VisitResult, - WhileStatement, WithStatement, YieldExpression, + AccessorDeclaration, + ArrayLiteralExpression, + Associativity, + BinaryExpression, + Block, + BreakStatement, + Bundle, + CallExpression, + CaseClause, + CommaListExpression, + ConditionalExpression, + ContinueStatement, + Debug, + DoStatement, + ElementAccessExpression, + EmitFlags, + EmitHint, + Expression, + ExpressionStatement, + ForInStatement, + ForStatement, + FunctionDeclaration, + FunctionExpression, + Identifier, + IfStatement, + InitializedVariableDeclaration, + LabeledStatement, + LeftHandSideExpression, + LiteralExpression, + Mutable, + NewExpression, + Node, + NodeArray, + NumericLiteral, + ObjectLiteralElementLike, + ObjectLiteralExpression, + PropertyAccessExpression, + ReturnStatement, + SourceFile, + Statement, + SwitchStatement, + SyntaxKind, + TextRange, + ThrowStatement, + TransformFlags, + TransformationContext, + TryStatement, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VisitResult, + WhileStatement, + WithStatement, + YieldExpression, + addEmitHelpers, + addSyntheticTrailingComment, + chainBundle, + createExpressionForObjectLiteralElementLike, + forEach, + getEmitFlags, + getEmitScriptTarget, + getExpressionAssociativity, + getInitializedVariables, + getNonAssignmentOperatorForCompoundAssignment, + getOriginalNode, + getOriginalNodeId, + idText, + insertStatementsAfterStandardPrologue, + isBinaryExpression, + isBlock, + isCompoundAssignment, + isExpression, + isFunctionLikeDeclaration, + isGeneratedIdentifier, + isIdentifier, + isImportCall, + isLeftHandSideExpression, + isLogicalOperator, + isObjectLiteralElementLike, + isStatement, + isVariableDeclarationList, + lastOrUndefined, + map, + reduceLeft, + setCommentRange, + setEmitFlags, + setOriginalNode, + setParent, + setSourceMapRange, + setTextRange, + startOnNewLine, + visitEachChild, + visitIterationBody, + visitNode, + visitNodes, + visitParameterList, } from "../_namespaces/ts"; // Transforms generator functions into a compatible ES5 representation with similar runtime diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 88fd9b5412a81..34797c4d5ce23 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -1,16 +1,81 @@ import { - addEmitHelpers, arrayFrom, Bundle, chainBundle, createExpressionForJsxElement, createExpressionForJsxFragment, - createExpressionFromEntityName, createJsxFactoryExpression, Debug, emptyArray, Expression, filter, find, flatten, - GeneratedIdentifierFlags, getEmitScriptTarget, getEntries, getJSXImplicitImportBase, getJSXRuntimeImport, - getLineAndCharacterOfPosition, getOriginalNode, getSemanticJsxChildren, Identifier, idText, ImportSpecifier, - insertStatementAfterCustomPrologue, isExpression, isExternalModule, isExternalOrCommonJsModule, isIdentifier, - isIntrinsicJsxName, isJsxAttribute, isJsxElement, isJsxFragment, isJsxSelfClosingElement, isJsxSpreadAttribute, - isLineBreak, isSourceFile, isStringDoubleQuoted, isWhiteSpaceSingleLine, JsxAttribute, JsxAttributeValue, JsxChild, - JsxElement, JsxEmit, JsxExpression, JsxFragment, JsxOpeningFragment, JsxOpeningLikeElement, JsxSelfClosingElement, - JsxSpreadAttribute, JsxText, length, map, mapDefined, Node, NodeFlags, PropertyAssignment, ScriptTarget, - setParentRecursive, setTextRange, singleOrUndefined, SourceFile, spanMap, SpreadAssignment, startOnNewLine, - Statement, StringLiteral, SyntaxKind, TextRange, TransformationContext, TransformFlags, utf16EncodeAsString, - VariableDeclaration, visitEachChild, visitNode, VisitResult, + Bundle, + Debug, + Expression, + GeneratedIdentifierFlags, + Identifier, + ImportSpecifier, + JsxAttribute, + JsxAttributeValue, + JsxChild, + JsxElement, + JsxEmit, + JsxExpression, + JsxFragment, + JsxOpeningFragment, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxSpreadAttribute, + JsxText, + Node, + NodeFlags, + PropertyAssignment, + ScriptTarget, + SourceFile, + SpreadAssignment, + Statement, + StringLiteral, + SyntaxKind, + TextRange, + TransformFlags, + TransformationContext, + VariableDeclaration, + VisitResult, + addEmitHelpers, + arrayFrom, + chainBundle, + createExpressionForJsxElement, + createExpressionForJsxFragment, + createExpressionFromEntityName, + createJsxFactoryExpression, + emptyArray, + filter, + find, + flatten, + getEmitScriptTarget, + getEntries, + getJSXImplicitImportBase, + getJSXRuntimeImport, + getLineAndCharacterOfPosition, + getOriginalNode, + getSemanticJsxChildren, + idText, + insertStatementAfterCustomPrologue, + isExpression, + isExternalModule, + isExternalOrCommonJsModule, + isIdentifier, + isIntrinsicJsxName, + isJsxAttribute, + isJsxElement, + isJsxFragment, + isJsxSelfClosingElement, + isJsxSpreadAttribute, + isLineBreak, + isSourceFile, + isStringDoubleQuoted, + isWhiteSpaceSingleLine, + length, + map, + mapDefined, + setParentRecursive, + setTextRange, + singleOrUndefined, + spanMap, + startOnNewLine, + utf16EncodeAsString, + visitEachChild, + visitNode, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/legacyDecorators.ts b/src/compiler/transformers/legacyDecorators.ts index be6c0615eebf1..40515d2f50555 100644 --- a/src/compiler/transformers/legacyDecorators.ts +++ b/src/compiler/transformers/legacyDecorators.ts @@ -1,16 +1,82 @@ import { - addEmitHelpers, addRange, AllDecorators, append, Bundle, canHaveDecorators, chainBundle, childIsDecorated, ClassDeclaration, - ClassElement, ClassExpression, ClassLikeDeclaration, classOrConstructorParameterIsDecorated, ConstructorDeclaration, - Decorator, elideNodes, EmitFlags, EmitHint, EnumMember, Expression, filter, flatMap, GetAccessorDeclaration, - getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEmitFlags, getEmitScriptTarget, getOriginalNodeId, - hasAccessorModifier, hasDecorators, hasSyntacticModifier, Identifier, idText, isBindingName, isBlock, - isClassElement, isComputedPropertyName, isDecorator, isExpression, isGeneratedIdentifier, isHeritageClause, - isIdentifier, isModifier, isParameterDeclaration, isPrivateIdentifier, isPropertyDeclaration, isPropertyName, - isSimpleInlineableExpression, isStatic, map, MethodDeclaration, ModifierFlags, moveRangePastModifiers, Node, - NodeArray, NodeCheckFlags, NodeFlags, nodeOrChildIsDecorated, ParameterDeclaration, PropertyDeclaration, - ScriptTarget, SetAccessorDeclaration, setCommentRange, setEmitFlags, setOriginalNode, setSourceMapRange, - setTextRange, singleOrMany, some, SourceFile, Statement, SyntaxKind, TransformationContext, TransformFlags, - visitEachChild, visitNode, visitNodes, VisitResult, + AllDecorators, + Bundle, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ConstructorDeclaration, + Decorator, + EmitFlags, + EmitHint, + EnumMember, + Expression, + GetAccessorDeclaration, + Identifier, + MethodDeclaration, + ModifierFlags, + Node, + NodeArray, + NodeCheckFlags, + NodeFlags, + ParameterDeclaration, + PropertyDeclaration, + ScriptTarget, + SetAccessorDeclaration, + SourceFile, + Statement, + SyntaxKind, + TransformFlags, + TransformationContext, + VisitResult, + addEmitHelpers, + addRange, + append, + canHaveDecorators, + chainBundle, + childIsDecorated, + classOrConstructorParameterIsDecorated, + elideNodes, + filter, + flatMap, + getAllDecoratorsOfClass, + getAllDecoratorsOfClassElement, + getEmitFlags, + getEmitScriptTarget, + getOriginalNodeId, + hasAccessorModifier, + hasDecorators, + hasSyntacticModifier, + idText, + isBindingName, + isBlock, + isClassElement, + isComputedPropertyName, + isDecorator, + isExpression, + isGeneratedIdentifier, + isHeritageClause, + isIdentifier, + isModifier, + isParameterDeclaration, + isPrivateIdentifier, + isPropertyDeclaration, + isPropertyName, + isSimpleInlineableExpression, + isStatic, + map, + moveRangePastModifiers, + nodeOrChildIsDecorated, + setCommentRange, + setEmitFlags, + setOriginalNode, + setSourceMapRange, + setTextRange, + singleOrMany, + some, + visitEachChild, + visitNode, + visitNodes, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/esnextAnd2015.ts b/src/compiler/transformers/module/esnextAnd2015.ts index f4392ab02c783..312c70d3bba79 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -1,12 +1,52 @@ import { - addRange, append, Bundle, chainBundle, createEmptyExports, createExternalHelpersImportDeclarationIfNeeded, Debug, EmitFlags, - EmitHint, ExportAssignment, ExportDeclaration, Expression, GeneratedIdentifierFlags, getEmitFlags, - getEmitModuleKind, getEmitScriptTarget, getExternalModuleNameLiteral, hasSyntacticModifier, Identifier, idText, - ImportDeclaration, ImportEqualsDeclaration, insertStatementsAfterCustomPrologue, - isExportNamespaceAsDefaultDeclaration, isExternalModule, isExternalModuleImportEqualsDeclaration, - isExternalModuleIndicator, isIdentifier, isNamespaceExport, isSourceFile, isStatement, ModifierFlags, - ModuleKind, Node, NodeFlags, ScriptTarget, setOriginalNode, setTextRange, singleOrMany, some, SourceFile, Statement, - SyntaxKind, TransformationContext, VariableStatement, visitEachChild, visitNodes, VisitResult, + Bundle, + Debug, + EmitFlags, + EmitHint, + ExportAssignment, + ExportDeclaration, + Expression, + GeneratedIdentifierFlags, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ModifierFlags, + ModuleKind, + Node, + NodeFlags, + ScriptTarget, + SourceFile, + Statement, + SyntaxKind, + TransformationContext, + VariableStatement, + VisitResult, + addRange, + append, + chainBundle, + createEmptyExports, + createExternalHelpersImportDeclarationIfNeeded, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getExternalModuleNameLiteral, + hasSyntacticModifier, + idText, + insertStatementsAfterCustomPrologue, + isExportNamespaceAsDefaultDeclaration, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isExternalModuleIndicator, + isIdentifier, + isNamespaceExport, + isSourceFile, + isStatement, + setOriginalNode, + setTextRange, + singleOrMany, + some, + visitEachChild, + visitNodes, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index e5ade93e74fe9..706b1f857f84c 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,30 +1,138 @@ import { - addEmitFlags, addEmitHelper, addEmitHelpers, addRange, append, ArrowFunction, BinaryExpression, BindingElement, + ArrowFunction, + BinaryExpression, + BindingElement, Bundle, - CallExpression, chainBundle, ClassDeclaration, collectExternalModuleInfo, Debug, Declaration, - DestructuringAssignment, EmitFlags, EmitHelper, EmitHint, emptyArray, EndOfDeclarationMarker, ExportAssignment, - ExportDeclaration, Expression, ExpressionStatement, ExternalModuleInfo, firstOrUndefined, - flattenDestructuringAssignment, FlattenLevel, ForStatement, FunctionDeclaration, FunctionExpression, - GeneratedIdentifierFlags, getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getESModuleInterop, - getExportNeedsImportStarHelper, getExternalHelpersModuleName, getExternalModuleNameLiteral, - getImportNeedsImportDefaultHelper, getImportNeedsImportStarHelper, getLocalNameForExternalImport, - getNamespaceDeclarationNode, getNodeId, getOriginalNodeId, getStrictOptionValue, getTextOfIdentifierOrLiteral, - hasJsonModuleEmitEnabled, hasSyntacticModifier, Identifier, idText, ImportCall, ImportDeclaration, - ImportEqualsDeclaration, InitializedVariableDeclaration, insertStatementsAfterStandardPrologue, - isArrayLiteralExpression, isArrowFunction, isAssignmentOperator, isBindingPattern, isClassExpression, - isDeclarationNameOfEnumOrNamespace, isDefaultImport, isDestructuringAssignment, isEffectiveExternalModule, - isExportDeclaration, isExportName, isExportNamespaceAsDefaultDeclaration, isExpression, isExternalModule, - isExternalModuleImportEqualsDeclaration, isForInitializer, isFunctionExpression, isGeneratedIdentifier, - isIdentifier, isImportCall, isImportClause, isImportEqualsDeclaration, isImportSpecifier, isJsonSourceFile, - isLocalName, isModifier, isModifierLike, isNamedExports, isObjectLiteralExpression, isOmittedExpression, - isPrefixUnaryExpression, isShorthandPropertyAssignment, isSimpleCopiableExpression, isSimpleInlineableExpression, - isSpreadElement, isStatement, isStringLiteral, length, mapDefined, MergeDeclarationMarker, Modifier, ModifierFlags, - ModuleKind, Node, NodeArray, NodeFlags, ObjectLiteralElementLike, outFile, ParameterDeclaration, - ParenthesizedExpression, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, reduceLeft, - removeAllComments, ScriptTarget, setEmitFlags, setOriginalNode, setTextRange, ShorthandPropertyAssignment, - singleOrMany, SourceFile, startOnNewLine, Statement, SyntaxKind, TaggedTemplateExpression, TextRange, - TransformationContext, TransformFlags, tryGetModuleNameFromFile, VariableDeclaration, VariableStatement, - visitEachChild, visitIterationBody, visitNode, visitNodes, VisitResult, + CallExpression, + ClassDeclaration, + Debug, + Declaration, + DestructuringAssignment, + EmitFlags, + EmitHelper, + EmitHint, + EndOfDeclarationMarker, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + ExternalModuleInfo, + FlattenLevel, + ForStatement, + FunctionDeclaration, + FunctionExpression, + GeneratedIdentifierFlags, + Identifier, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + InitializedVariableDeclaration, + MergeDeclarationMarker, + Modifier, + ModifierFlags, + ModuleKind, + Node, + NodeArray, + NodeFlags, + ObjectLiteralElementLike, + ParameterDeclaration, + ParenthesizedExpression, + PartiallyEmittedExpression, + PostfixUnaryExpression, + PrefixUnaryExpression, + ScriptTarget, + ShorthandPropertyAssignment, + SourceFile, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TransformFlags, + TransformationContext, + VariableDeclaration, + VariableStatement, + VisitResult, + addEmitFlags, + addEmitHelper, + addEmitHelpers, + addRange, + append, + chainBundle, + collectExternalModuleInfo, + emptyArray, + firstOrUndefined, + flattenDestructuringAssignment, + getESModuleInterop, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getExportNeedsImportStarHelper, + getExternalHelpersModuleName, + getExternalModuleNameLiteral, + getImportNeedsImportDefaultHelper, + getImportNeedsImportStarHelper, + getLocalNameForExternalImport, + getNamespaceDeclarationNode, + getNodeId, + getOriginalNodeId, + getStrictOptionValue, + getTextOfIdentifierOrLiteral, + hasJsonModuleEmitEnabled, + hasSyntacticModifier, + idText, + insertStatementsAfterStandardPrologue, + isArrayLiteralExpression, + isArrowFunction, + isAssignmentOperator, + isBindingPattern, + isClassExpression, + isDeclarationNameOfEnumOrNamespace, + isDefaultImport, + isDestructuringAssignment, + isEffectiveExternalModule, + isExportDeclaration, + isExportName, + isExportNamespaceAsDefaultDeclaration, + isExpression, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isForInitializer, + isFunctionExpression, + isGeneratedIdentifier, + isIdentifier, + isImportCall, + isImportClause, + isImportEqualsDeclaration, + isImportSpecifier, + isJsonSourceFile, + isLocalName, + isModifier, + isModifierLike, + isNamedExports, + isObjectLiteralExpression, + isOmittedExpression, + isPrefixUnaryExpression, + isShorthandPropertyAssignment, + isSimpleCopiableExpression, + isSimpleInlineableExpression, + isSpreadElement, + isStatement, + isStringLiteral, + length, + mapDefined, + outFile, + reduceLeft, + removeAllComments, + setEmitFlags, + setOriginalNode, + setTextRange, + singleOrMany, + startOnNewLine, + tryGetModuleNameFromFile, + visitEachChild, + visitIterationBody, + visitNode, + visitNodes, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/node.ts b/src/compiler/transformers/module/node.ts index ac4a48975223e..a0f6a89ad8caa 100644 --- a/src/compiler/transformers/module/node.ts +++ b/src/compiler/transformers/module/node.ts @@ -1,6 +1,16 @@ import { - Bundle, Debug, EmitHint, isSourceFile, map, ModuleKind, Node, SourceFile, SyntaxKind, TransformationContext, - transformECMAScriptModule, transformModule, + Bundle, + Debug, + EmitHint, + ModuleKind, + Node, + SourceFile, + SyntaxKind, + TransformationContext, + isSourceFile, + map, + transformECMAScriptModule, + transformModule, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index 5105d8238047b..c1af3e9cc98ee 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,27 +1,133 @@ import { - addRange, append, BinaryExpression, BindingElement, Block, Bundle, CaseBlock, CaseClause, CaseOrDefaultClause, CatchClause, - chainBundle, ClassDeclaration, collectExternalModuleInfo, Debug, Declaration, DefaultClause, - DestructuringAssignment, DoStatement, EmitFlags, EmitHint, EndOfDeclarationMarker, ExportAssignment, - ExportDeclaration, Expression, ExpressionStatement, ExternalModuleInfo, firstOrUndefined, - flattenDestructuringAssignment, FlattenLevel, forEach, ForInitializer, ForInStatement, ForOfStatement, ForStatement, - FunctionDeclaration, getEmitFlags, getExternalHelpersModuleName, getExternalModuleNameLiteral, - getLocalNameForExternalImport, getNodeId, getOriginalNode, getOriginalNodeId, getStrictOptionValue, - getTextOfIdentifierOrLiteral, hasSyntacticModifier, Identifier, idText, ImportCall, ImportDeclaration, - ImportEqualsDeclaration, insertStatementsAfterStandardPrologue, isArrayLiteralExpression, isAssignmentExpression, - isAssignmentOperator, isBindingPattern, isBlock, isCaseBlock, isCaseOrDefaultClause, isClassElement, - isDeclarationNameOfEnumOrNamespace, isDestructuringAssignment, isEffectiveExternalModule, isExpression, - isExternalModule, isExternalModuleImportEqualsDeclaration, isForInitializer, isGeneratedIdentifier, - isHeritageClause, isIdentifier, isImportCall, isImportClause, isImportMeta, isImportSpecifier, isLocalName, - isModifierLike, isModuleOrEnumDeclaration, isNamedExports, isObjectLiteralExpression, isOmittedExpression, - isParameterDeclaration, isPrefixUnaryExpression, isPropertyAssignment, isShorthandPropertyAssignment, - isSpreadElement, isStatement, isStringLiteral, isVariableDeclarationList, LabeledStatement, map, - MergeDeclarationMarker, MetaProperty, ModifierFlags, moveEmitHelpers, Node, NodeFlags, ObjectLiteralElementLike, - outFile, ParenthesizedExpression, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, - PropertyAssignment, setCommentRange, setEmitFlags, setTextRange, ShorthandPropertyAssignment, singleOrMany, some, - SourceFile, startOnNewLine, Statement, StringLiteral, SwitchStatement, SyntaxKind, TextRange, TransformationContext, - TransformFlags, tryGetModuleNameFromFile, TryStatement, VariableDeclaration, VariableDeclarationList, - VariableStatement, visitEachChild, visitIterationBody, visitNode, visitNodes, VisitResult, WhileStatement, + BinaryExpression, + BindingElement, + Block, + Bundle, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + ClassDeclaration, + Debug, + Declaration, + DefaultClause, + DestructuringAssignment, + DoStatement, + EmitFlags, + EmitHint, + EndOfDeclarationMarker, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + ExternalModuleInfo, + FlattenLevel, + ForInStatement, + ForInitializer, + ForOfStatement, + ForStatement, + FunctionDeclaration, + Identifier, + ImportCall, + ImportDeclaration, + ImportEqualsDeclaration, + LabeledStatement, + MergeDeclarationMarker, + MetaProperty, + ModifierFlags, + Node, + NodeFlags, + ObjectLiteralElementLike, + ParenthesizedExpression, + PartiallyEmittedExpression, + PostfixUnaryExpression, + PrefixUnaryExpression, + PropertyAssignment, + ShorthandPropertyAssignment, + SourceFile, + Statement, + StringLiteral, + SwitchStatement, + SyntaxKind, + TextRange, + TransformFlags, + TransformationContext, + TryStatement, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + VisitResult, + WhileStatement, WithStatement, + addRange, + append, + chainBundle, + collectExternalModuleInfo, + firstOrUndefined, + flattenDestructuringAssignment, + forEach, + getEmitFlags, + getExternalHelpersModuleName, + getExternalModuleNameLiteral, + getLocalNameForExternalImport, + getNodeId, + getOriginalNode, + getOriginalNodeId, + getStrictOptionValue, + getTextOfIdentifierOrLiteral, + hasSyntacticModifier, + idText, + insertStatementsAfterStandardPrologue, + isArrayLiteralExpression, + isAssignmentExpression, + isAssignmentOperator, + isBindingPattern, + isBlock, + isCaseBlock, + isCaseOrDefaultClause, + isClassElement, + isDeclarationNameOfEnumOrNamespace, + isDestructuringAssignment, + isEffectiveExternalModule, + isExpression, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isForInitializer, + isGeneratedIdentifier, + isHeritageClause, + isIdentifier, + isImportCall, + isImportClause, + isImportMeta, + isImportSpecifier, + isLocalName, + isModifierLike, + isModuleOrEnumDeclaration, + isNamedExports, + isObjectLiteralExpression, + isOmittedExpression, + isParameterDeclaration, + isPrefixUnaryExpression, + isPropertyAssignment, + isShorthandPropertyAssignment, + isSpreadElement, + isStatement, + isStringLiteral, + isVariableDeclarationList, + map, + moveEmitHelpers, + outFile, + setCommentRange, + setEmitFlags, + setTextRange, + singleOrMany, + some, + startOnNewLine, + tryGetModuleNameFromFile, + visitEachChild, + visitIterationBody, + visitNode, + visitNodes, } from "../../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/taggedTemplate.ts b/src/compiler/transformers/taggedTemplate.ts index 683c445127820..dd0f9ef96db50 100644 --- a/src/compiler/transformers/taggedTemplate.ts +++ b/src/compiler/transformers/taggedTemplate.ts @@ -1,9 +1,27 @@ import { CallExpression, - Debug, Expression, factory, getSourceTextOfNodeFromSourceFile, hasInvalidEscape, Identifier, isExpression, - isExternalModule, isNoSubstitutionTemplateLiteral, NoSubstitutionTemplateLiteral, setTextRange, SourceFile, - SyntaxKind, TaggedTemplateExpression, TemplateHead, TemplateLiteralLikeNode, TemplateMiddle, TemplateTail, - TransformationContext, visitEachChild, visitNode, Visitor, + Debug, + Expression, + Identifier, + NoSubstitutionTemplateLiteral, + SourceFile, + SyntaxKind, + TaggedTemplateExpression, + TemplateHead, + TemplateLiteralLikeNode, + TemplateMiddle, + TemplateTail, + TransformationContext, + Visitor, + factory, + getSourceTextOfNodeFromSourceFile, + hasInvalidEscape, + isExpression, + isExternalModule, + isNoSubstitutionTemplateLiteral, + setTextRange, + visitEachChild, + visitNode, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 6e58a3225b19f..3d4400dc38445 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,39 +1,202 @@ import { - __String, AccessorDeclaration, addEmitFlags, addEmitHelpers, addRange, addSyntheticTrailingComment, AllDecorators, - append, ArrowFunction, AssertionExpression, Block, Bundle, CallExpression, CaseBlock, childIsDecorated, - ClassDeclaration, ClassElement, ClassExpression, ClassLikeDeclaration, classOrConstructorParameterIsDecorated, - concatenate, ConstructorDeclaration, createExpressionFromEntityName, createRange, createRuntimeTypeSerializer, - createTokenRange, createUnparsedSourceFile, Debug, Declaration, Decorator, ElementAccessExpression, elideNodes, - EmitFlags, EmitHint, EntityName, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, - Expression, ExpressionWithTypeArguments, filter, findSuperStatementIndex, firstOrUndefined, flatMap, - flattenDestructuringAssignment, FlattenLevel, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, - GetAccessorDeclaration, getAllDecoratorsOfClass, getAllDecoratorsOfClassElement, getEffectiveBaseTypeNode, - getEmitFlags, getEmitModuleKind, getEmitScriptTarget, getFirstConstructorWithBody, getInitializedVariables, - getOriginalNode, getParseTreeNode, getProperties, getStrictOptionValue, getTextOfNode, hasDecorators, - hasStaticModifier, hasSyntacticModifier, HeritageClause, Identifier, idText, ImportClause, ImportDeclaration, - ImportEqualsDeclaration, ImportsNotUsedAsValues, ImportSpecifier, InitializedVariableDeclaration, - insertStatementsAfterStandardPrologue, isAccessExpression, isArray, isAssertionExpression, isBindingName, - isBindingPattern, isClassElement, isClassLike, isComputedPropertyName, isDecorator, isElementAccessExpression, - isEnumConst, isExportSpecifier, isExpression, isExternalModule, isExternalModuleImportEqualsDeclaration, - isGeneratedIdentifier, isHeritageClause, isIdentifier, isImportClause, isImportSpecifier, isInJSFile, - isInstantiatedModule, isJsonSourceFile, isJsxAttributes, isJsxTagNameExpression, isLeftHandSideExpression, - isLocalName, isModifier, isModifierLike, isModuleDeclaration, isNamedExportBindings, isNamedImportBindings, - isNamespaceExport, isObjectLiteralElement, isParameterPropertyDeclaration, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyName, isShorthandPropertyAssignment, isSimpleInlineableExpression, - isSourceFile, isStatement, JsxOpeningElement, JsxSelfClosingElement, lastOrUndefined, LeftHandSideExpression, map, - mapDefined, MethodDeclaration, ModifierFlags, ModifierLike, modifierToFlag, ModuleBlock, ModuleDeclaration, - ModuleKind, moveRangePastDecorators, moveRangePastModifiers, moveRangePos, NamedExportBindings, NamedExports, - NamedImportBindings, NamespaceExport, NewExpression, Node, NodeFlags, nodeIsMissing, NonNullExpression, - ObjectLiteralElementLike, ObjectLiteralExpression, OuterExpressionKinds, ParameterDeclaration, - parameterIsThisKeyword, ParameterPropertyDeclaration, ParenthesizedExpression, PropertyAccessExpression, - PropertyDeclaration, PropertyName, removeAllComments, SatisfiesExpression, ScriptTarget, SetAccessorDeclaration, - setCommentRange, setConstantValue, setEmitFlags, setOriginalNode, setParent, setSourceMapRange, - setSyntheticLeadingComments, setSyntheticTrailingComments, setTextRange, setTextRangeEnd, setTextRangePos, - setTextRangePosEnd, setTypeNode, ShorthandPropertyAssignment, shouldPreserveConstEnums, singleOrMany, - skipOuterExpressions, skipPartiallyEmittedExpressions, skipTrivia, some, SourceFile, startOnNewLine, Statement, - SyntaxKind, TaggedTemplateExpression, TextRange, TransformationContext, TransformFlags, UnderscoreEscapedMap, - VariableDeclaration, VariableStatement, visitArray, visitEachChild, visitFunctionBody, visitLexicalEnvironment, - visitNode, visitNodes, visitParameterList, VisitResult, + AccessorDeclaration, + AllDecorators, + ArrowFunction, + AssertionExpression, + Block, + Bundle, + CallExpression, + CaseBlock, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ConstructorDeclaration, + Debug, + Declaration, + Decorator, + ElementAccessExpression, + EmitFlags, + EmitHint, + EntityName, + EnumDeclaration, + EnumMember, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionWithTypeArguments, + FlattenLevel, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + HeritageClause, + Identifier, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + ImportsNotUsedAsValues, + InitializedVariableDeclaration, + JsxOpeningElement, + JsxSelfClosingElement, + LeftHandSideExpression, + MethodDeclaration, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleKind, + NamedExportBindings, + NamedExports, + NamedImportBindings, + NamespaceExport, + NewExpression, + Node, + NodeFlags, + NonNullExpression, + ObjectLiteralElementLike, + ObjectLiteralExpression, + OuterExpressionKinds, + ParameterDeclaration, + ParameterPropertyDeclaration, + ParenthesizedExpression, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + SatisfiesExpression, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + SourceFile, + Statement, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TransformFlags, + TransformationContext, + UnderscoreEscapedMap, + VariableDeclaration, + VariableStatement, + VisitResult, + __String, + addEmitFlags, + addEmitHelpers, + addRange, + addSyntheticTrailingComment, + append, + childIsDecorated, + classOrConstructorParameterIsDecorated, + concatenate, + createExpressionFromEntityName, + createRange, + createRuntimeTypeSerializer, + createTokenRange, + createUnparsedSourceFile, + elideNodes, + filter, + findSuperStatementIndex, + firstOrUndefined, + flatMap, + flattenDestructuringAssignment, + getAllDecoratorsOfClass, + getAllDecoratorsOfClassElement, + getEffectiveBaseTypeNode, + getEmitFlags, + getEmitModuleKind, + getEmitScriptTarget, + getFirstConstructorWithBody, + getInitializedVariables, + getOriginalNode, + getParseTreeNode, + getProperties, + getStrictOptionValue, + getTextOfNode, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + idText, + insertStatementsAfterStandardPrologue, + isAccessExpression, + isArray, + isAssertionExpression, + isBindingName, + isBindingPattern, + isClassElement, + isClassLike, + isComputedPropertyName, + isDecorator, + isElementAccessExpression, + isEnumConst, + isExportSpecifier, + isExpression, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isGeneratedIdentifier, + isHeritageClause, + isIdentifier, + isImportClause, + isImportSpecifier, + isInJSFile, + isInstantiatedModule, + isJsonSourceFile, + isJsxAttributes, + isJsxTagNameExpression, + isLeftHandSideExpression, + isLocalName, + isModifier, + isModifierLike, + isModuleDeclaration, + isNamedExportBindings, + isNamedImportBindings, + isNamespaceExport, + isObjectLiteralElement, + isParameterPropertyDeclaration, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyName, + isShorthandPropertyAssignment, + isSimpleInlineableExpression, + isSourceFile, + isStatement, + lastOrUndefined, + map, + mapDefined, + modifierToFlag, + moveRangePastDecorators, + moveRangePastModifiers, + moveRangePos, + nodeIsMissing, + parameterIsThisKeyword, + removeAllComments, + setCommentRange, + setConstantValue, + setEmitFlags, + setOriginalNode, + setParent, + setSourceMapRange, + setSyntheticLeadingComments, + setSyntheticTrailingComments, + setTextRange, + setTextRangeEnd, + setTextRangePos, + setTextRangePosEnd, + setTypeNode, + shouldPreserveConstEnums, + singleOrMany, + skipOuterExpressions, + skipPartiallyEmittedExpressions, + skipTrivia, + some, + startOnNewLine, + visitArray, + visitEachChild, + visitFunctionBody, + visitLexicalEnvironment, + visitNode, + visitNodes, + visitParameterList, } from "../_namespaces/ts"; /** diff --git a/src/compiler/transformers/typeSerializer.ts b/src/compiler/transformers/typeSerializer.ts index fb86fed8a6a20..37e757a7d4332 100644 --- a/src/compiler/transformers/typeSerializer.ts +++ b/src/compiler/transformers/typeSerializer.ts @@ -1,17 +1,73 @@ import { - AccessorDeclaration, ArrayLiteralExpression, BigIntLiteral, BinaryExpression, Block, CaseBlock, - ClassLikeDeclaration, ConditionalExpression, ConditionalTypeNode, Debug, EntityName, Expression, factory, - findAncestor, FunctionLikeDeclaration, getAllAccessorDeclarations, getEffectiveReturnTypeNode, getEmitScriptTarget, - getFirstConstructorWithBody, getParseTreeNode, getRestParameterElementType, getSetAccessorTypeAnnotationNode, - getStrictOptionValue, Identifier, isAsyncFunction, isBinaryExpression, isClassLike, isConditionalExpression, - isConditionalTypeNode, isFunctionLike, isGeneratedIdentifier, isIdentifier, isLiteralTypeNode, isNumericLiteral, - isParenthesizedExpression, isPropertyAccessExpression, isStringLiteral, isTypeOfExpression, isVoidExpression, - JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, LiteralTypeNode, MethodDeclaration, ModuleBlock, Node, - nodeIsPresent, NumericLiteral, ParameterDeclaration, parseNodeFactory, PrefixUnaryExpression, - PropertyAccessEntityNameExpression, PropertyDeclaration, QualifiedName, ScriptTarget, setParent, setTextRange, - SignatureDeclaration, skipTypeParentheses, SourceFile, SyntaxKind, TransformationContext, TypeNode, - TypeOperatorNode, TypePredicateNode, TypeReferenceNode, TypeReferenceSerializationKind, UnionOrIntersectionTypeNode, + AccessorDeclaration, + ArrayLiteralExpression, + BigIntLiteral, + BinaryExpression, + Block, + CaseBlock, + ClassLikeDeclaration, + ConditionalExpression, + ConditionalTypeNode, + Debug, + EntityName, + Expression, + FunctionLikeDeclaration, + Identifier, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + LiteralTypeNode, + MethodDeclaration, + ModuleBlock, + Node, + NumericLiteral, + ParameterDeclaration, + PrefixUnaryExpression, + PropertyAccessEntityNameExpression, + PropertyDeclaration, + QualifiedName, + ScriptTarget, + SignatureDeclaration, + SourceFile, + SyntaxKind, + TransformationContext, + TypeNode, + TypeOperatorNode, + TypePredicateNode, + TypeReferenceNode, + TypeReferenceSerializationKind, + UnionOrIntersectionTypeNode, VoidExpression, + factory, + findAncestor, + getAllAccessorDeclarations, + getEffectiveReturnTypeNode, + getEmitScriptTarget, + getFirstConstructorWithBody, + getParseTreeNode, + getRestParameterElementType, + getSetAccessorTypeAnnotationNode, + getStrictOptionValue, + isAsyncFunction, + isBinaryExpression, + isClassLike, + isConditionalExpression, + isConditionalTypeNode, + isFunctionLike, + isGeneratedIdentifier, + isIdentifier, + isLiteralTypeNode, + isNumericLiteral, + isParenthesizedExpression, + isPropertyAccessExpression, + isStringLiteral, + isTypeOfExpression, + isVoidExpression, + nodeIsPresent, + parseNodeFactory, + setParent, + setTextRange, + skipTypeParentheses, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/transformers/utilities.ts b/src/compiler/transformers/utilities.ts index f8bca38723f8f..8705633a4cb18 100644 --- a/src/compiler/transformers/utilities.ts +++ b/src/compiler/transformers/utilities.ts @@ -1,19 +1,85 @@ import { - AccessorDeclaration, AllDecorators, append, BinaryOperator, BindingElement, Bundle, cast, ClassDeclaration, - ClassElement, ClassExpression, ClassLikeDeclaration, ClassStaticBlockDeclaration, CompilerOptions, - CompoundAssignmentOperator, CoreTransformationContext, createExternalHelpersImportDeclarationIfNeeded, - createMultiMap, Decorator, EmitResolver, ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, - filter, FunctionDeclaration, FunctionLikeDeclaration, getAllAccessorDeclarations, getDecorators, - getFirstConstructorWithBody, getNamespaceDeclarationNode, getNodeId, getOriginalNode, hasDecorators, - hasStaticModifier, hasSyntacticModifier, Identifier, idText, ImportDeclaration, ImportEqualsDeclaration, - ImportSpecifier, InitializedPropertyDeclaration, InternalSymbolName, isAutoAccessorPropertyDeclaration, - isBindingPattern, isClassStaticBlockDeclaration, isDefaultImport, isExpressionStatement, isGeneratedIdentifier, - isIdentifier, isKeyword, isMethodOrAccessor, isNamedExports, isNamedImports, isOmittedExpression, - isPrivateIdentifier, isPropertyDeclaration, isStatic, isStringLiteralLike, isSuperCall, LogicalOperatorOrHigher, - map, MethodDeclaration, ModifierFlags, NamedImportBindings, NamespaceExport, Node, NodeArray, - parameterIsThisKeyword, PrivateIdentifierAccessorDeclaration, PrivateIdentifierAutoAccessorPropertyDeclaration, - PrivateIdentifierMethodDeclaration, PropertyDeclaration, skipParentheses, some, SourceFile, Statement, SuperCall, SyntaxKind, - TransformationContext, VariableDeclaration, VariableStatement, + AccessorDeclaration, + AllDecorators, + BinaryOperator, + BindingElement, + Bundle, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CompilerOptions, + CompoundAssignmentOperator, + CoreTransformationContext, + Decorator, + EmitResolver, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + FunctionDeclaration, + FunctionLikeDeclaration, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + InitializedPropertyDeclaration, + InternalSymbolName, + LogicalOperatorOrHigher, + MethodDeclaration, + ModifierFlags, + NamedImportBindings, + NamespaceExport, + Node, + NodeArray, + PrivateIdentifierAccessorDeclaration, + PrivateIdentifierAutoAccessorPropertyDeclaration, + PrivateIdentifierMethodDeclaration, + PropertyDeclaration, + SourceFile, + Statement, + SuperCall, + SyntaxKind, + TransformationContext, + VariableDeclaration, + VariableStatement, + append, + cast, + createExternalHelpersImportDeclarationIfNeeded, + createMultiMap, + filter, + getAllAccessorDeclarations, + getDecorators, + getFirstConstructorWithBody, + getNamespaceDeclarationNode, + getNodeId, + getOriginalNode, + hasDecorators, + hasStaticModifier, + hasSyntacticModifier, + idText, + isAutoAccessorPropertyDeclaration, + isBindingPattern, + isClassStaticBlockDeclaration, + isDefaultImport, + isExpressionStatement, + isGeneratedIdentifier, + isIdentifier, + isKeyword, + isMethodOrAccessor, + isNamedExports, + isNamedImports, + isOmittedExpression, + isPrivateIdentifier, + isPropertyDeclaration, + isStatic, + isStringLiteralLike, + isSuperCall, + map, + parameterIsThisKeyword, + skipParentheses, + some, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index ad96f6e39428a..c192abeb6cc0b 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -1,4 +1,9 @@ -import { combinePaths, Extension, fileExtensionIs, ResolvedConfigFileName } from "./_namespaces/ts"; +import { + Extension, + ResolvedConfigFileName, + combinePaths, + fileExtensionIs, +} from "./_namespaces/ts"; /** @internal */ export enum UpToDateStatusType { diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index b44a1ec6e6a72..394bbceb8f07f 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -1,32 +1,136 @@ import * as ts from "./_namespaces/ts"; import { - AffectedFileResult, arrayToMap, assertType, BuilderProgram, BuildInfo, CancellationToken, canJsonReportNoInputFiles, - changeCompilerHostLikeToUseCache, clearMap, closeFileWatcher, closeFileWatcherOf, commonOptionsWithBuild, - CompilerHost, CompilerOptions, CompilerOptionsValue, ConfigFileProgramReloadLevel, convertToRelativePath, - copyProperties, createCompilerDiagnostic, createCompilerHostFromProgramHost, createDiagnosticCollection, - createDiagnosticReporter, createGetCanonicalFileName, createModuleResolutionCache, CreateProgram, createProgramHost, - createTypeReferenceDirectiveResolutionCache, createWatchFactory, createWatchHost, CustomTransformers, Debug, - Diagnostic, DiagnosticCollection, DiagnosticMessage, DiagnosticReporter, Diagnostics, - EmitAndSemanticDiagnosticsBuilderProgram, emitFilesAndReportErrors, EmitResult, emitUsingBuildInfo, emptyArray, - ExitStatus, ExtendedConfigCacheEntry, FileWatcher, FileWatcherCallback, findIndex, - flattenDiagnosticMessageText, forEach, ForegroundColorEscapeSequences, formatColorAndReset, getAllProjectOutputs, - getBuildInfoFileVersionMap, GetCanonicalFileName, getConfigFileParsingDiagnostics, getDirectoryPath, getEntries, - getErrorCountForSummary, getFileNamesFromConfigSpecs, getFilesInErrorForSummary, getFirstProjectOutput, - getLocaleTimeString, getNormalizedAbsolutePath, getParsedCommandLineOfConfigFile, getPendingEmitKind, - getSourceFileVersionAsHashFromText, getTsBuildInfoEmitOutputFilePath, getWatchErrorSummaryDiagnosticMessage, - hasProperty, identity, isArray, isIgnoredFileFromWildCardWatching, isIncrementalCompilation, isString, listFiles, - loadWithModeAwareCache, loadWithTypeDirectiveCache, map, maybeBind, missingFileModifiedTime, - ModuleResolutionCache, mutateMap, mutateMapSkippingNewValues, noop, outFile, OutputFile, ParseConfigFileHost, - parseConfigHostFromCompilerHostLike, ParsedCommandLine, Path, PollingInterval, Program, ProgramBuildInfo, - ProgramBundleEmitBuildInfo, ProgramHost, ProgramMultiFileEmitBuildInfo, readBuilderProgram, ReadBuildProgramHost, + AffectedFileResult, + BuildInfo, + BuilderProgram, + CancellationToken, + CompilerHost, + CompilerOptions, + CompilerOptionsValue, + ConfigFileProgramReloadLevel, + CreateProgram, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCollection, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + EmitAndSemanticDiagnosticsBuilderProgram, + EmitResult, + ExitStatus, + ExtendedConfigCacheEntry, + FileWatcher, + FileWatcherCallback, + ForegroundColorEscapeSequences, + GetCanonicalFileName, + ModuleResolutionCache, + OutputFile, + ParseConfigFileHost, + ParsedCommandLine, + Path, + PollingInterval, + Program, + ProgramBuildInfo, + ProgramBundleEmitBuildInfo, + ProgramHost, + ProgramMultiFileEmitBuildInfo, + ReadBuildProgramHost, ResolutionMode, - resolveConfigFileProjectName, ResolvedConfigFileName, ResolvedProjectReference, ResolvedTypeReferenceDirective, - resolveModuleName, resolvePath, resolveProjectReferencePath, resolveTypeReferenceDirective, returnUndefined, - SemanticDiagnosticsBuilderProgram, setGetSourceFileAsHashVersioned, SharedExtendedConfigFileWatcher, some, - SourceFile, Status, sys, System, TypeReferenceDirectiveResolutionCache, unorderedRemoveItem, - updateErrorForNoInputFiles, updateSharedExtendedConfigFileWatcher, updateWatchingWildcardDirectories, - UpToDateStatus, UpToDateStatusType, version, WatchFactory, WatchHost, WatchOptions, WatchStatusReporter, WatchType, - WildcardDirectoryWatcher, writeFile, WriteFileCallback, + ResolvedConfigFileName, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + SemanticDiagnosticsBuilderProgram, + SharedExtendedConfigFileWatcher, + SourceFile, + Status, + System, + TypeReferenceDirectiveResolutionCache, + UpToDateStatus, + UpToDateStatusType, + WatchFactory, + WatchHost, + WatchOptions, + WatchStatusReporter, + WatchType, + WildcardDirectoryWatcher, + WriteFileCallback, + arrayToMap, + assertType, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + clearMap, + closeFileWatcher, + closeFileWatcherOf, + commonOptionsWithBuild, + convertToRelativePath, + copyProperties, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createDiagnosticCollection, + createDiagnosticReporter, + createGetCanonicalFileName, + createModuleResolutionCache, + createProgramHost, + createTypeReferenceDirectiveResolutionCache, + createWatchFactory, + createWatchHost, + emitFilesAndReportErrors, + emitUsingBuildInfo, + emptyArray, + findIndex, + flattenDiagnosticMessageText, + forEach, + formatColorAndReset, + getAllProjectOutputs, + getBuildInfoFileVersionMap, + getConfigFileParsingDiagnostics, + getDirectoryPath, + getEntries, + getErrorCountForSummary, + getFileNamesFromConfigSpecs, + getFilesInErrorForSummary, + getFirstProjectOutput, + getLocaleTimeString, + getNormalizedAbsolutePath, + getParsedCommandLineOfConfigFile, + getPendingEmitKind, + getSourceFileVersionAsHashFromText, + getTsBuildInfoEmitOutputFilePath, + getWatchErrorSummaryDiagnosticMessage, + hasProperty, + identity, + isArray, + isIgnoredFileFromWildCardWatching, + isIncrementalCompilation, + isString, + listFiles, + loadWithModeAwareCache, + loadWithTypeDirectiveCache, + map, + maybeBind, + missingFileModifiedTime, + mutateMap, + mutateMapSkippingNewValues, + noop, + outFile, + parseConfigHostFromCompilerHostLike, + readBuilderProgram, + resolveConfigFileProjectName, + resolveModuleName, + resolvePath, + resolveProjectReferencePath, + resolveTypeReferenceDirective, + returnUndefined, + setGetSourceFileAsHashVersioned, + some, + sys, + unorderedRemoveItem, + updateErrorForNoInputFiles, + updateSharedExtendedConfigFileWatcher, + updateWatchingWildcardDirectories, + version, + writeFile, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d09d1f958de4c..8ab413b786a5e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,7 +1,19 @@ import { - BaseNodeFactory, CreateSourceFileOptions, EmitHelperFactory, MapLike, ModeAwareCache, - ModuleResolutionCache, MultiMap, NodeFactoryFlags, OptionsNameMap, PackageJsonInfo, PackageJsonInfoCache, Pattern, - ProgramBuildInfo, Push, SymlinkCache, + BaseNodeFactory, + CreateSourceFileOptions, + EmitHelperFactory, + MapLike, + ModeAwareCache, + ModuleResolutionCache, + MultiMap, + NodeFactoryFlags, + OptionsNameMap, + PackageJsonInfo, + PackageJsonInfoCache, + Pattern, + ProgramBuildInfo, + Push, + SymlinkCache, } from "./_namespaces/ts"; // branded string type used to store absolute, normalized and canonicalized paths diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a6eaefed1ef7c..f026b086585a3 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,96 +1,520 @@ import { - __String, AccessExpression, AccessorDeclaration, addRange, affectsDeclarationPathOptionDeclarations, - affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, AnyImportOrBareOrAccessedRequire, - AnyImportOrReExport, AnyImportSyntax, AnyValidImportOrReExport, arrayFrom, ArrayLiteralExpression, ArrayTypeNode, - ArrowFunction, AsExpression, AssertionExpression, assertType, AssignmentDeclarationKind, AssignmentExpression, - AssignmentOperatorToken, BinaryExpression, binarySearch, BindableObjectDefinePropertyCall, - BindableStaticAccessExpression, BindableStaticElementAccessExpression, BindableStaticNameExpression, BindingElement, - Block, BundleFileSection, BundleFileSectionKind, BundleFileTextLike, CallExpression, CallLikeExpression, - canHaveDecorators, canHaveIllegalDecorators, canHaveModifiers, CaseBlock, CaseClause, CaseOrDefaultClause, - CatchClause, changeAnyExtension, CharacterCodes, CheckFlags, ClassDeclaration, ClassElement, ClassLikeDeclaration, - ClassStaticBlockDeclaration, combinePaths, CommaListExpression, CommandLineOption, CommentDirective, - CommentDirectivesMap, CommentDirectiveType, CommentRange, compareStringsCaseSensitive, compareValues, Comparison, - CompilerOptions, ComputedPropertyName, computeLineAndCharacterOfPosition, computeLineOfPosition, computeLineStarts, - concatenate, ConditionalExpression, ConstructorDeclaration, contains, containsPath, createGetCanonicalFileName, - createModeAwareCache, createMultiMap, createScanner, createTextSpan, createTextSpanFromBounds, Debug, Declaration, - DeclarationName, DeclarationWithTypeParameterChildren, DeclarationWithTypeParameters, Decorator, DefaultClause, - DestructuringAssignment, Diagnostic, DiagnosticCollection, DiagnosticMessage, DiagnosticMessageChain, - DiagnosticRelatedInformation, Diagnostics, DiagnosticWithDetachedLocation, DiagnosticWithLocation, - directorySeparator, DoStatement, DynamicNamedBinaryExpression, DynamicNamedDeclaration, ElementAccessExpression, - EmitFlags, EmitHost, EmitResolver, EmitTextWriter, emptyArray, ensurePathIsNonModuleName, - ensureTrailingDirectorySeparator, EntityName, EntityNameExpression, EntityNameOrEntityNameExpression, - EnumDeclaration, EqualityComparer, equalOwnProperties, EqualsToken, equateValues, escapeLeadingUnderscores, - every, ExportAssignment, ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, - ExpressionWithTypeArguments, Extension, ExternalModuleReference, factory, FileExtensionInfo, fileExtensionIs, - fileExtensionIsOneOf, FileReference, FileWatcher, filter, find, findAncestor, findBestPatternMatch, findIndex, - findLast, firstDefined, firstOrUndefined, flatMap, flatMapToMutable, flatten, forEach, forEachAncestorDirectory, - forEachChild, forEachChildRecursively, ForInOrOfStatement, ForInStatement, ForOfStatement, ForStatement, - FunctionBody, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, - getBaseFileName, GetCanonicalFileName, getCombinedModifierFlags, getCombinedNodeFlags, getDirectoryPath, getEntries, - getJSDocAugmentsTag, getJSDocDeprecatedTagNoCache, getJSDocImplementsTags, getJSDocOverrideTagNoCache, - getJSDocParameterTags, getJSDocParameterTagsNoCache, getJSDocPrivateTagNoCache, getJSDocProtectedTagNoCache, - getJSDocPublicTagNoCache, getJSDocReadonlyTagNoCache, getJSDocReturnType, getJSDocTags, getJSDocType, - getJSDocTypeParameterTags, getJSDocTypeParameterTagsNoCache, getJSDocTypeTag, getLeadingCommentRanges, - getLineAndCharacterOfPosition, getLinesBetweenPositions, getLineStarts, getNameOfDeclaration, - getNormalizedAbsolutePath, getNormalizedPathComponents, getOwnKeys, getParseTreeNode, getPathComponents, - getPathFromPathComponents, getRelativePathToDirectoryOrUrl, getResolutionMode, getResolutionName, getRootLength, - getStringComparer, getSymbolId, getTrailingCommentRanges, HasExpressionInitializer, hasExtension, hasInitializer, - HasInitializer, HasJSDoc, hasJSDocNodes, HasModifiers, hasProperty, HasType, HasTypeArguments, HeritageClause, - Identifier, IdentifierTypePredicate, identity, idText, IfStatement, ignoredPaths, ImportCall, ImportClause, - ImportDeclaration, ImportEqualsDeclaration, ImportMetaProperty, ImportSpecifier, ImportTypeNode, IndexInfo, - indexOfAnyCharCode, InitializedVariableDeclaration, insertSorted, InterfaceDeclaration, isAccessor, - isAnyDirectorySeparator, isArray, isArrayLiteralExpression, isArrowFunction, isBigIntLiteral, isBinaryExpression, - isBindingPattern, isCallExpression, isClassDeclaration, isClassElement, isClassExpression, isClassLike, - isClassStaticBlockDeclaration, isCommaListExpression, isComputedPropertyName, isConstructorDeclaration, - isDeclaration, isDecorator, isElementAccessExpression, isEnumDeclaration, isEnumMember, isExportAssignment, - isExportDeclaration, isExpressionStatement, isExpressionWithTypeArguments, isExternalModule, - isExternalModuleReference, isFileProbablyExternalModule, isForStatement, isFunctionDeclaration, - isFunctionExpression, isFunctionLike, isFunctionLikeDeclaration, isFunctionLikeOrClassStaticBlockDeclaration, - isGetAccessorDeclaration, isHeritageClause, isIdentifier, isIdentifierText, isImportTypeNode, - isInterfaceDeclaration, isJSDoc, isJSDocFunctionType, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, - isJSDocNode, isJSDocParameterTag, isJSDocPropertyLikeTag, isJSDocSignature, isJSDocTag, isJSDocTemplateTag, - isJSDocTypeExpression, isJSDocTypeLiteral, isJSDocTypeTag, isJsxChild, isJsxFragment, isJsxOpeningLikeElement, - isJsxText, isLeftHandSideExpression, isLineBreak, isLiteralTypeNode, isMemberName, isMetaProperty, - isMethodOrAccessor, isModuleDeclaration, isNamedDeclaration, isNamespaceExport, isNamespaceExportDeclaration, - isNamespaceImport, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectLiteralExpression, - isOmittedExpression, isParameter, isParameterPropertyDeclaration, isParenthesizedExpression, - isParenthesizedTypeNode, isPrefixUnaryExpression, isPrivateIdentifier, isPropertyAccessExpression, - isPropertyAssignment, isPropertyDeclaration, isPropertyName, isPropertySignature, isQualifiedName, isRootedDiskPath, - isSetAccessorDeclaration, isShorthandPropertyAssignment, isSourceFile, isString, isStringLiteral, - isStringLiteralLike, isTypeAliasDeclaration, isTypeElement, isTypeLiteralNode, isTypeNode, isTypeReferenceNode, - isVariableDeclaration, isVariableStatement, isVoidExpression, isWhiteSpaceLike, isWhiteSpaceSingleLine, JSDoc, - JSDocCallbackTag, JSDocEnumTag, JSDocMemberName, JSDocParameterTag, JSDocPropertyLikeTag, JSDocSignature, JSDocTag, - JSDocTemplateTag, JSDocTypedefTag, JsonSourceFile, JsxChild, JsxElement, JsxEmit, JsxFragment, JsxOpeningElement, - JsxOpeningLikeElement, JsxSelfClosingElement, JsxTagNameExpression, KeywordSyntaxKind, LabeledStatement, - LanguageVariant, last, lastOrUndefined, LateVisibilityPaintedStatement, length, LiteralImportTypeNode, - LiteralLikeElementAccessExpression, LiteralLikeNode, LogicalOrCoalescingAssignmentOperator, map, mapDefined, - MapLike, MemberName, MethodDeclaration, ModeAwareCache, ModifierFlags, ModifierLike, ModuleBlock, ModuleDeclaration, - ModuleDetectionKind, ModuleKind, ModuleResolutionKind, moduleResolutionOptionDeclarations, MultiMap, - NamedDeclaration, NamedExports, NamedImports, NamedImportsOrExports, NamespaceExport, NamespaceImport, - NewExpression, NewLineKind, Node, NodeArray, NodeFlags, nodeModulesPathPart, NonNullExpression, noop, normalizePath, - NoSubstitutionTemplateLiteral, NumericLiteral, ObjectFlags, ObjectFlagsType, ObjectLiteralElement, - ObjectLiteralExpression, ObjectLiteralExpressionBase, ObjectTypeDeclaration, optionsAffectingProgramStructure, or, - OuterExpressionKinds, PackageId, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, - parseConfigFileTextToJson, PartiallyEmittedExpression, Path, pathIsRelative, Pattern, PostfixUnaryExpression, - PrefixUnaryExpression, PrinterOptions, PrintHandlers, PrivateIdentifier, ProjectReference, PrologueDirective, - PropertyAccessEntityNameExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, - PropertyNameLiteral, PseudoBigInt, QualifiedName, ReadonlyCollection, ReadonlyTextRange, - removeTrailingDirectorySeparator, RequireOrImportCall, RequireVariableStatement, ResolvedModuleFull, - ResolvedTypeReferenceDirective, ReturnStatement, SatisfiesExpression, ScriptKind, ScriptTarget, - semanticDiagnosticsOptionDeclarations, SetAccessorDeclaration, ShorthandPropertyAssignment, Signature, - SignatureDeclaration, SignatureFlags, SignatureKind, singleElementArray, singleOrUndefined, skipOuterExpressions, - skipTrivia, some, sort, SortedArray, SourceFile, SourceFileLike, SourceFileMayBeEmittedHost, SourceMapSource, - startsWith, startsWithUseStrict, Statement, stringContains, StringLiteral, StringLiteralLike, stringToToken, - SuperCall, SuperExpression, SuperProperty, SwitchStatement, Symbol, SymbolFlags, SymbolTable, SyntaxKind, - SyntaxList, sys, TaggedTemplateExpression, TemplateLiteral, TemplateLiteralLikeNode, TemplateLiteralTypeSpan, - TemplateSpan, TextRange, TextSpan, ThisTypePredicate, Token, TokenFlags, tokenToString, toPath, tracing, - TransformFlags, TransientSymbol, trimString, trimStringStart, TriviaSyntaxKind, tryCast, tryRemovePrefix, - TryStatement, TsConfigSourceFile, TupleTypeNode, Type, TypeAliasDeclaration, TypeAssertion, TypeChecker, - TypeElement, TypeFlags, TypeLiteralNode, TypeNode, TypeNodeSyntaxKind, TypeParameter, TypeParameterDeclaration, - TypePredicate, TypePredicateKind, TypeReferenceNode, unescapeLeadingUnderscores, UnionOrIntersectionTypeNode, - ValidImportTypeNode, VariableDeclaration, VariableDeclarationInitializedTo, VariableDeclarationList, - VariableLikeDeclaration, VariableStatement, version, WhileStatement, WithStatement, WriteFileCallback, - WriteFileCallbackData, YieldExpression, ResolutionMode, + AccessExpression, + AccessorDeclaration, + AllAccessorDeclarations, + AmbientModuleDeclaration, + AnyImportOrBareOrAccessedRequire, + AnyImportOrReExport, + AnyImportSyntax, + AnyValidImportOrReExport, + ArrayLiteralExpression, + ArrayTypeNode, + ArrowFunction, + AsExpression, + AssertionExpression, + AssignmentDeclarationKind, + AssignmentExpression, + AssignmentOperatorToken, + BinaryExpression, + BindableObjectDefinePropertyCall, + BindableStaticAccessExpression, + BindableStaticElementAccessExpression, + BindableStaticNameExpression, + BindingElement, + Block, + BundleFileSection, + BundleFileSectionKind, + BundleFileTextLike, + CallExpression, + CallLikeExpression, + CaseBlock, + CaseClause, + CaseOrDefaultClause, + CatchClause, + CharacterCodes, + CheckFlags, + ClassDeclaration, + ClassElement, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CommaListExpression, + CommandLineOption, + CommentDirective, + CommentDirectiveType, + CommentDirectivesMap, + CommentRange, + Comparison, + CompilerOptions, + ComputedPropertyName, + ConditionalExpression, + ConstructorDeclaration, + Debug, + Declaration, + DeclarationName, + DeclarationWithTypeParameterChildren, + DeclarationWithTypeParameters, + Decorator, + DefaultClause, + DestructuringAssignment, + Diagnostic, + DiagnosticCollection, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticRelatedInformation, + DiagnosticWithDetachedLocation, + DiagnosticWithLocation, + Diagnostics, + DoStatement, + DynamicNamedBinaryExpression, + DynamicNamedDeclaration, + ElementAccessExpression, + EmitFlags, + EmitHost, + EmitResolver, + EmitTextWriter, + EntityName, + EntityNameExpression, + EntityNameOrEntityNameExpression, + EnumDeclaration, + EqualityComparer, + EqualsToken, + ExportAssignment, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + ExpressionWithTypeArguments, + Extension, + ExternalModuleReference, + FileExtensionInfo, + FileReference, + FileWatcher, + ForInOrOfStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + GetCanonicalFileName, + HasExpressionInitializer, + HasInitializer, + HasJSDoc, + HasModifiers, + HasType, + HasTypeArguments, + HeritageClause, + Identifier, + IdentifierTypePredicate, + IfStatement, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportMetaProperty, + ImportSpecifier, + ImportTypeNode, + IndexInfo, + InitializedVariableDeclaration, + InterfaceDeclaration, + JSDoc, + JSDocCallbackTag, + JSDocEnumTag, + JSDocMemberName, + JSDocParameterTag, + JSDocPropertyLikeTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocTypedefTag, + JsonSourceFile, + JsxChild, + JsxElement, + JsxEmit, + JsxFragment, + JsxOpeningElement, + JsxOpeningLikeElement, + JsxSelfClosingElement, + JsxTagNameExpression, + KeywordSyntaxKind, + LabeledStatement, + LanguageVariant, + LateVisibilityPaintedStatement, + LiteralImportTypeNode, + LiteralLikeElementAccessExpression, + LiteralLikeNode, + LogicalOrCoalescingAssignmentOperator, + MapLike, + MemberName, + MethodDeclaration, + ModeAwareCache, + ModifierFlags, + ModifierLike, + ModuleBlock, + ModuleDeclaration, + ModuleDetectionKind, + ModuleKind, + ModuleResolutionKind, + MultiMap, + NamedDeclaration, + NamedExports, + NamedImports, + NamedImportsOrExports, + NamespaceExport, + NamespaceImport, + NewExpression, + NewLineKind, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + NodeFlags, + NonNullExpression, + NumericLiteral, + ObjectFlags, + ObjectFlagsType, + ObjectLiteralElement, + ObjectLiteralExpression, + ObjectLiteralExpressionBase, + ObjectTypeDeclaration, + OuterExpressionKinds, + PackageId, + ParameterDeclaration, + ParenthesizedExpression, + ParenthesizedTypeNode, + PartiallyEmittedExpression, + Path, + Pattern, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrintHandlers, + PrinterOptions, + PrivateIdentifier, + ProjectReference, + PrologueDirective, + PropertyAccessEntityNameExpression, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertyNameLiteral, + PseudoBigInt, + QualifiedName, + ReadonlyCollection, + ReadonlyTextRange, + RequireOrImportCall, + RequireVariableStatement, + ResolutionMode, + ResolvedModuleFull, + ResolvedTypeReferenceDirective, + ReturnStatement, + SatisfiesExpression, + ScriptKind, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SortedArray, + SourceFile, + SourceFileLike, + SourceFileMayBeEmittedHost, + SourceMapSource, + Statement, + StringLiteral, + StringLiteralLike, + SuperCall, + SuperExpression, + SuperProperty, + SwitchStatement, + Symbol, + SymbolFlags, + SymbolTable, + SyntaxKind, + SyntaxList, + TaggedTemplateExpression, + TemplateLiteral, + TemplateLiteralLikeNode, + TemplateLiteralTypeSpan, + TemplateSpan, + TextRange, + TextSpan, + ThisTypePredicate, + Token, + TokenFlags, + TransformFlags, + TransientSymbol, + TriviaSyntaxKind, + TryStatement, + TsConfigSourceFile, + TupleTypeNode, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeNodeSyntaxKind, + TypeParameter, + TypeParameterDeclaration, + TypePredicate, + TypePredicateKind, + TypeReferenceNode, + UnionOrIntersectionTypeNode, + ValidImportTypeNode, + VariableDeclaration, + VariableDeclarationInitializedTo, + VariableDeclarationList, + VariableLikeDeclaration, + VariableStatement, + WhileStatement, + WithStatement, + WriteFileCallback, + WriteFileCallbackData, + YieldExpression, + __String, + addRange, + affectsDeclarationPathOptionDeclarations, + affectsEmitOptionDeclarations, + arrayFrom, + assertType, + binarySearch, + canHaveDecorators, + canHaveIllegalDecorators, + canHaveModifiers, + changeAnyExtension, + combinePaths, + compareStringsCaseSensitive, + compareValues, + computeLineAndCharacterOfPosition, + computeLineOfPosition, + computeLineStarts, + concatenate, + contains, + containsPath, + createGetCanonicalFileName, + createModeAwareCache, + createMultiMap, + createScanner, + createTextSpan, + createTextSpanFromBounds, + directorySeparator, + emptyArray, + ensurePathIsNonModuleName, + ensureTrailingDirectorySeparator, + equalOwnProperties, + equateValues, + escapeLeadingUnderscores, + every, + factory, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + find, + findAncestor, + findBestPatternMatch, + findIndex, + findLast, + firstDefined, + firstOrUndefined, + flatMap, + flatMapToMutable, + flatten, + forEach, + forEachAncestorDirectory, + forEachChild, + forEachChildRecursively, + getBaseFileName, + getCombinedModifierFlags, + getCombinedNodeFlags, + getDirectoryPath, + getEntries, + getJSDocAugmentsTag, + getJSDocDeprecatedTagNoCache, + getJSDocImplementsTags, + getJSDocOverrideTagNoCache, + getJSDocParameterTags, + getJSDocParameterTagsNoCache, + getJSDocPrivateTagNoCache, + getJSDocProtectedTagNoCache, + getJSDocPublicTagNoCache, + getJSDocReadonlyTagNoCache, + getJSDocReturnType, + getJSDocTags, + getJSDocType, + getJSDocTypeParameterTags, + getJSDocTypeParameterTagsNoCache, + getJSDocTypeTag, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLineStarts, + getLinesBetweenPositions, + getNameOfDeclaration, + getNormalizedAbsolutePath, + getNormalizedPathComponents, + getOwnKeys, + getParseTreeNode, + getPathComponents, + getPathFromPathComponents, + getRelativePathToDirectoryOrUrl, + getResolutionMode, + getResolutionName, + getRootLength, + getStringComparer, + getSymbolId, + getTrailingCommentRanges, + hasExtension, + hasInitializer, + hasJSDocNodes, + hasProperty, + idText, + identity, + ignoredPaths, + indexOfAnyCharCode, + insertSorted, + isAccessor, + isAnyDirectorySeparator, + isArray, + isArrayLiteralExpression, + isArrowFunction, + isBigIntLiteral, + isBinaryExpression, + isBindingPattern, + isCallExpression, + isClassDeclaration, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isCommaListExpression, + isComputedPropertyName, + isConstructorDeclaration, + isDeclaration, + isDecorator, + isElementAccessExpression, + isEnumDeclaration, + isEnumMember, + isExportAssignment, + isExportDeclaration, + isExpressionStatement, + isExpressionWithTypeArguments, + isExternalModule, + isExternalModuleReference, + isFileProbablyExternalModule, + isForStatement, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeOrClassStaticBlockDeclaration, + isGetAccessorDeclaration, + isHeritageClause, + isIdentifier, + isIdentifierText, + isImportTypeNode, + isInterfaceDeclaration, + isJSDoc, + isJSDocFunctionType, + isJSDocLinkLike, + isJSDocMemberName, + isJSDocNameReference, + isJSDocNode, + isJSDocParameterTag, + isJSDocPropertyLikeTag, + isJSDocSignature, + isJSDocTag, + isJSDocTemplateTag, + isJSDocTypeExpression, + isJSDocTypeLiteral, + isJSDocTypeTag, + isJsxChild, + isJsxFragment, + isJsxOpeningLikeElement, + isJsxText, + isLeftHandSideExpression, + isLineBreak, + isLiteralTypeNode, + isMemberName, + isMetaProperty, + isMethodOrAccessor, + isModuleDeclaration, + isNamedDeclaration, + isNamespaceExport, + isNamespaceExportDeclaration, + isNamespaceImport, + isNoSubstitutionTemplateLiteral, + isNumericLiteral, + isObjectLiteralExpression, + isOmittedExpression, + isParameter, + isParameterPropertyDeclaration, + isParenthesizedExpression, + isParenthesizedTypeNode, + isPrefixUnaryExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isPropertyName, + isPropertySignature, + isQualifiedName, + isRootedDiskPath, + isSetAccessorDeclaration, + isShorthandPropertyAssignment, + isSourceFile, + isString, + isStringLiteral, + isStringLiteralLike, + isTypeAliasDeclaration, + isTypeElement, + isTypeLiteralNode, + isTypeNode, + isTypeReferenceNode, + isVariableDeclaration, + isVariableStatement, + isVoidExpression, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, + last, + lastOrUndefined, + length, + map, + mapDefined, + moduleResolutionOptionDeclarations, + nodeModulesPathPart, + noop, + normalizePath, + optionsAffectingProgramStructure, + or, + parseConfigFileTextToJson, + pathIsRelative, + removeTrailingDirectorySeparator, + semanticDiagnosticsOptionDeclarations, + singleElementArray, + singleOrUndefined, + skipOuterExpressions, + skipTrivia, + some, + sort, + startsWith, + startsWithUseStrict, + stringContains, + stringToToken, + sys, + toPath, + tokenToString, + tracing, + trimString, + trimStringStart, + tryCast, + tryRemovePrefix, + unescapeLeadingUnderscores, + version, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 03b172fa3e7f2..9ff1b4f72aaaf 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -1,51 +1,268 @@ import { - __String, AccessExpression, AccessorDeclaration, ArrayBindingElement, ArrayBindingOrAssignmentPattern, - AssertionExpression, AssertionKey, AssignmentDeclarationKind, AssignmentPattern, AutoAccessorPropertyDeclaration, - BinaryExpression, BindableObjectDefinePropertyCall, BindingElement, BindingName, BindingOrAssignmentElement, - BindingOrAssignmentElementTarget, BindingOrAssignmentPattern, BindingPattern, Block, BooleanLiteral, - BreakOrContinueStatement, CallChain, CallExpression, CallLikeExpression, canHaveIllegalTypeParameters, - CaseOrDefaultClause, CharacterCodes, ClassElement, ClassLikeDeclaration, ClassStaticBlockDeclaration, combinePaths, - compareDiagnostics, CompilerOptions, ConciseBody, ConstructorDeclaration, ConstructorTypeNode, contains, - createCompilerDiagnostic, Debug, Declaration, DeclarationName, DeclarationStatement, DeclarationWithTypeParameters, - Decorator, Diagnostic, Diagnostics, ElementAccessChain, ElementAccessExpression, emptyArray, EntityName, - entityNameToString, EnumDeclaration, every, ExportAssignment, ExportSpecifier, Expression, FileReference, filter, - find, flatMap, ForInitializer, ForInOrOfStatement, FunctionBody, FunctionLikeDeclaration, FunctionTypeNode, - GeneratedIdentifier, GeneratedIdentifierFlags, GeneratedPrivateIdentifier, GetAccessorDeclaration, - getAssignmentDeclarationKind, getDirectoryPath, getEffectiveModifierFlags, - getEffectiveModifierFlagsAlwaysIncludeJSDoc, getElementOrPropertyAccessArgumentExpressionOrName, - getEmitScriptTarget, getJSDocCommentsAndTags, getJSDocTypeParameterDeclarations, hasAccessorModifier, hasDecorators, - HasDecorators, HasExpressionInitializer, HasInitializer, HasJSDoc, HasModifiers, hasProperty, hasSyntacticModifier, - HasType, Identifier, ImportClause, ImportEqualsDeclaration, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeNode, isAccessExpression, isAmbientModule, isAnyImportOrReExport, isArrowFunction, isBinaryExpression, - isBindableStaticElementAccessExpression, isBindingElement, isBlock, isCallExpression, isCallSignatureDeclaration, - isClassExpression, isClassStaticBlockDeclaration, isDecorator, isElementAccessExpression, isExportAssignment, - isExportDeclaration, isExportSpecifier, isFunctionBlock, isFunctionExpression, isFunctionTypeNode, isIdentifier, - isImportSpecifier, isInJSFile, isJSDoc, isJSDocAugmentsTag, isJSDocClassTag, isJSDocDeprecatedTag, isJSDocEnumTag, - isJSDocFunctionType, isJSDocImplementsTag, isJSDocOverrideTag, isJSDocParameterTag, isJSDocPrivateTag, - isJSDocProtectedTag, isJSDocPublicTag, isJSDocReadonlyTag, isJSDocReturnTag, isJSDocSignature, isJSDocTemplateTag, - isJSDocThisTag, isJSDocTypeAlias, isJSDocTypeLiteral, isJSDocTypeTag, isModuleBlock, isNonNullExpression, - isNotEmittedStatement, isOmittedExpression, isParameter, isPartiallyEmittedExpression, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, isRootedDiskPath, isSourceFile, - isStringLiteral, isTypeLiteralNode, isTypeNodeKind, isTypeReferenceNode, isVariableDeclaration, - isVariableDeclarationList, isVariableStatement, isWhiteSpaceLike, IterationStatement, JSDocAugmentsTag, - JSDocClassTag, JSDocComment, JSDocContainer, JSDocDeprecatedTag, JSDocEnumTag, JSDocImplementsTag, JSDocLink, - JSDocLinkCode, JSDocLinkPlain, JSDocNamespaceBody, JSDocOverrideTag, JSDocParameterTag, JSDocPrivateTag, - JSDocPropertyLikeTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSignature, JSDocTag, - JSDocTemplateTag, JSDocThisTag, JSDocTypedefTag, JSDocTypeTag, JsxAttributeLike, JsxChild, JsxExpression, - JsxOpeningLikeElement, JsxTagNameExpression, LabeledStatement, lastOrUndefined, LeftHandSideExpression, - LiteralExpression, LiteralToken, MemberName, MethodDeclaration, Modifier, ModifierFlags, ModifierLike, - modifierToFlag, ModuleBody, ModuleDeclaration, ModuleReference, NamedDeclaration, NamedExportBindings, - NamedImportBindings, NamespaceBody, NamespaceImport, NewExpression, Node, NodeArray, NodeFlags, NonNullChain, - normalizePath, NotEmittedStatement, ObjectBindingOrAssignmentElement, ObjectBindingOrAssignmentPattern, - ObjectLiteralElement, ObjectLiteralElementLike, OptionalChain, OptionalChainRoot, OuterExpressionKinds, - ParameterDeclaration, PartiallyEmittedExpression, pathIsRelative, PostfixUnaryExpression, PrefixUnaryExpression, - PrivateClassElementDeclaration, PrivateIdentifier, PrivateIdentifierPropertyAccessExpression, PropertyAccessChain, - PropertyAccessExpression, PropertyDeclaration, PropertyName, Push, QualifiedName, ScriptTarget, - SetAccessorDeclaration, setLocalizedDiagnosticMessages, setUILocale, SignatureDeclaration, skipOuterExpressions, - some, sortAndDeduplicate, SortedReadonlyArray, Statement, StringLiteral, StringLiteralLike, Symbol, SyntaxKind, - TemplateLiteral, TemplateLiteralToken, TemplateMiddle, TemplateTail, TextChangeRange, TextRange, TextSpan, - TypeElement, TypeNode, TypeOnlyAliasDeclaration, TypeParameterDeclaration, TypeReferenceType, UnaryExpression, - UnparsedNode, UnparsedTextLike, VariableDeclaration, + AccessExpression, + AccessorDeclaration, + ArrayBindingElement, + ArrayBindingOrAssignmentPattern, + AssertionExpression, + AssertionKey, + AssignmentDeclarationKind, + AssignmentPattern, + AutoAccessorPropertyDeclaration, + BinaryExpression, + BindableObjectDefinePropertyCall, + BindingElement, + BindingName, + BindingOrAssignmentElement, + BindingOrAssignmentElementTarget, + BindingOrAssignmentPattern, + BindingPattern, + Block, + BooleanLiteral, + BreakOrContinueStatement, + CallChain, + CallExpression, + CallLikeExpression, + CaseOrDefaultClause, + CharacterCodes, + ClassElement, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + CompilerOptions, + ConciseBody, + ConstructorDeclaration, + ConstructorTypeNode, + Debug, + Declaration, + DeclarationName, + DeclarationStatement, + DeclarationWithTypeParameters, + Decorator, + Diagnostic, + Diagnostics, + ElementAccessChain, + ElementAccessExpression, + EntityName, + EnumDeclaration, + ExportAssignment, + ExportSpecifier, + Expression, + FileReference, + ForInOrOfStatement, + ForInitializer, + FunctionBody, + FunctionLikeDeclaration, + FunctionTypeNode, + GeneratedIdentifier, + GeneratedIdentifierFlags, + GeneratedPrivateIdentifier, + GetAccessorDeclaration, + HasDecorators, + HasExpressionInitializer, + HasInitializer, + HasJSDoc, + HasModifiers, + HasType, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IterationStatement, + JSDocAugmentsTag, + JSDocClassTag, + JSDocComment, + JSDocContainer, + JSDocDeprecatedTag, + JSDocEnumTag, + JSDocImplementsTag, + JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, + JSDocNamespaceBody, + JSDocOverrideTag, + JSDocParameterTag, + JSDocPrivateTag, + JSDocPropertyLikeTag, + JSDocProtectedTag, + JSDocPublicTag, + JSDocReadonlyTag, + JSDocReturnTag, + JSDocSignature, + JSDocTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypeTag, + JSDocTypedefTag, + JsxAttributeLike, + JsxChild, + JsxExpression, + JsxOpeningLikeElement, + JsxTagNameExpression, + LabeledStatement, + LeftHandSideExpression, + LiteralExpression, + LiteralToken, + MemberName, + MethodDeclaration, + Modifier, + ModifierFlags, + ModifierLike, + ModuleBody, + ModuleDeclaration, + ModuleReference, + NamedDeclaration, + NamedExportBindings, + NamedImportBindings, + NamespaceBody, + NamespaceImport, + NewExpression, + Node, + NodeArray, + NodeFlags, + NonNullChain, + NotEmittedStatement, + ObjectBindingOrAssignmentElement, + ObjectBindingOrAssignmentPattern, + ObjectLiteralElement, + ObjectLiteralElementLike, + OptionalChain, + OptionalChainRoot, + OuterExpressionKinds, + ParameterDeclaration, + PartiallyEmittedExpression, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrivateClassElementDeclaration, + PrivateIdentifier, + PrivateIdentifierPropertyAccessExpression, + PropertyAccessChain, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + Push, + QualifiedName, + ScriptTarget, + SetAccessorDeclaration, + SignatureDeclaration, + SortedReadonlyArray, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SyntaxKind, + TemplateLiteral, + TemplateLiteralToken, + TemplateMiddle, + TemplateTail, + TextChangeRange, + TextRange, + TextSpan, + TypeElement, + TypeNode, + TypeOnlyAliasDeclaration, + TypeParameterDeclaration, + TypeReferenceType, + UnaryExpression, + UnparsedNode, + UnparsedTextLike, + VariableDeclaration, + __String, + canHaveIllegalTypeParameters, + combinePaths, + compareDiagnostics, + contains, + createCompilerDiagnostic, + emptyArray, + entityNameToString, + every, + filter, + find, + flatMap, + getAssignmentDeclarationKind, + getDirectoryPath, + getEffectiveModifierFlags, + getEffectiveModifierFlagsAlwaysIncludeJSDoc, + getElementOrPropertyAccessArgumentExpressionOrName, + getEmitScriptTarget, + getJSDocCommentsAndTags, + getJSDocTypeParameterDeclarations, + hasAccessorModifier, + hasDecorators, + hasProperty, + hasSyntacticModifier, + isAccessExpression, + isAmbientModule, + isAnyImportOrReExport, + isArrowFunction, + isBinaryExpression, + isBindableStaticElementAccessExpression, + isBindingElement, + isBlock, + isCallExpression, + isCallSignatureDeclaration, + isClassExpression, + isClassStaticBlockDeclaration, + isDecorator, + isElementAccessExpression, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isFunctionBlock, + isFunctionExpression, + isFunctionTypeNode, + isIdentifier, + isImportSpecifier, + isInJSFile, + isJSDoc, + isJSDocAugmentsTag, + isJSDocClassTag, + isJSDocDeprecatedTag, + isJSDocEnumTag, + isJSDocFunctionType, + isJSDocImplementsTag, + isJSDocOverrideTag, + isJSDocParameterTag, + isJSDocPrivateTag, + isJSDocProtectedTag, + isJSDocPublicTag, + isJSDocReadonlyTag, + isJSDocReturnTag, + isJSDocSignature, + isJSDocTemplateTag, + isJSDocThisTag, + isJSDocTypeAlias, + isJSDocTypeLiteral, + isJSDocTypeTag, + isModuleBlock, + isNonNullExpression, + isNotEmittedStatement, + isOmittedExpression, + isParameter, + isPartiallyEmittedExpression, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isRootedDiskPath, + isSourceFile, + isStringLiteral, + isTypeLiteralNode, + isTypeNodeKind, + isTypeReferenceNode, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + isWhiteSpaceLike, + lastOrUndefined, + modifierToFlag, + normalizePath, + pathIsRelative, + setLocalizedDiagnosticMessages, + setUILocale, + skipOuterExpressions, + some, + sortAndDeduplicate, } from "./_namespaces/ts"; export function isExternalModuleNameRelative(moduleName: string): boolean { diff --git a/src/compiler/visitorPublic.ts b/src/compiler/visitorPublic.ts index 1dec828d395d7..0ed6462e14508 100644 --- a/src/compiler/visitorPublic.ts +++ b/src/compiler/visitorPublic.ts @@ -1,22 +1,106 @@ import { - ConciseBody, Debug, EmitFlags, Expression, factory, FunctionBody, getEmitFlags, getEmitScriptTarget, Identifier, - isArray, isArrayBindingElement, isAssertClause, isAssertEntry, isAssertionKey, isAssertsKeyword, isAsteriskToken, - isAwaitKeyword, isBinaryOperatorToken, isBindingElement, isBindingName, isBindingPattern, isBlock, isCallChain, - isCaseBlock, isCaseOrDefaultClause, isCatchClause, isClassElement, isColonToken, isConciseBody, isDotDotDotToken, - isElementAccessChain, isEntityName, isEnumMember, isEqualsGreaterThanToken, isExclamationToken, isExportSpecifier, - isExpression, isExpressionWithTypeArguments, isForInitializer, isHeritageClause, isIdentifier, - isIdentifierOrThisTypeNode, isImportClause, isImportSpecifier, isImportTypeAssertionContainer, isJsxAttributeLike, - isJsxAttributes, isJsxChild, isJsxClosingElement, isJsxClosingFragment, isJsxOpeningElement, isJsxOpeningFragment, - isJsxTagNameExpression, isMemberName, isModifier, isModifierLike, isModuleBody, isModuleName, isModuleReference, - isNamedExportBindings, isNamedImportBindings, isObjectLiteralElementLike, isOptionalChain, isParameterDeclaration, - isPropertyAccessChain, isPropertyName, isQuestionDotToken, isQuestionOrExclamationToken, - isQuestionOrPlusOrMinusToken, isQuestionToken, isReadonlyKeywordOrPlusOrMinusToken, isStatement, - isStringLiteralOrJsxExpression, isTemplateHead, isTemplateLiteral, isTemplateLiteralTypeSpan, - isTemplateMiddleOrTemplateTail, isTemplateSpan, isToken, isTypeElement, isTypeNode, - isTypeNodeOrTypeParameterDeclaration, isTypeParameterDeclaration, isVariableDeclaration, isVariableDeclarationList, - LexicalEnvironmentFlags, Node, NodeArray, NodesVisitor, NodeVisitor, ParameterDeclaration, ScriptTarget, - setEmitFlags, setTextRange, setTextRangePosEnd, singleOrUndefined, some, Statement, SyntaxKind, - TransformationContext, VisitEachChildNodes, Visitor, + ConciseBody, + Debug, + EmitFlags, + Expression, + FunctionBody, + Identifier, + LexicalEnvironmentFlags, + Node, + NodeArray, + NodeVisitor, + NodesVisitor, + ParameterDeclaration, + ScriptTarget, + Statement, + SyntaxKind, + TransformationContext, + VisitEachChildNodes, + Visitor, + factory, + getEmitFlags, + getEmitScriptTarget, + isArray, + isArrayBindingElement, + isAssertClause, + isAssertEntry, + isAssertionKey, + isAssertsKeyword, + isAsteriskToken, + isAwaitKeyword, + isBinaryOperatorToken, + isBindingElement, + isBindingName, + isBindingPattern, + isBlock, + isCallChain, + isCaseBlock, + isCaseOrDefaultClause, + isCatchClause, + isClassElement, + isColonToken, + isConciseBody, + isDotDotDotToken, + isElementAccessChain, + isEntityName, + isEnumMember, + isEqualsGreaterThanToken, + isExclamationToken, + isExportSpecifier, + isExpression, + isExpressionWithTypeArguments, + isForInitializer, + isHeritageClause, + isIdentifier, + isIdentifierOrThisTypeNode, + isImportClause, + isImportSpecifier, + isImportTypeAssertionContainer, + isJsxAttributeLike, + isJsxAttributes, + isJsxChild, + isJsxClosingElement, + isJsxClosingFragment, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxTagNameExpression, + isMemberName, + isModifier, + isModifierLike, + isModuleBody, + isModuleName, + isModuleReference, + isNamedExportBindings, + isNamedImportBindings, + isObjectLiteralElementLike, + isOptionalChain, + isParameterDeclaration, + isPropertyAccessChain, + isPropertyName, + isQuestionDotToken, + isQuestionOrExclamationToken, + isQuestionOrPlusOrMinusToken, + isQuestionToken, + isReadonlyKeywordOrPlusOrMinusToken, + isStatement, + isStringLiteralOrJsxExpression, + isTemplateHead, + isTemplateLiteral, + isTemplateLiteralTypeSpan, + isTemplateMiddleOrTemplateTail, + isTemplateSpan, + isToken, + isTypeElement, + isTypeNode, + isTypeNodeOrTypeParameterDeclaration, + isTypeParameterDeclaration, + isVariableDeclaration, + isVariableDeclarationList, + setEmitFlags, + setTextRange, + setTextRangePosEnd, + singleOrUndefined, + some, } from "./_namespaces/ts"; /** diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 27e281428d913..78af4166e9478 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,23 +1,110 @@ import { - addRange, BuilderProgram, CancellationToken, chainDiagnosticMessages, CharacterCodes, combinePaths, CompilerHost, - CompilerOptions, contains, convertToRelativePath, copyProperties, countWhere, createCompilerDiagnostic, - createEmitAndSemanticDiagnosticsBuilderProgram, createGetCanonicalFileName, createGetSourceFile, - createIncrementalCompilerHost, createIncrementalProgram, CreateProgram, createWriteFileMeasuringIO, - CustomTransformers, Debug, Diagnostic, DiagnosticCategory, DiagnosticMessage, DiagnosticMessageChain, - DiagnosticReporter, Diagnostics, DirectoryStructureHost, EmitAndSemanticDiagnosticsBuilderProgram, EmitResult, emptyArray, - endsWith, ExitStatus, ExtendedConfigCacheEntry, Extension, externalHelpersModuleNameText, FileExtensionInfo, - fileExtensionIs, FileIncludeKind, FileIncludeReason, FileWatcher, filter, find, flattenDiagnosticMessageText, - forEach, forEachEntry, ForegroundColorEscapeSequences, formatColorAndReset, formatDiagnostic, FormatDiagnosticsHost, - formatDiagnosticsWithColorAndContext, generateDjb2Hash, getDefaultLibFileName, getDirectoryPath, - getEmitScriptTarget, getLineAndCharacterOfPosition, getNewLineCharacter, getNormalizedAbsolutePath, - getParsedCommandLineOfConfigFile, getPatternFromSpec, getReferencedFileLocation, getRegexFromPattern, - getRelativePathFromDirectory, getWatchFactory, HasCurrentDirectory, isExternalOrCommonJsModule, isLineBreak, - isReferencedFile, isReferenceFileLocation, isString, last, maybeBind, memoize, ModuleKind, noop, normalizePath, - outFile, packageIdToString, ParseConfigFileHost, ParsedCommandLine, pathIsAbsolute, Program, ProgramHost, ProjectReference, - ReportEmitErrorSummary, ReportFileInError, sortAndDeduplicateDiagnostics, SortedReadonlyArray, SourceFile, sourceMapCommentRegExp, - sourceMapCommentRegExpDontCareLineStart, sys, System, targetOptionDeclaration, WatchCompilerHost, - WatchCompilerHostOfConfigFile, WatchCompilerHostOfFilesAndCompilerOptions, WatchFactory, WatchFactoryHost, WatchHost, - WatchLogLevel, WatchOptions, WatchStatusReporter, whitespaceOrMapCommentRegExp, WriteFileCallback, + BuilderProgram, + CancellationToken, + CharacterCodes, + CompilerHost, + CompilerOptions, + CreateProgram, + CustomTransformers, + Debug, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + DiagnosticMessageChain, + DiagnosticReporter, + Diagnostics, + DirectoryStructureHost, + EmitAndSemanticDiagnosticsBuilderProgram, + EmitResult, + ExitStatus, + ExtendedConfigCacheEntry, + Extension, + FileExtensionInfo, + FileIncludeKind, + FileIncludeReason, + FileWatcher, + ForegroundColorEscapeSequences, + FormatDiagnosticsHost, + HasCurrentDirectory, + ModuleKind, + ParseConfigFileHost, + ParsedCommandLine, + Program, + ProgramHost, + ProjectReference, + ReportEmitErrorSummary, + ReportFileInError, + SortedReadonlyArray, + SourceFile, + System, + WatchCompilerHost, + WatchCompilerHostOfConfigFile, + WatchCompilerHostOfFilesAndCompilerOptions, + WatchFactory, + WatchFactoryHost, + WatchHost, + WatchLogLevel, + WatchOptions, + WatchStatusReporter, + WriteFileCallback, + addRange, + chainDiagnosticMessages, + combinePaths, + contains, + convertToRelativePath, + copyProperties, + countWhere, + createCompilerDiagnostic, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createGetSourceFile, + createIncrementalCompilerHost, + createIncrementalProgram, + createWriteFileMeasuringIO, + emptyArray, + endsWith, + externalHelpersModuleNameText, + fileExtensionIs, + filter, + find, + flattenDiagnosticMessageText, + forEach, + forEachEntry, + formatColorAndReset, + formatDiagnostic, + formatDiagnosticsWithColorAndContext, + generateDjb2Hash, + getDefaultLibFileName, + getDirectoryPath, + getEmitScriptTarget, + getLineAndCharacterOfPosition, + getNewLineCharacter, + getNormalizedAbsolutePath, + getParsedCommandLineOfConfigFile, + getPatternFromSpec, + getReferencedFileLocation, + getRegexFromPattern, + getRelativePathFromDirectory, + getWatchFactory, + isExternalOrCommonJsModule, + isLineBreak, + isReferenceFileLocation, + isReferencedFile, + isString, + last, + maybeBind, + memoize, + noop, + normalizePath, + outFile, + packageIdToString, + pathIsAbsolute, + sortAndDeduplicateDiagnostics, + sourceMapCommentRegExp, + sourceMapCommentRegExpDontCareLineStart, + sys, + targetOptionDeclaration, + whitespaceOrMapCommentRegExp, } from "./_namespaces/ts"; const sysFormatDiagnosticsHost: FormatDiagnosticsHost | undefined = sys ? { diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index e283f5859d6ef..7a673bdb89efc 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -1,26 +1,95 @@ import * as ts from "./_namespaces/ts"; import { - BuilderProgram, BuildInfo, canJsonReportNoInputFiles, changeCompilerHostLikeToUseCache, - changesAffectModuleResolution, cleanExtendedConfigCache, clearMap, clearSharedExtendedConfigFileWatcher, - closeFileWatcher, closeFileWatcherOf, CompilerHost, CompilerOptions, ConfigFileDiagnosticsReporter, - ConfigFileProgramReloadLevel, createBuilderProgramUsingProgramBuildInfo, createCachedDirectoryStructureHost, - createCompilerDiagnostic, createCompilerHostFromProgramHost, createCompilerHostWorker, - createEmitAndSemanticDiagnosticsBuilderProgram, createGetCanonicalFileName, createResolutionCache, - CreateSourceFileOptions, createWatchCompilerHostOfConfigFile, createWatchCompilerHostOfFilesAndCompilerOptions, - createWatchFactory, Debug, Diagnostic, DiagnosticMessage, DiagnosticReporter, Diagnostics, DirectoryStructureHost, - DirectoryWatcherCallback, EmitAndSemanticDiagnosticsBuilderProgram, ExtendedConfigCacheEntry, - FileExtensionInfo, FileReference, FileWatcher, FileWatcherCallback, FileWatcherEventKind, getBuildInfo, - getConfigFileParsingDiagnostics, getDirectoryPath, getEntries, getFileNamesFromConfigSpecs, getNewLineCharacter, - getNormalizedAbsolutePath, getParsedCommandLineOfConfigFile, getTsBuildInfoEmitOutputFilePath, - HasInvalidatedResolutions, isArray, isIgnoredFileFromWildCardWatching, isProgramUptoDate, MapLike, maybeBind, - ModuleResolutionCache, ModuleResolutionInfo, noop, noopFileWatcher, parseConfigHostFromCompilerHostLike, - ParsedCommandLine, Path, perfLogger, PollingInterval, ProjectReference, ResolutionCacheHost, ResolutionMode, ResolvedModule, - ResolvedProjectReference, ResolvedTypeReferenceDirective, returnFalse, returnTrue, ScriptTarget, - setGetSourceFileAsHashVersioned, SharedExtendedConfigFileWatcher, SourceFile, sys, System, toPath, + BuildInfo, + BuilderProgram, + CompilerHost, + CompilerOptions, + ConfigFileDiagnosticsReporter, + ConfigFileProgramReloadLevel, + CreateSourceFileOptions, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + DirectoryStructureHost, + DirectoryWatcherCallback, + EmitAndSemanticDiagnosticsBuilderProgram, + ExtendedConfigCacheEntry, + FileExtensionInfo, + FileReference, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + HasInvalidatedResolutions, + MapLike, + ModuleResolutionCache, + ModuleResolutionInfo, + ParsedCommandLine, + Path, + PollingInterval, + ProjectReference, + ResolutionCacheHost, + ResolutionMode, + ResolvedModule, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptTarget, + SharedExtendedConfigFileWatcher, + SourceFile, + System, TypeReferenceDirectiveResolutionInfo, - updateErrorForNoInputFiles, updateMissingFilePathsWatch, updateSharedExtendedConfigFileWatcher, - updateWatchingWildcardDirectories, version, WatchDirectoryFlags, WatchOptions, WatchType, WatchTypeRegistry, + WatchDirectoryFlags, + WatchOptions, + WatchType, + WatchTypeRegistry, WildcardDirectoryWatcher, + canJsonReportNoInputFiles, + changeCompilerHostLikeToUseCache, + changesAffectModuleResolution, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcher, + closeFileWatcherOf, + createBuilderProgramUsingProgramBuildInfo, + createCachedDirectoryStructureHost, + createCompilerDiagnostic, + createCompilerHostFromProgramHost, + createCompilerHostWorker, + createEmitAndSemanticDiagnosticsBuilderProgram, + createGetCanonicalFileName, + createResolutionCache, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchFactory, + getBuildInfo, + getConfigFileParsingDiagnostics, + getDirectoryPath, + getEntries, + getFileNamesFromConfigSpecs, + getNewLineCharacter, + getNormalizedAbsolutePath, + getParsedCommandLineOfConfigFile, + getTsBuildInfoEmitOutputFilePath, + isArray, + isIgnoredFileFromWildCardWatching, + isProgramUptoDate, + maybeBind, + noop, + noopFileWatcher, + parseConfigHostFromCompilerHostLike, + perfLogger, + returnFalse, + returnTrue, + setGetSourceFileAsHashVersioned, + sys, + toPath, + updateErrorForNoInputFiles, + updateMissingFilePathsWatch, + updateSharedExtendedConfigFileWatcher, + updateWatchingWildcardDirectories, + version, } from "./_namespaces/ts"; export interface ReadBuildProgramHost { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 8f4ee079fcee2..ac62a2d612d06 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,14 +1,58 @@ import * as ts from "./_namespaces/ts"; import { - arrayToMap, binarySearch, BuilderProgram, closeFileWatcher, compareStringsCaseSensitive, CompilerOptions, - createGetCanonicalFileName, Debug, DirectoryWatcherCallback, emptyArray, emptyFileSystemEntries, - ensureTrailingDirectorySeparator, ExtendedConfigCacheEntry, Extension, FileExtensionInfo, - fileExtensionIsOneOf, FileSystemEntries, FileWatcher, FileWatcherCallback, FileWatcherEventKind, find, - getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, hasExtension, identity, insertSorted, isArray, - isDeclarationFileName, isExcludedFile, isSupportedSourceFileName, map, matchesExclude, matchFiles, mutateMap, - noop, normalizePath, outFile, Path, PollingInterval, Program, removeFileExtension, removeIgnoredPath, - returnNoopFileWatcher, returnTrue, setSysLog, SortedArray, SortedReadonlyArray, supportedJSExtensionsFlat, - timestamp, WatchDirectoryFlags, WatchFileKind, WatchOptions, + BuilderProgram, + CompilerOptions, + Debug, + DirectoryWatcherCallback, + ExtendedConfigCacheEntry, + Extension, + FileExtensionInfo, + FileSystemEntries, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + Path, + PollingInterval, + Program, + SortedArray, + SortedReadonlyArray, + WatchDirectoryFlags, + WatchFileKind, + WatchOptions, + arrayToMap, + binarySearch, + closeFileWatcher, + compareStringsCaseSensitive, + createGetCanonicalFileName, + emptyArray, + emptyFileSystemEntries, + ensureTrailingDirectorySeparator, + fileExtensionIsOneOf, + find, + getBaseFileName, + getDirectoryPath, + getNormalizedAbsolutePath, + hasExtension, + identity, + insertSorted, + isArray, + isDeclarationFileName, + isExcludedFile, + isSupportedSourceFileName, + map, + matchFiles, + matchesExclude, + mutateMap, + noop, + normalizePath, + outFile, + removeFileExtension, + removeIgnoredPath, + returnNoopFileWatcher, + returnTrue, + setSysLog, + supportedJSExtensionsFlat, + timestamp, } from "./_namespaces/ts"; /** diff --git a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts index 2c6778e9b5797..aa235dc1cc988 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -1,14 +1,68 @@ import { - ArrowFunction, AsteriskToken, BinaryExpression, BinaryOperator, BinaryOperatorToken, BindingName, BooleanLiteral, - ClassElement, ClassExpression, ColonToken, ConciseBody, ConditionalExpression, ConstructorTypeNode, Debug, - Decorator, DeprecationOptions, EntityName, EqualsGreaterThanToken, ExclamationToken, ExportDeclaration, Expression, - ExpressionWithTypeArguments, factory, GeneratedIdentifierFlags, HeritageClause, Identifier, ImportClause, - IndexSignatureDeclaration, isNodeKind, JSDocParameterTag, JSDocTypeExpression, MethodSignature, Modifier, Mutable, - NamedExportBindings, NamedImportBindings, Node, NodeArray, NoSubstitutionTemplateLiteral, NumericLiteral, - ParameterDeclaration, parseBaseNodeFactory, PostfixUnaryExpression, PrefixUnaryExpression, PrimaryExpression, - PropertyName, PropertySignature, PseudoBigInt, QuestionToken, setParent, setTextRange, setTextRangePosEnd, - StringLiteral, SyntaxKind, TaggedTemplateExpression, TemplateLiteral, ThisTypeNode, Token, TypeNode, - TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, VariableDeclaration, YieldExpression, + ArrowFunction, + AsteriskToken, + BinaryExpression, + BinaryOperator, + BinaryOperatorToken, + BindingName, + BooleanLiteral, + ClassElement, + ClassExpression, + ColonToken, + ConciseBody, + ConditionalExpression, + ConstructorTypeNode, + Debug, + Decorator, + DeprecationOptions, + EntityName, + EqualsGreaterThanToken, + ExclamationToken, + ExportDeclaration, + Expression, + ExpressionWithTypeArguments, + GeneratedIdentifierFlags, + HeritageClause, + Identifier, + ImportClause, + IndexSignatureDeclaration, + JSDocParameterTag, + JSDocTypeExpression, + MethodSignature, + Modifier, + Mutable, + NamedExportBindings, + NamedImportBindings, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + NumericLiteral, + ParameterDeclaration, + PostfixUnaryExpression, + PrefixUnaryExpression, + PrimaryExpression, + PropertyName, + PropertySignature, + PseudoBigInt, + QuestionToken, + StringLiteral, + SyntaxKind, + TaggedTemplateExpression, + TemplateLiteral, + ThisTypeNode, + Token, + TypeNode, + TypeOperatorNode, + TypeParameterDeclaration, + TypePredicateNode, + VariableDeclaration, + YieldExpression, + factory, + isNodeKind, + parseBaseNodeFactory, + setParent, + setTextRange, + setTextRangePosEnd, } from "../_namespaces/ts"; import { deprecate } from "../deprecate"; diff --git a/src/deprecatedCompat/4.0/renamedNodeTests.ts b/src/deprecatedCompat/4.0/renamedNodeTests.ts index a168223b6f383..0b3f0125de673 100644 --- a/src/deprecatedCompat/4.0/renamedNodeTests.ts +++ b/src/deprecatedCompat/4.0/renamedNodeTests.ts @@ -1,4 +1,8 @@ -import { Node, SyntaxKind, TypeAssertion } from "../_namespaces/ts"; +import { + Node, + SyntaxKind, + TypeAssertion, +} from "../_namespaces/ts"; import { deprecate } from "../deprecate"; // DEPRECATION: Renamed node tests diff --git a/src/deprecatedCompat/4.2/abstractConstructorTypes.ts b/src/deprecatedCompat/4.2/abstractConstructorTypes.ts index 93a305656d6f9..6cca290144766 100644 --- a/src/deprecatedCompat/4.2/abstractConstructorTypes.ts +++ b/src/deprecatedCompat/4.2/abstractConstructorTypes.ts @@ -1,6 +1,14 @@ import { - addNodeFactoryPatcher, buildOverload, ConstructorTypeNode, factory, Modifier, NodeArray, NodeFactory, - ParameterDeclaration, TypeNode, TypeParameterDeclaration, + ConstructorTypeNode, + Modifier, + NodeArray, + NodeFactory, + ParameterDeclaration, + TypeNode, + TypeParameterDeclaration, + addNodeFactoryPatcher, + buildOverload, + factory, } from "../_namespaces/ts"; // DEPRECATION: Overloads for createConstructorTypeNode/updateConstructorTypeNode that do not accept 'modifiers' diff --git a/src/deprecatedCompat/4.2/renamedNodeTests.ts b/src/deprecatedCompat/4.2/renamedNodeTests.ts index 07c8524122bec..014aab74d75b3 100644 --- a/src/deprecatedCompat/4.2/renamedNodeTests.ts +++ b/src/deprecatedCompat/4.2/renamedNodeTests.ts @@ -1,4 +1,8 @@ -import { isMemberName, MemberName, Node } from "../_namespaces/ts"; +import { + MemberName, + Node, + isMemberName, +} from "../_namespaces/ts"; import { deprecate } from "../deprecate"; // DEPRECATION: Renamed node tests diff --git a/src/deprecatedCompat/4.6/importTypeAssertions.ts b/src/deprecatedCompat/4.6/importTypeAssertions.ts index 143e06edc48ff..9464b3d24e9e0 100644 --- a/src/deprecatedCompat/4.6/importTypeAssertions.ts +++ b/src/deprecatedCompat/4.6/importTypeAssertions.ts @@ -1,6 +1,15 @@ import { - addNodeFactoryPatcher, buildOverload, EntityName, factory, ImportTypeAssertionContainer, ImportTypeNode, isArray, - isEntityName, isImportTypeAssertionContainer, NodeFactory, TypeNode, + EntityName, + ImportTypeAssertionContainer, + ImportTypeNode, + NodeFactory, + TypeNode, + addNodeFactoryPatcher, + buildOverload, + factory, + isArray, + isEntityName, + isImportTypeAssertionContainer, } from "../_namespaces/ts"; // DEPRECATION: Overloads to createImportTypeNode/updateImportTypeNode that do not accept `assertions` diff --git a/src/deprecatedCompat/4.7/typeParameterModifiers.ts b/src/deprecatedCompat/4.7/typeParameterModifiers.ts index 6bb1c1630032c..6f501f791d492 100644 --- a/src/deprecatedCompat/4.7/typeParameterModifiers.ts +++ b/src/deprecatedCompat/4.7/typeParameterModifiers.ts @@ -1,6 +1,13 @@ import { - addNodeFactoryPatcher, buildOverload, factory, Identifier, isArray, Modifier, NodeFactory, TypeNode, + Identifier, + Modifier, + NodeFactory, + TypeNode, TypeParameterDeclaration, + addNodeFactoryPatcher, + buildOverload, + factory, + isArray, } from "../_namespaces/ts"; // DEPRECATION: Overloads to createTypeParameter/updateTypeParameter that does not accept `modifiers` diff --git a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts index 66b163c92d431..a86a327bef8b0 100644 --- a/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts +++ b/src/deprecatedCompat/4.8/mergeDecoratorsAndModifiers.ts @@ -1,16 +1,80 @@ import { - addNodeFactoryPatcher, AssertClause, AsteriskToken, BindingName, Block, buildOverload, ClassDeclaration, - ClassElement, ClassExpression, ClassStaticBlockDeclaration, concatenate, ConstructorDeclaration, Decorator, - DeprecationOptions, DotDotDotToken, EnumDeclaration, EnumMember, every, ExclamationToken, ExportAssignment, - ExportDeclaration, Expression, factory, FunctionDeclaration, GetAccessorDeclaration, HeritageClause, Identifier, - ImportClause, ImportDeclaration, ImportEqualsDeclaration, IndexSignatureDeclaration, InterfaceDeclaration, isArray, - isAssertClause, isAsteriskToken, isBindingName, isBlock, isClassElement, isDecorator, isDotDotDotToken, - isExpression, isHeritageClause, isIdentifier, isImportClause, isModifier, isModuleBody, isModuleName, - isModuleReference, isNamedExportBindings, isParameter, isPropertyName, isQuestionOrExclamationToken, - isQuestionToken, isTypeElement, isTypeNode, isTypeParameterDeclaration, MethodDeclaration, Modifier, ModifierLike, - ModuleBody, ModuleDeclaration, ModuleName, ModuleReference, NamedExportBindings, NodeFactory, NodeFlags, - ParameterDeclaration, PropertyDeclaration, PropertyName, QuestionToken, SetAccessorDeclaration, some, - TypeAliasDeclaration, TypeElement, TypeNode, TypeParameterDeclaration, + AssertClause, + AsteriskToken, + BindingName, + Block, + ClassDeclaration, + ClassElement, + ClassExpression, + ClassStaticBlockDeclaration, + ConstructorDeclaration, + Decorator, + DeprecationOptions, + DotDotDotToken, + EnumDeclaration, + EnumMember, + ExclamationToken, + ExportAssignment, + ExportDeclaration, + Expression, + FunctionDeclaration, + GetAccessorDeclaration, + HeritageClause, + Identifier, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + IndexSignatureDeclaration, + InterfaceDeclaration, + MethodDeclaration, + Modifier, + ModifierLike, + ModuleBody, + ModuleDeclaration, + ModuleName, + ModuleReference, + NamedExportBindings, + NodeFactory, + NodeFlags, + ParameterDeclaration, + PropertyDeclaration, + PropertyName, + QuestionToken, + SetAccessorDeclaration, + TypeAliasDeclaration, + TypeElement, + TypeNode, + TypeParameterDeclaration, + addNodeFactoryPatcher, + buildOverload, + concatenate, + every, + factory, + isArray, + isAssertClause, + isAsteriskToken, + isBindingName, + isBlock, + isClassElement, + isDecorator, + isDotDotDotToken, + isExpression, + isHeritageClause, + isIdentifier, + isImportClause, + isModifier, + isModuleBody, + isModuleName, + isModuleReference, + isNamedExportBindings, + isParameter, + isPropertyName, + isQuestionOrExclamationToken, + isQuestionToken, + isTypeElement, + isTypeNode, + isTypeParameterDeclaration, + some, } from "../_namespaces/ts"; // DEPRECATION: Deprecate passing `decorators` separate from `modifiers` diff --git a/src/deprecatedCompat/deprecate.ts b/src/deprecatedCompat/deprecate.ts index 6041425852a9f..860fde1b65474 100644 --- a/src/deprecatedCompat/deprecate.ts +++ b/src/deprecatedCompat/deprecate.ts @@ -1,4 +1,11 @@ -import { Debug, DeprecationOptions, formatStringFromArgs, noop, version, Version } from "./_namespaces/ts"; +import { + Debug, + DeprecationOptions, + Version, + formatStringFromArgs, + noop, + version, +} from "./_namespaces/ts"; export let enableDeprecationWarnings = true; diff --git a/src/deprecatedCompat/deprecations.ts b/src/deprecatedCompat/deprecations.ts index 2f8b59c3411a9..641a78b8e611c 100644 --- a/src/deprecatedCompat/deprecations.ts +++ b/src/deprecatedCompat/deprecations.ts @@ -1,4 +1,8 @@ -import { hasProperty, UnionToIntersection, Version } from "./_namespaces/ts"; +import { + UnionToIntersection, + Version, + hasProperty, +} from "./_namespaces/ts"; import { deprecate } from "./deprecate"; /** @internal */ diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 9561348f84da2..8d9b465d80b3b 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -1,22 +1,92 @@ import * as ts from "./_namespaces/ts"; import { - arrayFrom, BuilderProgram, BuildOptions, buildOpts, changeCompilerHostLikeToUseCache, CharacterCodes, combinePaths, - CommandLineOption, compareStringsCaseInsensitive, CompilerOptions, contains, convertToOptionsWithAbsolutePaths, - convertToTSConfig, createBuilderStatusReporter, createCompilerDiagnostic, createCompilerHostWorker, - createDiagnosticReporter, createGetCanonicalFileName, createIncrementalCompilerHost, createProgram, CreateProgram, - CreateProgramOptions, createSolutionBuilder, createSolutionBuilderHost, createSolutionBuilderWithWatch, - createSolutionBuilderWithWatchHost, createWatchCompilerHostOfConfigFile, - createWatchCompilerHostOfFilesAndCompilerOptions, createWatchProgram, Debug, Diagnostic, DiagnosticMessage, - DiagnosticReporter, Diagnostics, dumpTracingLegend, EmitAndSemanticDiagnosticsBuilderProgram, - emitFilesAndReportErrorsAndGetExitStatus, ExitStatus, ExtendedConfigCacheEntry, Extension, fileExtensionIs, - fileExtensionIsOneOf, filter, findConfigFile, forEach, formatMessage, generateTSConfig, - getBuildOrderFromAnyBuildOrder, getCompilerOptionsDiffValue, getConfigFileParsingDiagnostics, getDiagnosticText, - getEntries, getErrorSummaryText, getLineStarts, getNormalizedAbsolutePath, isIncrementalCompilation, isWatchSet, - normalizePath, optionDeclarations, optionsForBuild, optionsForWatch, padLeft, padRight, parseBuildCommand, - parseCommandLine, parseConfigFileWithSystem, ParsedCommandLine, Program, reduceLeftIterator, ReportEmitErrorSummary, - SolutionBuilder, SolutionBuilderHostBase, sort, SourceFile, startsWith, startTracing, stringContains, - supportedJSExtensionsFlat, supportedTSExtensionsFlat, sys, System, toPath, tracing, validateLocaleAndSetLanguage, - version, WatchCompilerHost, WatchOptions, + BuildOptions, + BuilderProgram, + CharacterCodes, + CommandLineOption, + CompilerOptions, + CreateProgram, + CreateProgramOptions, + Debug, + Diagnostic, + DiagnosticMessage, + DiagnosticReporter, + Diagnostics, + EmitAndSemanticDiagnosticsBuilderProgram, + ExitStatus, + ExtendedConfigCacheEntry, + Extension, + ParsedCommandLine, + Program, + ReportEmitErrorSummary, + SolutionBuilder, + SolutionBuilderHostBase, + SourceFile, + System, + WatchCompilerHost, + WatchOptions, + arrayFrom, + buildOpts, + changeCompilerHostLikeToUseCache, + combinePaths, + compareStringsCaseInsensitive, + contains, + convertToOptionsWithAbsolutePaths, + convertToTSConfig, + createBuilderStatusReporter, + createCompilerDiagnostic, + createCompilerHostWorker, + createDiagnosticReporter, + createGetCanonicalFileName, + createIncrementalCompilerHost, + createProgram, + createSolutionBuilder, + createSolutionBuilderHost, + createSolutionBuilderWithWatch, + createSolutionBuilderWithWatchHost, + createWatchCompilerHostOfConfigFile, + createWatchCompilerHostOfFilesAndCompilerOptions, + createWatchProgram, + dumpTracingLegend, + emitFilesAndReportErrorsAndGetExitStatus, + fileExtensionIs, + fileExtensionIsOneOf, + filter, + findConfigFile, + forEach, + formatMessage, + generateTSConfig, + getBuildOrderFromAnyBuildOrder, + getCompilerOptionsDiffValue, + getConfigFileParsingDiagnostics, + getDiagnosticText, + getEntries, + getErrorSummaryText, + getLineStarts, + getNormalizedAbsolutePath, + isIncrementalCompilation, + isWatchSet, + normalizePath, + optionDeclarations, + optionsForBuild, + optionsForWatch, + padLeft, + padRight, + parseBuildCommand, + parseCommandLine, + parseConfigFileWithSystem, + reduceLeftIterator, + sort, + startTracing, + startsWith, + stringContains, + supportedJSExtensionsFlat, + supportedTSExtensionsFlat, + sys, + toPath, + tracing, + validateLocaleAndSetLanguage, + version, } from "./_namespaces/ts"; import * as performance from "../compiler/_namespaces/ts.performance"; diff --git a/src/harness/_namespaces/ts.ts b/src/harness/_namespaces/ts.ts index 6f90664e41e33..3f6ecdc8eeea5 100644 --- a/src/harness/_namespaces/ts.ts +++ b/src/harness/_namespaces/ts.ts @@ -8,4 +8,4 @@ export * from "../../typingsInstallerCore/_namespaces/ts"; export * from "../../deprecatedCompat/_namespaces/ts"; export * from "../harnessGlobals"; import * as server from "./ts.server"; -export { server }; \ No newline at end of file +export { server }; diff --git a/src/harness/client.ts b/src/harness/client.ts index ee8d9add7c400..852372aea4930 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -1,18 +1,81 @@ import { - ApplicableRefactorInfo, CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, Classifications, - ClassifiedSpan, CodeActionCommand, CodeFixAction, CompletionEntry, CompletionEntryDetails, CompletionInfo, - computeLineAndCharacterOfPosition, computeLineStarts, computePositionOfLineAndCharacter, createQueue, - createTextSpanFromBounds, Debug, DefinitionInfo, DefinitionInfoAndBoundSpan, Diagnostic, DiagnosticCategory, - DiagnosticWithLocation, DocCommentTemplateOptions, DocumentHighlights, DocumentSpan, EditorOptions, EmitOutput, - FileTextChanges, firstDefined, FormatCodeOptions, FormatCodeSettings, getSnapshotText, identity, - ImplementationLocation, InlayHint, InlayHintKind, isString, JSDocTagInfo, LanguageService, LanguageServiceHost, map, - mapOneOrMany, NavigateToItem, NavigationBarItem, NavigationTree, notImplemented, OrganizeImportsArgs, - OutliningSpan, PatternMatchKind, Program, QuickInfo, RefactorEditInfo, ReferencedSymbol, ReferenceEntry, RenameInfo, - RenameInfoFailure, RenameInfoSuccess, RenameLocation, ScriptElementKind, SemanticClassificationFormat, - SignatureHelpItem, SignatureHelpItems, SourceFile, Symbol, TextChange, TextInsertion, textPart, TextRange, TextSpan, - TodoComment, TodoCommentDescriptor, UserPreferences, + ApplicableRefactorInfo, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + Classifications, + ClassifiedSpan, + CodeActionCommand, + CodeFixAction, + CompletionEntry, + CompletionEntryDetails, + CompletionInfo, + Debug, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + Diagnostic, + DiagnosticCategory, + DiagnosticWithLocation, + DocCommentTemplateOptions, + DocumentHighlights, + DocumentSpan, + EditorOptions, + EmitOutput, + FileTextChanges, + FormatCodeOptions, + FormatCodeSettings, + ImplementationLocation, + InlayHint, + InlayHintKind, + JSDocTagInfo, + LanguageService, + LanguageServiceHost, + NavigateToItem, + NavigationBarItem, + NavigationTree, + OrganizeImportsArgs, + OutliningSpan, + PatternMatchKind, + Program, + QuickInfo, + RefactorEditInfo, + ReferenceEntry, + ReferencedSymbol, + RenameInfo, + RenameInfoFailure, + RenameInfoSuccess, + RenameLocation, + ScriptElementKind, + SemanticClassificationFormat, + SignatureHelpItem, + SignatureHelpItems, + SourceFile, + Symbol, + TextChange, + TextInsertion, + TextRange, + TextSpan, + TodoComment, + TodoCommentDescriptor, + UserPreferences, + computeLineAndCharacterOfPosition, + computeLineStarts, + computePositionOfLineAndCharacter, + createQueue, + createTextSpanFromBounds, + firstDefined, + getSnapshotText, + identity, + isString, + map, + mapOneOrMany, + notImplemented, + textPart, } from "./_namespaces/ts"; -import { CommandNames, protocol } from "./_namespaces/ts.server"; +import { + CommandNames, + protocol, +} from "./_namespaces/ts.server"; export interface SessionClientHost extends LanguageServiceHost { writeMessage(message: string): void; diff --git a/src/harness/findUpDir.ts b/src/harness/findUpDir.ts index 878bd87dcb323..52f6d766668ca 100644 --- a/src/harness/findUpDir.ts +++ b/src/harness/findUpDir.ts @@ -1,5 +1,9 @@ import { existsSync } from "fs"; -import { dirname, join, resolve } from "path"; +import { + dirname, + join, + resolve, +} from "path"; // search directories upward to avoid hard-wired paths based on the // build tree (same as scripts/build/findUpDir.js) diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index a8994387a0521..642e4990385b3 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -5,7 +5,11 @@ import * as vfs from "./_namespaces/vfs"; import * as compiler from "./_namespaces/compiler"; import * as documents from "./_namespaces/documents"; import * as fakes from "./_namespaces/fakes"; -import { RunnerBase, TypeWriterResult, TypeWriterWalker } from "./_namespaces/Harness"; +import { + RunnerBase, + TypeWriterResult, + TypeWriterWalker, +} from "./_namespaces/Harness"; export interface IO { newLine(): string; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 85a543d3f0f86..80bec464788d3 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -4,7 +4,12 @@ import * as vfs from "./_namespaces/vfs"; import * as collections from "./_namespaces/collections"; import * as vpath from "./_namespaces/vpath"; import * as Utils from "./_namespaces/Utils"; -import { Compiler, harnessNewLine, mockHash, virtualFileSystemRoot } from "./_namespaces/Harness"; +import { + Compiler, + harnessNewLine, + mockHash, + virtualFileSystemRoot, +} from "./_namespaces/Harness"; export function makeDefaultProxy(info: ts.server.PluginCreateInfo): ts.LanguageService { const proxy = Object.create(/*prototype*/ null); // eslint-disable-line no-null/no-null diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index 6a3ee7ef730be..ed85064d8d839 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -1,5 +1,9 @@ import * as ts from "./_namespaces/ts"; -import { FileBasedTest, IO, userSpecifiedRoot } from "./_namespaces/Harness"; +import { + FileBasedTest, + IO, + userSpecifiedRoot, +} from "./_namespaces/Harness"; export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project" | "rwc" | "test262" | "user" | "dt" | "docker"; export type CompilerTestKind = "conformance" | "compiler"; diff --git a/src/jsTyping/jsTyping.ts b/src/jsTyping/jsTyping.ts index 4823dac905e83..69777db105bf8 100644 --- a/src/jsTyping/jsTyping.ts +++ b/src/jsTyping/jsTyping.ts @@ -1,9 +1,34 @@ import { - CharacterCodes, combinePaths, compareStringsCaseSensitive, CompilerOptions, Debug, deduplicate, - equateStringsCaseSensitive, Extension, fileExtensionIs, flatMap, forEach, getBaseFileName, getDirectoryPath, - getEntries, getNormalizedAbsolutePath, getOwnKeys, getPathComponents, getProperty, hasJSFileExtension, - mapDefined, MapLike, normalizePath, Path, readConfigFile, removeFileExtension, - removeMinAndVersionNumbers, some, TypeAcquisition, Version, versionMajorMinor, + CharacterCodes, + CompilerOptions, + Debug, + Extension, + MapLike, + Path, + TypeAcquisition, + Version, + combinePaths, + compareStringsCaseSensitive, + deduplicate, + equateStringsCaseSensitive, + fileExtensionIs, + flatMap, + forEach, + getBaseFileName, + getDirectoryPath, + getEntries, + getNormalizedAbsolutePath, + getOwnKeys, + getPathComponents, + getProperty, + hasJSFileExtension, + mapDefined, + normalizePath, + readConfigFile, + removeFileExtension, + removeMinAndVersionNumbers, + some, + versionMajorMinor, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/jsTyping/shared.ts b/src/jsTyping/shared.ts index f004b0257ad03..c6a3dfb38bda2 100644 --- a/src/jsTyping/shared.ts +++ b/src/jsTyping/shared.ts @@ -1,4 +1,7 @@ -import { padLeft, sys } from "./_namespaces/ts"; +import { + padLeft, + sys, +} from "./_namespaces/ts"; export type ActionSet = "action::set"; export type ActionInvalidate = "action::invalidate"; diff --git a/src/jsTyping/types.ts b/src/jsTyping/types.ts index 013e32553c6e1..a30a215adf12a 100644 --- a/src/jsTyping/types.ts +++ b/src/jsTyping/types.ts @@ -1,10 +1,23 @@ import { - ActionInvalidate, ActionPackageInstalled, ActionSet, EventBeginInstallTypes, EventEndInstallTypes, - EventInitializationFailed, EventTypesRegistry, + ActionInvalidate, + ActionPackageInstalled, + ActionSet, + EventBeginInstallTypes, + EventEndInstallTypes, + EventInitializationFailed, + EventTypesRegistry, } from "./_namespaces/ts.server"; import { - CompilerOptions, DirectoryWatcherCallback, FileWatcher, FileWatcherCallback, JsTyping, MapLike, Path, - SortedReadonlyArray, TypeAcquisition, WatchOptions, + CompilerOptions, + DirectoryWatcherCallback, + FileWatcher, + FileWatcherCallback, + JsTyping, + MapLike, + Path, + SortedReadonlyArray, + TypeAcquisition, + WatchOptions, } from "./_namespaces/ts"; export interface TypingInstallerResponse { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index bbfd4dfe11042..4004c82e98f1a 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,38 +1,184 @@ import { - ActionInvalidate, ActionSet, asNormalizedPath, AutoImportProviderProject, BeginEnablePluginResult, - BeginInstallTypes, ConfiguredProject, countEachFileTypes, createPackageJsonCache, emptyArray, EndInstallTypes, - Errors, ExternalProject, getBaseConfigFileName, hasNoTypeScriptSource, InferredProject, InvalidateCachedTypings, - isConfiguredProject, isDynamicFileName, isInferredProject, isInferredProjectName, ITypingsInstaller, Logger, - LogLevel, makeAutoImportProviderProjectName, makeAuxiliaryProjectName, makeInferredProjectName, Msg, NormalizedPath, - normalizedPathToPath, nullTypingsInstaller, PackageInstalledResponse, PackageJsonCache, Project, - ProjectFilesWithTSDiagnostics, ProjectKind, ProjectOptions, protocol, ScriptInfo, ScriptInfoVersion, ServerHost, - Session, SetTypings, ThrottledOperations, toNormalizedPath, TypingsCache, + ActionInvalidate, + ActionSet, + AutoImportProviderProject, + BeginEnablePluginResult, + BeginInstallTypes, + ConfiguredProject, + EndInstallTypes, + Errors, + ExternalProject, + ITypingsInstaller, + InferredProject, + InvalidateCachedTypings, + LogLevel, + Logger, + Msg, + NormalizedPath, + PackageInstalledResponse, + PackageJsonCache, + Project, + ProjectFilesWithTSDiagnostics, + ProjectKind, + ProjectOptions, + ScriptInfo, + ScriptInfoVersion, + ServerHost, + Session, + SetTypings, + ThrottledOperations, + TypingsCache, + asNormalizedPath, + countEachFileTypes, + createPackageJsonCache, + emptyArray, + getBaseConfigFileName, + hasNoTypeScriptSource, + isConfiguredProject, + isDynamicFileName, + isInferredProject, + isInferredProjectName, + makeAutoImportProviderProjectName, + makeAuxiliaryProjectName, + makeInferredProjectName, + normalizedPathToPath, + nullTypingsInstaller, + protocol, + toNormalizedPath, } from "./_namespaces/ts.server"; import { - addToSeen, arrayFrom, arrayToMap, AssertionLevel, CachedDirectoryStructureHost, canJsonReportNoInputFiles, - canWatchDirectoryOrFile, cleanExtendedConfigCache, clearMap, clearSharedExtendedConfigFileWatcher, - closeFileWatcherOf, combinePaths, CommandLineOption, CompilerOptions, CompletionInfo, ConfigFileProgramReloadLevel, - contains, containsPath, convertCompilerOptionsForTelemetry, convertEnableAutoDiscoveryToEnable, convertJsonOption, - createCachedDirectoryStructureHost, createDocumentRegistryInternal, createGetCanonicalFileName, createMultiMap, - Debug, Diagnostic, directorySeparator, DirectoryStructureHost, DocumentPosition, DocumentPositionMapper, - DocumentRegistry, DocumentRegistryBucketKeyWithMode, emptyOptions, ensureTrailingDirectorySeparator, - ExtendedConfigCacheEntry, FileExtensionInfo, fileExtensionIs, FileWatcher, FileWatcherEventKind, find, flatMap, - forEach, forEachAncestorDirectory, forEachEntry, forEachKey, forEachResolvedProjectReference, FormatCodeSettings, - getAnyExtensionFromPath, getBaseFileName, getDefaultFormatCodeSettings, getDirectoryPath, getDocumentPositionMapper, - getEntries, getFileNamesFromConfigSpecs, getFileWatcherEventKind, getNormalizedAbsolutePath, getSnapshotText, - getWatchFactory, hasExtension, hasProperty, hasTSFileExtension, HostCancellationToken, identity, - IncompleteCompletionsCache, IndentStyle, isArray, isIgnoredFileFromWildCardWatching, isInsideNodeModules, - isJsonEqual, isNodeModulesDirectory, isRootedDiskPath, isString, LanguageServiceMode, length, map, - mapDefinedEntries, mapDefinedIterator, missingFileModifiedTime, MultiMap, noop, normalizePath, normalizeSlashes, - optionDeclarations, optionsForWatch, PackageJsonAutoImportPreference, ParsedCommandLine, - parseJsonSourceFileConfigFileContent, parseJsonText, parsePackageName, Path, PerformanceEvent, PluginImport, - PollingInterval, ProjectPackageJsonInfo, ProjectReference, ReadMapFile, ReadonlyCollection, removeFileExtension, - removeIgnoredPath, removeMinAndVersionNumbers, ResolvedProjectReference, resolveProjectReferencePath, - returnNoopFileWatcher, returnTrue, ScriptKind, SharedExtendedConfigFileWatcher, some, SourceFile, SourceFileLike, startsWith, - Ternary, TextChange, toFileNameLowerCase, toPath, tracing, tryAddToSet, tryReadFile, TsConfigSourceFile, - TypeAcquisition, typeAcquisitionDeclarations, unorderedRemoveItem, updateSharedExtendedConfigFileWatcher, - updateWatchingWildcardDirectories, UserPreferences, version, WatchDirectoryFlags, WatchFactory, WatchLogLevel, - WatchOptions, WatchType, WildcardDirectoryWatcher, + AssertionLevel, + CachedDirectoryStructureHost, + CommandLineOption, + CompilerOptions, + CompletionInfo, + ConfigFileProgramReloadLevel, + Debug, + Diagnostic, + DirectoryStructureHost, + DocumentPosition, + DocumentPositionMapper, + DocumentRegistry, + DocumentRegistryBucketKeyWithMode, + ExtendedConfigCacheEntry, + FileExtensionInfo, + FileWatcher, + FileWatcherEventKind, + FormatCodeSettings, + HostCancellationToken, + IncompleteCompletionsCache, + IndentStyle, + LanguageServiceMode, + MultiMap, + PackageJsonAutoImportPreference, + ParsedCommandLine, + Path, + PerformanceEvent, + PluginImport, + PollingInterval, + ProjectPackageJsonInfo, + ProjectReference, + ReadMapFile, + ReadonlyCollection, + ResolvedProjectReference, + ScriptKind, + SharedExtendedConfigFileWatcher, + SourceFile, + SourceFileLike, + Ternary, + TextChange, + TsConfigSourceFile, + TypeAcquisition, + UserPreferences, + WatchDirectoryFlags, + WatchFactory, + WatchLogLevel, + WatchOptions, + WatchType, + WildcardDirectoryWatcher, + addToSeen, + arrayFrom, + arrayToMap, + canJsonReportNoInputFiles, + canWatchDirectoryOrFile, + cleanExtendedConfigCache, + clearMap, + clearSharedExtendedConfigFileWatcher, + closeFileWatcherOf, + combinePaths, + contains, + containsPath, + convertCompilerOptionsForTelemetry, + convertEnableAutoDiscoveryToEnable, + convertJsonOption, + createCachedDirectoryStructureHost, + createDocumentRegistryInternal, + createGetCanonicalFileName, + createMultiMap, + directorySeparator, + emptyOptions, + ensureTrailingDirectorySeparator, + fileExtensionIs, + find, + flatMap, + forEach, + forEachAncestorDirectory, + forEachEntry, + forEachKey, + forEachResolvedProjectReference, + getAnyExtensionFromPath, + getBaseFileName, + getDefaultFormatCodeSettings, + getDirectoryPath, + getDocumentPositionMapper, + getEntries, + getFileNamesFromConfigSpecs, + getFileWatcherEventKind, + getNormalizedAbsolutePath, + getSnapshotText, + getWatchFactory, + hasExtension, + hasProperty, + hasTSFileExtension, + identity, + isArray, + isIgnoredFileFromWildCardWatching, + isInsideNodeModules, + isJsonEqual, + isNodeModulesDirectory, + isRootedDiskPath, + isString, + length, + map, + mapDefinedEntries, + mapDefinedIterator, + missingFileModifiedTime, + noop, + normalizePath, + normalizeSlashes, + optionDeclarations, + optionsForWatch, + parseJsonSourceFileConfigFileContent, + parseJsonText, + parsePackageName, + removeFileExtension, + removeIgnoredPath, + removeMinAndVersionNumbers, + resolveProjectReferencePath, + returnNoopFileWatcher, + returnTrue, + some, + startsWith, + toFileNameLowerCase, + toPath, + tracing, + tryAddToSet, + tryReadFile, + typeAcquisitionDeclarations, + unorderedRemoveItem, + updateSharedExtendedConfigFileWatcher, + updateWatchingWildcardDirectories, + version, } from "./_namespaces/ts"; export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; diff --git a/src/server/moduleSpecifierCache.ts b/src/server/moduleSpecifierCache.ts index 5ba251b632c4b..c54a68b354da1 100644 --- a/src/server/moduleSpecifierCache.ts +++ b/src/server/moduleSpecifierCache.ts @@ -1,6 +1,13 @@ import { - Debug, FileWatcher, ModulePath, ModuleSpecifierCache, ModuleSpecifierOptions, nodeModulesPathPart, Path, - ResolvedModuleSpecifierInfo, UserPreferences, + Debug, + FileWatcher, + ModulePath, + ModuleSpecifierCache, + ModuleSpecifierOptions, + Path, + ResolvedModuleSpecifierInfo, + UserPreferences, + nodeModulesPathPart, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/server/packageJsonCache.ts b/src/server/packageJsonCache.ts index 3c34de2dd30d9..2f2f0be330559 100644 --- a/src/server/packageJsonCache.ts +++ b/src/server/packageJsonCache.ts @@ -1,6 +1,13 @@ import { - combinePaths, createPackageJsonInfo, Debug, forEachAncestorDirectory, getDirectoryPath, Path, - ProjectPackageJsonInfo, Ternary, tryFileExists, + Debug, + Path, + ProjectPackageJsonInfo, + Ternary, + combinePaths, + createPackageJsonInfo, + forEachAncestorDirectory, + getDirectoryPath, + tryFileExists, } from "./_namespaces/ts"; import { ProjectService } from "./_namespaces/ts.server"; diff --git a/src/server/project.ts b/src/server/project.ts index d34b2e0e83f87..8c8748fe5bdc3 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,34 +1,155 @@ import * as ts from "./_namespaces/ts"; import { - asNormalizedPath, createModuleSpecifierCache, emptyArray, Errors, FileStats, forEachResolvedProjectReferenceProject, - LogLevel, ModuleImportResult, Msg, NormalizedPath, projectContainsInfoDirectly, ProjectOptions, - ProjectReferenceProjectLoadKind, ProjectService, protocol, ScriptInfo, ServerHost, Session, toNormalizedPath, - TypingsCache, updateProjectIfDirty, + Errors, + FileStats, + LogLevel, + ModuleImportResult, + Msg, + NormalizedPath, + ProjectOptions, + ProjectReferenceProjectLoadKind, + ProjectService, + ScriptInfo, + ServerHost, + Session, + TypingsCache, + asNormalizedPath, + createModuleSpecifierCache, + emptyArray, + forEachResolvedProjectReferenceProject, + projectContainsInfoDirectly, + protocol, + toNormalizedPath, + updateProjectIfDirty, } from "./_namespaces/ts.server"; import { - addRange, append, ApplyCodeActionCommandResult, arrayFrom, arrayToMap, BuilderState, CachedDirectoryStructureHost, - changesAffectModuleResolution, clearMap, cloneCompilerOptions, closeFileWatcher, closeFileWatcherOf, combinePaths, - CompilerHost, CompilerOptions, concatenate, ConfigFileProgramReloadLevel, createCacheableExportInfoMap, - createLanguageService, createResolutionCache, createSymlinkCache, Debug, Diagnostic, DirectoryStructureHost, - DirectoryWatcherCallback, DocumentPositionMapper, DocumentRegistry, enumerateInsertsAndDeletes, every, - explainFiles, ExportInfoMap, Extension, fileExtensionIs, FileReference, FileWatcher, FileWatcherCallback, - FileWatcherEventKind, filter, firstDefined, flatMap, forEach, forEachEntry, forEachKey, generateDjb2Hash, - getAllowJSCompilerOption, getAutomaticTypeDirectiveNames, GetCanonicalFileName, - getDeclarationEmitOutputFilePathWorker, getDefaultCompilerOptions, getDefaultLibFileName, getDefaultLibFilePath, - getDirectoryPath, getEffectiveTypeRoots, getEmitDeclarations, getEntrypointsFromPackageJsonInfo, - getNormalizedAbsolutePath, getOrUpdate, getStringComparer, HasInvalidatedResolutions, HostCancellationToken, - inferredTypesContainingFile, InstallPackageOptions, IScriptSnapshot, isDeclarationFileName, - isExternalModuleNameRelative, isInsideNodeModules, JsTyping, LanguageService, LanguageServiceHost, - LanguageServiceMode, map, mapDefined, maybeBind, ModuleResolutionCache, ModuleResolutionHost, - ModuleResolutionInfo, noop, noopFileWatcher, normalizePath, normalizeSlashes, orderedRemoveItem, outFile, - PackageJsonAutoImportPreference, PackageJsonInfo, ParsedCommandLine, parsePackageName, Path, perfLogger, - PerformanceEvent, PluginImport, PollingInterval, Program, ProjectPackageJsonInfo, ProjectReference, - removeFileExtension, ResolutionCache, resolutionExtensionIsTSOrJson, ResolutionMode, ResolvedModuleFull, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirective, - resolvePackageNameToPackageJson, returnFalse, returnTrue, ScriptKind, some, sort, sortAndDeduplicate, - SortedReadonlyArray, SourceFile, SourceMapper, startsWith, stripQuotes, StructureIsReused, SymlinkCache, - ThrottledCancellationToken, timestamp, toPath, tracing, TypeAcquisition, TypeReferenceDirectiveResolutionInfo, updateErrorForNoInputFiles, - updateMissingFilePathsWatch, WatchDirectoryFlags, WatchOptions, WatchType, + ApplyCodeActionCommandResult, + BuilderState, + CachedDirectoryStructureHost, + CompilerHost, + CompilerOptions, + ConfigFileProgramReloadLevel, + Debug, + Diagnostic, + DirectoryStructureHost, + DirectoryWatcherCallback, + DocumentPositionMapper, + DocumentRegistry, + ExportInfoMap, + Extension, + FileReference, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + GetCanonicalFileName, + HasInvalidatedResolutions, + HostCancellationToken, + IScriptSnapshot, + InstallPackageOptions, + JsTyping, + LanguageService, + LanguageServiceHost, + LanguageServiceMode, + ModuleResolutionCache, + ModuleResolutionHost, + ModuleResolutionInfo, + PackageJsonAutoImportPreference, + PackageJsonInfo, + ParsedCommandLine, + Path, + PerformanceEvent, + PluginImport, + PollingInterval, + Program, + ProjectPackageJsonInfo, + ProjectReference, + ResolutionCache, + ResolutionMode, + ResolvedModuleFull, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptKind, + SortedReadonlyArray, + SourceFile, + SourceMapper, + StructureIsReused, + SymlinkCache, + ThrottledCancellationToken, + TypeAcquisition, + TypeReferenceDirectiveResolutionInfo, + WatchDirectoryFlags, + WatchOptions, + WatchType, + addRange, + append, + arrayFrom, + arrayToMap, + changesAffectModuleResolution, + clearMap, + cloneCompilerOptions, + closeFileWatcher, + closeFileWatcherOf, + combinePaths, + concatenate, + createCacheableExportInfoMap, + createLanguageService, + createResolutionCache, + createSymlinkCache, + enumerateInsertsAndDeletes, + every, + explainFiles, + fileExtensionIs, + filter, + firstDefined, + flatMap, + forEach, + forEachEntry, + forEachKey, + generateDjb2Hash, + getAllowJSCompilerOption, + getAutomaticTypeDirectiveNames, + getDeclarationEmitOutputFilePathWorker, + getDefaultCompilerOptions, + getDefaultLibFileName, + getDefaultLibFilePath, + getDirectoryPath, + getEffectiveTypeRoots, + getEmitDeclarations, + getEntrypointsFromPackageJsonInfo, + getNormalizedAbsolutePath, + getOrUpdate, + getStringComparer, + inferredTypesContainingFile, + isDeclarationFileName, + isExternalModuleNameRelative, + isInsideNodeModules, + map, + mapDefined, + maybeBind, + noop, + noopFileWatcher, + normalizePath, + normalizeSlashes, + orderedRemoveItem, + outFile, + parsePackageName, + perfLogger, + removeFileExtension, + resolutionExtensionIsTSOrJson, + resolvePackageNameToPackageJson, + returnFalse, + returnTrue, + some, + sort, + sortAndDeduplicate, + startsWith, + stripQuotes, + timestamp, + toPath, + tracing, + updateErrorForNoInputFiles, + updateMissingFilePathsWatch, } from "./_namespaces/ts"; export enum ProjectKind { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 6187031e040c2..5f22bb2338693 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1,8 +1,22 @@ import * as ts from "./_namespaces/ts"; import { - CompilerOptionsValue, EndOfLineState, FileExtensionInfo, HighlightSpanKind, MapLike, OutliningSpanKind, OutputFile, - PluginImport, ProjectReference, RenameLocation, ScriptElementKind, ScriptKind, TextChange, TextInsertion, - TodoComment, TodoCommentDescriptor, TypeAcquisition, + CompilerOptionsValue, + EndOfLineState, + FileExtensionInfo, + HighlightSpanKind, + MapLike, + OutliningSpanKind, + OutputFile, + PluginImport, + ProjectReference, + RenameLocation, + ScriptElementKind, + ScriptKind, + TextChange, + TextInsertion, + TodoComment, + TodoCommentDescriptor, + TypeAcquisition, } from "./_namespaces/ts"; /** diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 8afc7e25112a7..f21e316baacc2 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -1,15 +1,56 @@ import { - AbsolutePositionAndLineText, ConfiguredProject, Errors, ExternalProject, InferredProject, isConfiguredProject, - isExternalProject, isInferredProject, maxFileSize, NormalizedPath, Project, ProjectKind, protocol, - ScriptVersionCache, ServerHost, + AbsolutePositionAndLineText, + ConfiguredProject, + Errors, + ExternalProject, + InferredProject, + NormalizedPath, + Project, + ProjectKind, + ScriptVersionCache, + ServerHost, + isConfiguredProject, + isExternalProject, + isInferredProject, + maxFileSize, + protocol, } from "./_namespaces/ts.server"; import { - assign, clear, closeFileWatcherOf, computeLineAndCharacterOfPosition, computeLineStarts, - computePositionOfLineAndCharacter, contains, createTextSpanFromBounds, Debug, directorySeparator, - DocumentPositionMapper, DocumentRegistryBucketKeyWithMode, emptyOptions, FileWatcher, FileWatcherEventKind, forEach, - FormatCodeSettings, getBaseFileName, getDefaultFormatCodeSettings, getLineInfo, getScriptKindFromFileName, - getSnapshotText, hasTSFileExtension, IScriptSnapshot, isString, LineInfo, Path, ScriptKind, ScriptSnapshot, - some, SourceFile, SourceFileLike, stringContains, TextSpan, unorderedRemoveItem, + Debug, + DocumentPositionMapper, + DocumentRegistryBucketKeyWithMode, + FileWatcher, + FileWatcherEventKind, + FormatCodeSettings, + IScriptSnapshot, + LineInfo, + Path, + ScriptKind, + ScriptSnapshot, + SourceFile, + SourceFileLike, + TextSpan, + assign, + clear, + closeFileWatcherOf, + computeLineAndCharacterOfPosition, + computeLineStarts, + computePositionOfLineAndCharacter, + contains, + createTextSpanFromBounds, + directorySeparator, + emptyOptions, + forEach, + getBaseFileName, + getDefaultFormatCodeSettings, + getLineInfo, + getScriptKindFromFileName, + getSnapshotText, + hasTSFileExtension, + isString, + some, + stringContains, + unorderedRemoveItem, } from "./_namespaces/ts"; export interface ScriptInfoVersion { diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index fc828b3f8c5bb..d73d8508643af 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -1,8 +1,18 @@ import { - collapseTextChangeRangesAcrossMultipleVersions, computeLineStarts, createTextChangeRange, createTextSpan, Debug, - IScriptSnapshot, TextChangeRange, TextSpan, unchangedTextChangeRange, + Debug, + IScriptSnapshot, + TextChangeRange, + TextSpan, + collapseTextChangeRangesAcrossMultipleVersions, + computeLineStarts, + createTextChangeRange, + createTextSpan, + unchangedTextChangeRange, } from "./_namespaces/ts"; -import { emptyArray, protocol } from "./_namespaces/ts.server"; +import { + emptyArray, + protocol, +} from "./_namespaces/ts.server"; const lineCollectionCapacity = 4; diff --git a/src/server/session.ts b/src/server/session.ts index d646606f8d485..d3893f37495c0 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1,37 +1,183 @@ import { - arrayFrom, arrayIterator, arrayReverseIterator, CallHierarchyIncomingCall, CallHierarchyItem, - CallHierarchyOutgoingCall, cast, CodeAction, CodeActionCommand, CodeFixAction, CombinedCodeActions, CompilerOptions, - CompletionEntry, CompletionEntryData, CompletionEntryDetails, CompletionInfo, CompletionTriggerKind, - computeLineAndCharacterOfPosition, computeLineStarts, concatenate, createQueue, createSet, createTextSpan, - createTextSpanFromBounds, Debug, decodedTextSpanIntersectsWith, deduplicate, DefinitionInfo, - DefinitionInfoAndBoundSpan, Diagnostic, diagnosticCategoryName, DiagnosticRelatedInformation, displayPartsToString, - DocumentHighlights, DocumentPosition, DocumentSpan, documentSpansEqual, EmitOutput, equateValues, - FileTextChanges, filter, find, FindAllReferences, first, firstOrUndefined, flatMap, flatMapToMutable, - flattenDiagnosticMessageText, forEachNameInAccessChainWalkingLeft, FormatCodeSettings, formatting, - getDeclarationFromName, getDeclarationOfKind, getEmitDeclarations, getEntries, getEntrypointsFromPackageJsonInfo, - getLineAndCharacterOfPosition, getMappedContextSpan, getMappedDocumentSpan, getMappedLocation, - getNodeModulePathParts, getNormalizedAbsolutePath, getPackageNameFromTypesPackageName, getPackageScopeForPath, - getSnapshotText, getSupportedCodeFixes, getTemporaryModuleResolutionState, getTextOfIdentifierOrLiteral, - getTouchingPropertyName, GoToDefinition, HostCancellationToken, identity, ImplementationLocation, ImportSpecifier, - isAccessExpression, isArray, isDeclarationFileName, isIdentifier, isString, isStringLiteralLike, - JSDocLinkDisplayPart, JSDocTagInfo, LanguageServiceMode, LineAndCharacter, map, mapDefined, mapDefinedIterator, - mapIterator, mapOneOrMany, memoize, ModuleResolutionKind, MultiMap, NavigateToItem, NavigationBarItem, - NavigationTree, nodeModulesPathPart, normalizePath, OperationCanceledException, OrganizeImportsMode, outFile, - OutliningSpan, Path, perfLogger, PerformanceEvent, PossibleProgramFileInfo, Program, QuickInfo, RefactorEditInfo, - ReferencedSymbol, ReferencedSymbolDefinitionInfo, ReferencedSymbolEntry, ReferenceEntry, removeFileExtension, - RenameInfo, RenameLocation, ScriptKind, SelectionRange, SemanticClassificationFormat, SignatureHelpItem, - SignatureHelpItems, singleIterator, some, SourceFile, startsWith, stringContains, SymbolDisplayPart, SyntaxKind, - TextChange, TextInsertion, TextRange, TextSpan, textSpanEnd, toArray, toFileNameLowerCase, tracing, - unmangleScopedPackageName, UserPreferences, version, WithMetadata, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + CodeAction, + CodeActionCommand, + CodeFixAction, + CombinedCodeActions, + CompilerOptions, + CompletionEntry, + CompletionEntryData, + CompletionEntryDetails, + CompletionInfo, + CompletionTriggerKind, + Debug, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + Diagnostic, + DiagnosticRelatedInformation, + DocumentHighlights, + DocumentPosition, + DocumentSpan, + EmitOutput, + FileTextChanges, + FindAllReferences, + FormatCodeSettings, + GoToDefinition, + HostCancellationToken, + ImplementationLocation, + ImportSpecifier, + JSDocLinkDisplayPart, + JSDocTagInfo, + LanguageServiceMode, + LineAndCharacter, + ModuleResolutionKind, + MultiMap, + NavigateToItem, + NavigationBarItem, + NavigationTree, + OperationCanceledException, + OrganizeImportsMode, + OutliningSpan, + Path, + PerformanceEvent, + PossibleProgramFileInfo, + Program, + QuickInfo, + RefactorEditInfo, + ReferenceEntry, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + RenameInfo, + RenameLocation, + ScriptKind, + SelectionRange, + SemanticClassificationFormat, + SignatureHelpItem, + SignatureHelpItems, + SourceFile, + SymbolDisplayPart, + SyntaxKind, + TextChange, + TextInsertion, + TextRange, + TextSpan, + UserPreferences, + WithMetadata, + arrayFrom, + arrayIterator, + arrayReverseIterator, + cast, + computeLineAndCharacterOfPosition, + computeLineStarts, + concatenate, + createQueue, + createSet, + createTextSpan, + createTextSpanFromBounds, + decodedTextSpanIntersectsWith, + deduplicate, + diagnosticCategoryName, + displayPartsToString, + documentSpansEqual, + equateValues, + filter, + find, + first, + firstOrUndefined, + flatMap, + flatMapToMutable, + flattenDiagnosticMessageText, + forEachNameInAccessChainWalkingLeft, + formatting, + getDeclarationFromName, + getDeclarationOfKind, + getEmitDeclarations, + getEntries, + getEntrypointsFromPackageJsonInfo, + getLineAndCharacterOfPosition, + getMappedContextSpan, + getMappedDocumentSpan, + getMappedLocation, + getNodeModulePathParts, + getNormalizedAbsolutePath, + getPackageNameFromTypesPackageName, + getPackageScopeForPath, + getSnapshotText, + getSupportedCodeFixes, + getTemporaryModuleResolutionState, + getTextOfIdentifierOrLiteral, + getTouchingPropertyName, + identity, + isAccessExpression, + isArray, + isDeclarationFileName, + isIdentifier, + isString, + isStringLiteralLike, + map, + mapDefined, + mapDefinedIterator, + mapIterator, + mapOneOrMany, + memoize, + nodeModulesPathPart, + normalizePath, + outFile, + perfLogger, + removeFileExtension, + singleIterator, + some, + startsWith, + stringContains, + textSpanEnd, + toArray, + toFileNameLowerCase, + tracing, + unmangleScopedPackageName, + version, } from "./_namespaces/ts"; import { - ConfigFileDiagEvent, ConfiguredProject, convertFormatOptions, convertScriptKindName, convertUserPreferences, - EmitResult, emptyArray, Errors, GcTimer, indent, isConfigFile, isConfiguredProject, isExternalProject, - isInferredProject, ITypingsInstaller, LargeFileReferencedEvent, Logger, LogLevel, Msg, NormalizedPath, Project, - ProjectInfoTelemetryEvent, ProjectKind, ProjectLanguageServiceStateEvent, ProjectLoadingFinishEvent, - ProjectLoadingStartEvent, ProjectService, ProjectServiceEvent, ProjectServiceEventHandler, ProjectServiceOptions, - ProjectsUpdatedInBackgroundEvent, protocol, ScriptInfo, ScriptInfoOrConfig, ServerHost, stringifyIndented, - toNormalizedPath, updateProjectIfDirty, + ConfigFileDiagEvent, + ConfiguredProject, + EmitResult, + Errors, + GcTimer, + ITypingsInstaller, + LargeFileReferencedEvent, + LogLevel, + Logger, + Msg, + NormalizedPath, + Project, + ProjectInfoTelemetryEvent, + ProjectKind, + ProjectLanguageServiceStateEvent, + ProjectLoadingFinishEvent, + ProjectLoadingStartEvent, + ProjectService, + ProjectServiceEvent, + ProjectServiceEventHandler, + ProjectServiceOptions, + ProjectsUpdatedInBackgroundEvent, + ScriptInfo, + ScriptInfoOrConfig, + ServerHost, + convertFormatOptions, + convertScriptKindName, + convertUserPreferences, + emptyArray, + indent, + isConfigFile, + isConfiguredProject, + isExternalProject, + isInferredProject, + protocol, + stringifyIndented, + toNormalizedPath, + updateProjectIfDirty, } from "./_namespaces/ts.server"; interface StackTraceError extends Error { diff --git a/src/server/types.ts b/src/server/types.ts index 3ebc7655948a5..8e1c38f9a42a3 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -1,4 +1,10 @@ -import { DirectoryWatcherCallback, FileWatcher, FileWatcherCallback, System, WatchOptions } from "./_namespaces/ts"; +import { + DirectoryWatcherCallback, + FileWatcher, + FileWatcherCallback, + System, + WatchOptions, +} from "./_namespaces/ts"; export interface CompressedData { length: number; diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index 60dc13cbded09..65c707bb929ef 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -1,8 +1,22 @@ import { - ApplyCodeActionCommandResult, arrayIsEqualTo, CompilerOptions, getAllowJSCompilerOption, InstallPackageOptions, - noop, notImplemented, Path, returnFalse, sort, SortedReadonlyArray, TypeAcquisition, + ApplyCodeActionCommandResult, + CompilerOptions, + InstallPackageOptions, + Path, + SortedReadonlyArray, + TypeAcquisition, + arrayIsEqualTo, + getAllowJSCompilerOption, + noop, + notImplemented, + returnFalse, + sort, } from "./_namespaces/ts"; -import { emptyArray, Project, ProjectService } from "./_namespaces/ts.server"; +import { + Project, + ProjectService, + emptyArray, +} from "./_namespaces/ts.server"; export interface InstallPackageOptionsWithProject extends InstallPackageOptions { projectName: string; diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 989209b2f1c3e..2ba220593a309 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,5 +1,17 @@ -import { binarySearch, Comparer, getBaseFileName, identity, perfLogger, SortedArray } from "./_namespaces/ts"; -import { Logger, LogLevel, NormalizedPath, ServerHost } from "./_namespaces/ts.server"; +import { + Comparer, + SortedArray, + binarySearch, + getBaseFileName, + identity, + perfLogger, +} from "./_namespaces/ts"; +import { + LogLevel, + Logger, + NormalizedPath, + ServerHost, +} from "./_namespaces/ts.server"; /** @internal */ export class ThrottledOperations { diff --git a/src/server/utilitiesPublic.ts b/src/server/utilitiesPublic.ts index a729e4c9f5e4a..e2621359f41b2 100644 --- a/src/server/utilitiesPublic.ts +++ b/src/server/utilitiesPublic.ts @@ -1,8 +1,16 @@ import { - getNormalizedAbsolutePath, isRootedDiskPath, normalizePath, Path, SortedArray, SortedReadonlyArray, + Path, + SortedArray, + SortedReadonlyArray, TypeAcquisition, + getNormalizedAbsolutePath, + isRootedDiskPath, + normalizePath, } from "./_namespaces/ts"; -import { DiscoverTypings, Project } from "./_namespaces/ts.server"; +import { + DiscoverTypings, + Project, +} from "./_namespaces/ts.server"; export enum LogLevel { terse, diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 5b823d698d651..cd08b00b51aaf 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,16 +1,75 @@ import { - ArrayLiteralExpression, BinaryExpression, BindingPattern, Block, BreakOrContinueStatement, canHaveDecorators, - CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, createTextSpanFromBounds, Debug, - DestructuringPattern, DoStatement, EnumDeclaration, ExportAssignment, ExportDeclaration, Expression, - ExpressionStatement, findLast, findNextToken, findPrecedingToken, forEach, ForInStatement, ForOfStatement, - ForStatement, FunctionLikeDeclaration, getModuleInstanceState, getTokenAtPosition, HasDecorators, - hasOnlyExpressionInitializer, hasSyntacticModifier, IfStatement, ImportDeclaration, ImportEqualsDeclaration, - isArrayLiteralOrObjectLiteralDestructuringPattern, isAssignmentOperator, isBindingPattern, isDecorator, - isExpressionNode, isFunctionBlock, isFunctionLike, isVariableDeclarationList, LabeledStatement, lastOrUndefined, - ModifierFlags, ModuleDeclaration, ModuleInstanceState, Node, NodeArray, NodeFlags, ObjectLiteralElement, - ObjectLiteralExpression, ParameterDeclaration, PropertyAssignment, PropertyDeclaration, PropertySignature, - ReturnStatement, skipTrivia, SourceFile, SwitchStatement, SyntaxKind, TextSpan, ThrowStatement, TryStatement, - TypeAssertion, VariableDeclaration, VariableDeclarationList, VariableStatement, WhileStatement, WithStatement, + ArrayLiteralExpression, + BinaryExpression, + BindingPattern, + Block, + BreakOrContinueStatement, + CaseBlock, + CaseOrDefaultClause, + CatchClause, + ClassDeclaration, + Debug, + DestructuringPattern, + DoStatement, + EnumDeclaration, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + ForInStatement, + ForOfStatement, + ForStatement, + FunctionLikeDeclaration, + HasDecorators, + IfStatement, + ImportDeclaration, + ImportEqualsDeclaration, + LabeledStatement, + ModifierFlags, + ModuleDeclaration, + ModuleInstanceState, + Node, + NodeArray, + NodeFlags, + ObjectLiteralElement, + ObjectLiteralExpression, + ParameterDeclaration, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + ReturnStatement, + SourceFile, + SwitchStatement, + SyntaxKind, + TextSpan, + ThrowStatement, + TryStatement, + TypeAssertion, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + WhileStatement, + WithStatement, + canHaveDecorators, + createTextSpanFromBounds, + findLast, + findNextToken, + findPrecedingToken, + forEach, + getModuleInstanceState, + getTokenAtPosition, + hasOnlyExpressionInitializer, + hasSyntacticModifier, + isArrayLiteralOrObjectLiteralDestructuringPattern, + isAssignmentOperator, + isBindingPattern, + isDecorator, + isExpressionNode, + isFunctionBlock, + isFunctionLike, + isVariableDeclarationList, + lastOrUndefined, + skipTrivia, } from "./_namespaces/ts"; /** diff --git a/src/services/callHierarchy.ts b/src/services/callHierarchy.ts index 941cb68946a37..4784490883c2b 100644 --- a/src/services/callHierarchy.ts +++ b/src/services/callHierarchy.ts @@ -1,23 +1,109 @@ import { - AccessExpression, append, ArrowFunction, AsExpression, CallExpression, CallHierarchyIncomingCall, CallHierarchyItem, - CallHierarchyOutgoingCall, CancellationToken, canHaveModifiers, ClassDeclaration, ClassExpression, - ClassLikeDeclaration, ClassStaticBlockDeclaration, compareStringsCaseSensitive, createPrinter, - createTextRangeFromNode, createTextSpanFromBounds, createTextSpanFromRange, Debug, Decorator, - ElementAccessExpression, EmitHint, filter, find, FindAllReferences, findAncestor, forEach, forEachChild, - FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, getAssignedName, - getClassExtendsHeritageElement, getCombinedNodeFlags, getFirstConstructorWithBody, getNameOfDeclaration, getNodeId, - getNodeKind, getNodeModifiers, group, hasSyntacticModifier, Identifier, idText, indicesOf, isAccessExpression, - isArgumentExpressionOfElementAccess, isArray, isArrowFunction, isCallOrNewExpressionTarget, isClassDeclaration, - isClassExpression, isClassLike, isClassStaticBlockDeclaration, isComputedPropertyName, isConstructorDeclaration, - isDeclarationName, isDecoratorTarget, isFunctionDeclaration, isFunctionExpression, isFunctionLikeDeclaration, - isGetAccessorDeclaration, isIdentifier, isJsxOpeningLikeElement, isJsxOpeningLikeElementTagName, - isMethodDeclaration, isMethodSignature, isModuleBlock, isModuleDeclaration, isNamedDeclaration, isPartOfTypeNode, - isPropertyDeclaration, isRightSideOfPropertyAccess, isSetAccessorDeclaration, isSourceFile, - isStringOrNumericLiteralLike, isTaggedTemplateExpression, isTaggedTemplateTag, isVariableDeclaration, - JsxOpeningLikeElement, map, MethodDeclaration, ModifierFlags, ModuleDeclaration, moveRangePastModifiers, - NewExpression, Node, NodeFlags, ParameterDeclaration, Program, PropertyAccessExpression, SatisfiesExpression, - SetAccessorDeclaration, skipTrivia, SourceFile, SymbolFlags, SyntaxKind, TaggedTemplateExpression, TextRange, - TextSpan, TypeAssertion, TypeChecker, usingSingleLineStringWriter, VariableDeclaration, + AccessExpression, + ArrowFunction, + AsExpression, + CallExpression, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + CancellationToken, + ClassDeclaration, + ClassExpression, + ClassLikeDeclaration, + ClassStaticBlockDeclaration, + Debug, + Decorator, + ElementAccessExpression, + EmitHint, + FindAllReferences, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + Identifier, + JsxOpeningLikeElement, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + NewExpression, + Node, + NodeFlags, + ParameterDeclaration, + Program, + PropertyAccessExpression, + SatisfiesExpression, + SetAccessorDeclaration, + SourceFile, + SymbolFlags, + SyntaxKind, + TaggedTemplateExpression, + TextRange, + TextSpan, + TypeAssertion, + TypeChecker, + VariableDeclaration, + append, + canHaveModifiers, + compareStringsCaseSensitive, + createPrinter, + createTextRangeFromNode, + createTextSpanFromBounds, + createTextSpanFromRange, + filter, + find, + findAncestor, + forEach, + forEachChild, + getAssignedName, + getClassExtendsHeritageElement, + getCombinedNodeFlags, + getFirstConstructorWithBody, + getNameOfDeclaration, + getNodeId, + getNodeKind, + getNodeModifiers, + group, + hasSyntacticModifier, + idText, + indicesOf, + isAccessExpression, + isArgumentExpressionOfElementAccess, + isArray, + isArrowFunction, + isCallOrNewExpressionTarget, + isClassDeclaration, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isComputedPropertyName, + isConstructorDeclaration, + isDeclarationName, + isDecoratorTarget, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLikeDeclaration, + isGetAccessorDeclaration, + isIdentifier, + isJsxOpeningLikeElement, + isJsxOpeningLikeElementTagName, + isMethodDeclaration, + isMethodSignature, + isModuleBlock, + isModuleDeclaration, + isNamedDeclaration, + isPartOfTypeNode, + isPropertyDeclaration, + isRightSideOfPropertyAccess, + isSetAccessorDeclaration, + isSourceFile, + isStringOrNumericLiteralLike, + isTaggedTemplateExpression, + isTaggedTemplateTag, + isVariableDeclaration, + map, + moveRangePastModifiers, + skipTrivia, + usingSingleLineStringWriter, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/classifier.ts b/src/services/classifier.ts index eda88ef10b195..cd62000d549b8 100644 --- a/src/services/classifier.ts +++ b/src/services/classifier.ts @@ -1,16 +1,80 @@ import { - __String, arrayToNumericMap, CancellationToken, CharacterCodes, ClassDeclaration, ClassificationInfo, - ClassificationResult, Classifications, ClassificationType, ClassificationTypeNames, ClassifiedSpan, Classifier, - commentPragmas, couldStartTrivia, createScanner, createTextSpan, Debug, decodedTextSpanIntersectsWith, - EndOfLineState, EnumDeclaration, getMeaningFromLocation, getModuleInstanceState, getTypeArgumentOrTypeParameterList, - HasJSDoc, InterfaceDeclaration, isAccessibilityModifier, isConstTypeReference, isIdentifier, isJSDoc, isKeyword, - isLineBreak, isModuleDeclaration, isPunctuation, isTemplateLiteralKind, isThisIdentifier, isToken, isTrivia, JSDoc, - JSDocAugmentsTag, JSDocCallbackTag, JSDocEnumTag, JSDocImplementsTag, JSDocParameterTag, JSDocPropertyTag, - JSDocReturnTag, JSDocSeeTag, JSDocTemplateTag, JSDocThisTag, JSDocTypedefTag, JSDocTypeTag, JsxAttribute, - JsxClosingElement, JsxOpeningElement, JsxSelfClosingElement, lastOrUndefined, ModuleDeclaration, - ModuleInstanceState, Node, nodeIsMissing, ParameterDeclaration, parseIsolatedJSDocComment, Push, - Scanner, ScriptTarget, SemanticMeaning, setParent, some, SourceFile, Symbol, SymbolFlags, SyntaxKind, TextSpan, - textSpanIntersectsWith, TokenClass, TypeChecker, TypeParameterDeclaration, + CancellationToken, + CharacterCodes, + ClassDeclaration, + ClassificationInfo, + ClassificationResult, + ClassificationType, + ClassificationTypeNames, + Classifications, + ClassifiedSpan, + Classifier, + Debug, + EndOfLineState, + EnumDeclaration, + HasJSDoc, + InterfaceDeclaration, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocEnumTag, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocSeeTag, + JSDocTemplateTag, + JSDocThisTag, + JSDocTypeTag, + JSDocTypedefTag, + JsxAttribute, + JsxClosingElement, + JsxOpeningElement, + JsxSelfClosingElement, + ModuleDeclaration, + ModuleInstanceState, + Node, + ParameterDeclaration, + Push, + Scanner, + ScriptTarget, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TextSpan, + TokenClass, + TypeChecker, + TypeParameterDeclaration, + __String, + arrayToNumericMap, + commentPragmas, + couldStartTrivia, + createScanner, + createTextSpan, + decodedTextSpanIntersectsWith, + getMeaningFromLocation, + getModuleInstanceState, + getTypeArgumentOrTypeParameterList, + isAccessibilityModifier, + isConstTypeReference, + isIdentifier, + isJSDoc, + isKeyword, + isLineBreak, + isModuleDeclaration, + isPunctuation, + isTemplateLiteralKind, + isThisIdentifier, + isToken, + isTrivia, + lastOrUndefined, + nodeIsMissing, + parseIsolatedJSDocComment, + setParent, + some, + textSpanIntersectsWith, } from "./_namespaces/ts"; /** The classifier is used for syntactic highlighting in editors via the TSServer */ diff --git a/src/services/classifier2020.ts b/src/services/classifier2020.ts index db67ea1d8d7b0..a2b505591249f 100644 --- a/src/services/classifier2020.ts +++ b/src/services/classifier2020.ts @@ -1,11 +1,48 @@ import { - BindingElement, CancellationToken, Classifications, ClassifiedSpan2020, createTextSpan, Debug, Declaration, - EndOfLineState, forEachChild, getCombinedModifierFlags, getCombinedNodeFlags, getMeaningFromLocation, - isBindingElement, isCallExpression, isCatchClause, isFunctionDeclaration, isIdentifier, isImportClause, - isImportSpecifier, isInfinityOrNaNString, isJsxElement, isJsxExpression, isJsxSelfClosingElement, isNamespaceImport, - isPropertyAccessExpression, isQualifiedName, isSourceFile, isVariableDeclaration, ModifierFlags, - NamedDeclaration, Node, NodeFlags, ParameterDeclaration, Program, SemanticMeaning, SourceFile, Symbol, SymbolFlags, - SyntaxKind, TextSpan, textSpanIntersectsWith, Type, TypeChecker, VariableDeclaration, + BindingElement, + CancellationToken, + Classifications, + ClassifiedSpan2020, + Debug, + Declaration, + EndOfLineState, + ModifierFlags, + NamedDeclaration, + Node, + NodeFlags, + ParameterDeclaration, + Program, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TextSpan, + Type, + TypeChecker, + VariableDeclaration, + createTextSpan, + forEachChild, + getCombinedModifierFlags, + getCombinedNodeFlags, + getMeaningFromLocation, + isBindingElement, + isCallExpression, + isCatchClause, + isFunctionDeclaration, + isIdentifier, + isImportClause, + isImportSpecifier, + isInfinityOrNaNString, + isJsxElement, + isJsxExpression, + isJsxSelfClosingElement, + isNamespaceImport, + isPropertyAccessExpression, + isQualifiedName, + isSourceFile, + isVariableDeclaration, + textSpanIntersectsWith, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/codeFixProvider.ts b/src/services/codeFixProvider.ts index 19d7d00e9d086..7c37ddee959d8 100644 --- a/src/services/codeFixProvider.ts +++ b/src/services/codeFixProvider.ts @@ -1,8 +1,28 @@ import { - arrayFrom, cast, CodeActionCommand, CodeFixAction, CodeFixAllContext, CodeFixContext, CodeFixContextBase, - CodeFixRegistration, CombinedCodeActions, computeSuggestionDiagnostics, contains, createMultiMap, Debug, Diagnostic, - DiagnosticAndArguments, diagnosticToString, DiagnosticWithLocation, FileTextChanges, flatMap, isString, map, - Push, TextChange, textChanges, + CodeActionCommand, + CodeFixAction, + CodeFixAllContext, + CodeFixContext, + CodeFixContextBase, + CodeFixRegistration, + CombinedCodeActions, + Debug, + Diagnostic, + DiagnosticAndArguments, + DiagnosticWithLocation, + FileTextChanges, + Push, + TextChange, + arrayFrom, + cast, + computeSuggestionDiagnostics, + contains, + createMultiMap, + diagnosticToString, + flatMap, + isString, + map, + textChanges, } from "./_namespaces/ts"; const errorCodeToFixes = createMultiMap(); diff --git a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts index 8d7347f4416c6..2702dd72cab0a 100644 --- a/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts +++ b/src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts @@ -1,8 +1,22 @@ import { - AsExpression, Diagnostics, factory, findAncestor, getTokenAtPosition, isAsExpression, isInJSFile, - isTypeAssertionExpression, SourceFile, SyntaxKind, textChanges, TypeAssertion, + AsExpression, + Diagnostics, + SourceFile, + SyntaxKind, + TypeAssertion, + factory, + findAncestor, + getTokenAtPosition, + isAsExpression, + isInJSFile, + isTypeAssertionExpression, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addConvertToUnknownForNonOverlappingTypes"; const errorCodes = [Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code]; diff --git a/src/services/codefixes/addEmptyExportDeclaration.ts b/src/services/codefixes/addEmptyExportDeclaration.ts index 0cd3d24a46259..25727bf73a384 100644 --- a/src/services/codefixes/addEmptyExportDeclaration.ts +++ b/src/services/codefixes/addEmptyExportDeclaration.ts @@ -1,5 +1,12 @@ -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; -import { Diagnostics, factory, textChanges } from "../_namespaces/ts"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; +import { + Diagnostics, + factory, + textChanges, +} from "../_namespaces/ts"; registerCodeFix({ errorCodes: [ diff --git a/src/services/codefixes/addMissingAsync.ts b/src/services/codefixes/addMissingAsync.ts index fd27e2b9f4310..909e2b68c0d57 100644 --- a/src/services/codefixes/addMissingAsync.ts +++ b/src/services/codefixes/addMissingAsync.ts @@ -1,11 +1,39 @@ import { - ArrowFunction, CodeFixAllContext, CodeFixContext, createTextSpanFromNode, Diagnostic, Diagnostics, factory, - FileTextChanges, find, findAncestor, FunctionDeclaration, FunctionExpression, getNodeId, getSyntacticModifierFlags, - getSynthesizedDeepClone, getTokenAtPosition, isArrowFunction, isFunctionDeclaration, isFunctionExpression, - isMethodDeclaration, isNumber, MethodDeclaration, ModifierFlags, some, SourceFile, textChanges, TextSpan, - textSpanEnd, textSpansEqual, + ArrowFunction, + CodeFixAllContext, + CodeFixContext, + Diagnostic, + Diagnostics, + FileTextChanges, + FunctionDeclaration, + FunctionExpression, + MethodDeclaration, + ModifierFlags, + SourceFile, + TextSpan, + createTextSpanFromNode, + factory, + find, + findAncestor, + getNodeId, + getSyntacticModifierFlags, + getSynthesizedDeepClone, + getTokenAtPosition, + isArrowFunction, + isFunctionDeclaration, + isFunctionExpression, + isMethodDeclaration, + isNumber, + some, + textChanges, + textSpanEnd, + textSpansEqual, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; type ContextualTrackChangesFunction = (cb: (changeTracker: textChanges.ChangeTracker) => void) => FileTextChanges[]; const fixId = "addMissingAsync"; diff --git a/src/services/codefixes/addMissingAwait.ts b/src/services/codefixes/addMissingAwait.ts index 5a2ec06f7aa55..a71854c682daa 100644 --- a/src/services/codefixes/addMissingAwait.ts +++ b/src/services/codefixes/addMissingAwait.ts @@ -1,13 +1,55 @@ import { - CancellationToken, CodeFixAllContext, CodeFixContext, compact, contains, Diagnostic, Diagnostics, Expression, - factory, FileTextChanges, find, FindAllReferences, findAncestor, findPrecedingToken, forEach, getAncestor, - getFixableErrorSpanExpression, getSymbolId, hasSyntacticModifier, Identifier, isArrowFunction, isBinaryExpression, - isBlock, isCallOrNewExpression, isForOfStatement, isIdentifier, isNumber, isPropertyAccessExpression, - isVariableDeclaration, ModifierFlags, Node, NodeFlags, positionIsASICandidate, Program, some, SourceFile, - Symbol, SyntaxKind, textChanges, TextSpan, textSpansEqual, tryAddToSet, tryCast, TypeChecker, TypeFlags, + CancellationToken, + CodeFixAllContext, + CodeFixContext, + Diagnostic, + Diagnostics, + Expression, + FileTextChanges, + FindAllReferences, + Identifier, + ModifierFlags, + Node, + NodeFlags, + Program, + SourceFile, + Symbol, + SyntaxKind, + TextSpan, + TypeChecker, + TypeFlags, + compact, + contains, + factory, + find, + findAncestor, + findPrecedingToken, + forEach, + getAncestor, + getFixableErrorSpanExpression, + getSymbolId, + hasSyntacticModifier, + isArrowFunction, + isBinaryExpression, + isBlock, + isCallOrNewExpression, + isForOfStatement, + isIdentifier, + isNumber, + isPropertyAccessExpression, + isVariableDeclaration, + positionIsASICandidate, + some, + textChanges, + textSpansEqual, + tryAddToSet, + tryCast, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createCodeFixActionWithoutFixAll, registerCodeFix, + codeFixAll, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + registerCodeFix, } from "../_namespaces/ts.codefix"; type ContextualTrackChangesFunction = (cb: (changeTracker: textChanges.ChangeTracker) => void) => FileTextChanges[]; diff --git a/src/services/codefixes/addMissingConst.ts b/src/services/codefixes/addMissingConst.ts index 0bd44f7974679..bc443c21eb34c 100644 --- a/src/services/codefixes/addMissingConst.ts +++ b/src/services/codefixes/addMissingConst.ts @@ -1,9 +1,28 @@ import { - Diagnostics, every, Expression, findAncestor, getTokenAtPosition, isArrayLiteralExpression, isAssignmentExpression, - isBinaryExpression, isExpressionStatement, isForInOrOfStatement, isIdentifier, Node, Program, SourceFile, - SyntaxKind, textChanges, tryAddToSet, TypeChecker, + Diagnostics, + Expression, + Node, + Program, + SourceFile, + SyntaxKind, + TypeChecker, + every, + findAncestor, + getTokenAtPosition, + isArrayLiteralExpression, + isAssignmentExpression, + isBinaryExpression, + isExpressionStatement, + isForInOrOfStatement, + isIdentifier, + textChanges, + tryAddToSet, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingConst"; const errorCodes = [ diff --git a/src/services/codefixes/addMissingDeclareProperty.ts b/src/services/codefixes/addMissingDeclareProperty.ts index 9b5732e249515..1b73fc93980bd 100644 --- a/src/services/codefixes/addMissingDeclareProperty.ts +++ b/src/services/codefixes/addMissingDeclareProperty.ts @@ -1,7 +1,18 @@ import { - Diagnostics, getTokenAtPosition, isIdentifier, Node, SourceFile, SyntaxKind, textChanges, tryAddToSet, + Diagnostics, + Node, + SourceFile, + SyntaxKind, + getTokenAtPosition, + isIdentifier, + textChanges, + tryAddToSet, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingDeclareProperty"; const errorCodes = [ diff --git a/src/services/codefixes/addMissingInvocationForDecorator.ts b/src/services/codefixes/addMissingInvocationForDecorator.ts index bfa4a2200d281..81f696963e11f 100644 --- a/src/services/codefixes/addMissingInvocationForDecorator.ts +++ b/src/services/codefixes/addMissingInvocationForDecorator.ts @@ -1,7 +1,18 @@ import { - Debug, Diagnostics, factory, findAncestor, getTokenAtPosition, isDecorator, SourceFile, textChanges, + Debug, + Diagnostics, + SourceFile, + factory, + findAncestor, + getTokenAtPosition, + isDecorator, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingInvocationForDecorator"; const errorCodes = [Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code]; diff --git a/src/services/codefixes/addNameToNamelessParameter.ts b/src/services/codefixes/addNameToNamelessParameter.ts index cea54d4c6687c..afb0cbca3f5a1 100644 --- a/src/services/codefixes/addNameToNamelessParameter.ts +++ b/src/services/codefixes/addNameToNamelessParameter.ts @@ -1,7 +1,18 @@ import { - Debug, Diagnostics, factory, getTokenAtPosition, Identifier, isParameter, SourceFile, textChanges, + Debug, + Diagnostics, + Identifier, + SourceFile, + factory, + getTokenAtPosition, + isParameter, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addNameToNamelessParameter"; const errorCodes = [Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code]; diff --git a/src/services/codefixes/addOptionalPropertyUndefined.ts b/src/services/codefixes/addOptionalPropertyUndefined.ts index cae2801386cc8..13445ee79cf99 100644 --- a/src/services/codefixes/addOptionalPropertyUndefined.ts +++ b/src/services/codefixes/addOptionalPropertyUndefined.ts @@ -1,11 +1,36 @@ import { - Diagnostics, emptyArray, factory, getFixableErrorSpanExpression, getSourceFileOfNode, Identifier, - isBinaryExpression, isCallExpression, isExpression, isFunctionLikeKind, isIdentifier, isPropertyAccessExpression, - isPropertyAssignment, isPropertyDeclaration, isPropertySignature, isShorthandPropertyAssignment, - isVariableDeclaration, Node, PropertyAccessExpression, SignatureDeclaration, SourceFile, Symbol, SyntaxKind, - textChanges, TextSpan, TypeChecker, UnionTypeNode, + Diagnostics, + Identifier, + Node, + PropertyAccessExpression, + SignatureDeclaration, + SourceFile, + Symbol, + SyntaxKind, + TextSpan, + TypeChecker, + UnionTypeNode, + emptyArray, + factory, + getFixableErrorSpanExpression, + getSourceFileOfNode, + isBinaryExpression, + isCallExpression, + isExpression, + isFunctionLikeKind, + isIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isPropertySignature, + isShorthandPropertyAssignment, + isVariableDeclaration, + textChanges, } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const addOptionalPropertyUndefined = "addOptionalPropertyUndefined"; diff --git a/src/services/codefixes/annotateWithTypeFromJSDoc.ts b/src/services/codefixes/annotateWithTypeFromJSDoc.ts index 2f65561216fe2..847dfd53fbec1 100644 --- a/src/services/codefixes/annotateWithTypeFromJSDoc.ts +++ b/src/services/codefixes/annotateWithTypeFromJSDoc.ts @@ -1,13 +1,52 @@ import { - Debug, Diagnostics, EmitFlags, emptyArray, factory, findChildOfKind, first, FunctionLikeDeclaration, - getJSDocReturnType, getJSDocType, getJSDocTypeParameterDeclarations, getTokenAtPosition, isArrowFunction, - isFunctionLikeDeclaration, isIdentifier, isJSDocIndexSignature, isOptionalJSDocPropertyLikeTag, isParameter, - JSDocFunctionType, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocTypeLiteral, JSDocVariadicType, - last, map, Node, nullTransformationContext, ParameterDeclaration, PropertyDeclaration, PropertySignature, - setEmitFlags, SourceFile, SyntaxKind, textChanges, tryCast, TypeNode, TypeReferenceNode, VariableDeclaration, - visitEachChild, visitNode, visitNodes, + Debug, + Diagnostics, + EmitFlags, + FunctionLikeDeclaration, + JSDocFunctionType, + JSDocNonNullableType, + JSDocNullableType, + JSDocOptionalType, + JSDocTypeLiteral, + JSDocVariadicType, + Node, + ParameterDeclaration, + PropertyDeclaration, + PropertySignature, + SourceFile, + SyntaxKind, + TypeNode, + TypeReferenceNode, + VariableDeclaration, + emptyArray, + factory, + findChildOfKind, + first, + getJSDocReturnType, + getJSDocType, + getJSDocTypeParameterDeclarations, + getTokenAtPosition, + isArrowFunction, + isFunctionLikeDeclaration, + isIdentifier, + isJSDocIndexSignature, + isOptionalJSDocPropertyLikeTag, + isParameter, + last, + map, + nullTransformationContext, + setEmitFlags, + textChanges, + tryCast, + visitEachChild, + visitNode, + visitNodes, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "annotateWithTypeFromJSDoc"; const errorCodes = [Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types.code]; diff --git a/src/services/codefixes/convertConstToLet.ts b/src/services/codefixes/convertConstToLet.ts index afdbee4662d3e..df499530c1a91 100644 --- a/src/services/codefixes/convertConstToLet.ts +++ b/src/services/codefixes/convertConstToLet.ts @@ -1,9 +1,24 @@ import { - addToSeen, Diagnostics, factory, findChildOfKind, getSymbolId, getTokenAtPosition, isVariableDeclarationList, - Program, SourceFile, Symbol, SyntaxKind, textChanges, Token, tryCast, + Diagnostics, + Program, + SourceFile, + Symbol, + SyntaxKind, + Token, + addToSeen, + factory, + findChildOfKind, + getSymbolId, + getTokenAtPosition, + isVariableDeclarationList, + textChanges, + tryCast, } from "../_namespaces/ts"; import { - createCodeFixActionMaybeFixAll, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixActionMaybeFixAll, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixId = "fixConvertConstToLet"; diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index ce585b6a1ca16..631d747404715 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -1,16 +1,71 @@ import { - __String, AccessExpression, ArrowFunction, BinaryExpression, Block, canHaveModifiers, ClassDeclaration, - ClassElement, CodeFixContext, CompilerOptions, concatenate, copyLeadingComments, Diagnostics, every, Expression, - factory, filter, forEach, FunctionDeclaration, FunctionExpression, getEmitScriptTarget, getNameOfDeclaration, - getQuotePreference, getTokenAtPosition, idText, isAccessExpression, isArrowFunction, isBinaryExpression, - isFunctionDeclaration, isFunctionExpression, isFunctionLike, isGetOrSetAccessorDeclaration, isIdentifier, - isIdentifierText, isMethodDeclaration, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectLiteralExpression, - isPropertyAccessExpression, isPropertyAssignment, isSourceFileJS, isStringLiteralLike, isVariableDeclaration, - isVariableDeclarationList, Modifier, Node, ObjectLiteralElementLike, ObjectLiteralExpression, - PropertyAccessExpression, PropertyName, QuotePreference, some, SourceFile, Symbol, SymbolFlags, symbolName, - SyntaxKind, textChanges, TypeChecker, UserPreferences, VariableDeclaration, + AccessExpression, + ArrowFunction, + BinaryExpression, + Block, + ClassDeclaration, + ClassElement, + CodeFixContext, + CompilerOptions, + Diagnostics, + Expression, + FunctionDeclaration, + FunctionExpression, + Modifier, + Node, + ObjectLiteralElementLike, + ObjectLiteralExpression, + PropertyAccessExpression, + PropertyName, + QuotePreference, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TypeChecker, + UserPreferences, + VariableDeclaration, + __String, + canHaveModifiers, + concatenate, + copyLeadingComments, + every, + factory, + filter, + forEach, + getEmitScriptTarget, + getNameOfDeclaration, + getQuotePreference, + getTokenAtPosition, + idText, + isAccessExpression, + isArrowFunction, + isBinaryExpression, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isGetOrSetAccessorDeclaration, + isIdentifier, + isIdentifierText, + isMethodDeclaration, + isNoSubstitutionTemplateLiteral, + isNumericLiteral, + isObjectLiteralExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isSourceFileJS, + isStringLiteralLike, + isVariableDeclaration, + isVariableDeclarationList, + some, + symbolName, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "convertFunctionToEs6Class"; const errorCodes = [Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration.code]; diff --git a/src/services/codefixes/convertLiteralTypeToMappedType.ts b/src/services/codefixes/convertLiteralTypeToMappedType.ts index 8cf9c9bc0716a..487277eba10fa 100644 --- a/src/services/codefixes/convertLiteralTypeToMappedType.ts +++ b/src/services/codefixes/convertLiteralTypeToMappedType.ts @@ -1,8 +1,21 @@ import { - cast, Diagnostics, factory, getTokenAtPosition, isIdentifier, isPropertySignature, isTypeLiteralNode, SourceFile, - textChanges, TypeLiteralNode, TypeNode, + Diagnostics, + SourceFile, + TypeLiteralNode, + TypeNode, + cast, + factory, + getTokenAtPosition, + isIdentifier, + isPropertySignature, + isTypeLiteralNode, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "convertLiteralTypeToMappedType"; const errorCodes = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code]; diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 1233782fb84f1..9417618ceaf08 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -1,18 +1,87 @@ import { - ArrowFunction, AwaitExpression, BindingName, BindingPattern, Block, CallExpression, canBeConvertedToAsync, - CodeFixContext, concatenate, createMultiMap, Debug, Diagnostics, elementAt, emptyArray, every, Expression, - factory, firstOrUndefined, flatMap, forEach, forEachChild, forEachReturnStatement, FunctionExpression, - FunctionLikeDeclaration, GeneratedIdentifierFlags, getContainingFunction, getNodeId, getObjectFlags, - getOriginalNode, getSymbolId, getSynthesizedDeepClone, getSynthesizedDeepCloneWithReplacements, getTokenAtPosition, - hasPropertyAccessExpressionWithName, Identifier, idText, isBindingElement, isBlock, isCallExpression, isExpression, - isFixablePromiseHandler, isFunctionLike, isFunctionLikeDeclaration, isGeneratedIdentifier, isIdentifier, isInJSFile, - isObjectBindingPattern, isOmittedExpression, isParameter, isPropertyAccessExpression, isReturnStatement, - isReturnStatementWithFixablePromiseHandler, isVariableDeclaration, lastOrUndefined, moveRangePastModifiers, - Node, NodeFlags, ObjectFlags, PropertyAccessExpression, returnsPromise, ReturnStatement, - returnTrue, Signature, SignatureKind, skipTrivia, SourceFile, Statement, Symbol, SyntaxKind, textChanges, - tryCast, TryStatement, Type, TypeChecker, TypeNode, TypeReference, UnionReduction, + ArrowFunction, + AwaitExpression, + BindingName, + BindingPattern, + Block, + CallExpression, + CodeFixContext, + Debug, + Diagnostics, + Expression, + FunctionExpression, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + Identifier, + Node, + NodeFlags, + ObjectFlags, + PropertyAccessExpression, + ReturnStatement, + Signature, + SignatureKind, + SourceFile, + Statement, + Symbol, + SyntaxKind, + TryStatement, + Type, + TypeChecker, + TypeNode, + TypeReference, + UnionReduction, + canBeConvertedToAsync, + concatenate, + createMultiMap, + elementAt, + emptyArray, + every, + factory, + firstOrUndefined, + flatMap, + forEach, + forEachChild, + forEachReturnStatement, + getContainingFunction, + getNodeId, + getObjectFlags, + getOriginalNode, + getSymbolId, + getSynthesizedDeepClone, + getSynthesizedDeepCloneWithReplacements, + getTokenAtPosition, + hasPropertyAccessExpressionWithName, + idText, + isBindingElement, + isBlock, + isCallExpression, + isExpression, + isFixablePromiseHandler, + isFunctionLike, + isFunctionLikeDeclaration, + isGeneratedIdentifier, + isIdentifier, + isInJSFile, + isObjectBindingPattern, + isOmittedExpression, + isParameter, + isPropertyAccessExpression, + isReturnStatement, + isReturnStatementWithFixablePromiseHandler, + isVariableDeclaration, + lastOrUndefined, + moveRangePastModifiers, + returnTrue, + returnsPromise, + skipTrivia, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "convertToAsyncFunction"; const errorCodes = [Diagnostics.This_may_be_converted_to_an_async_function.code]; diff --git a/src/services/codefixes/convertToEsModule.ts b/src/services/codefixes/convertToEsModule.ts index e58883371d7de..6b75fafa79be3 100644 --- a/src/services/codefixes/convertToEsModule.ts +++ b/src/services/codefixes/convertToEsModule.ts @@ -1,20 +1,85 @@ import { - createCodeFixActionWithoutFixAll, moduleSpecifierToValidIdentifier, registerCodeFix, + createCodeFixActionWithoutFixAll, + moduleSpecifierToValidIdentifier, + registerCodeFix, } from "../_namespaces/ts.codefix"; import { - __String, arrayFrom, ArrowFunction, BinaryExpression, BindingElement, BindingName, ClassDeclaration, - ClassExpression, concatenate, copyEntries, createMultiMap, createRange, Debug, Diagnostics, emptyMap, - ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, factory, filter, findChildOfKind, flatMap, - forEach, FunctionDeclaration, FunctionExpression, getEmitScriptTarget, getModeForUsageLocation, getQuotePreference, - getResolvedModule, getSynthesizedDeepClone, getSynthesizedDeepClones, getSynthesizedDeepClonesWithReplacements, - getSynthesizedDeepCloneWithReplacements, Identifier, ImportDeclaration, importFromModuleSpecifier, ImportSpecifier, - InternalSymbolName, isArray, isArrowFunction, isBinaryExpression, isClassExpression, - isExportsOrModuleExportsOrAlias, isFunctionExpression, isIdentifier, isNonContextualKeyword, - isObjectLiteralExpression, isPropertyAccessExpression, isRequireCall, isVariableStatement, makeImport, map, - mapAllOrFail, mapIterator, MethodDeclaration, Modifier, Node, NodeArray, NodeFlags, ObjectLiteralElementLike, - ObjectLiteralExpression, PropertyAccessExpression, QuotePreference, rangeContainsRange, ReadonlyCollection, - ScriptTarget, some, SourceFile, Statement, StringLiteralLike, SymbolFlags, SyntaxKind, - textChanges, TypeChecker, VariableStatement, + ArrowFunction, + BinaryExpression, + BindingElement, + BindingName, + ClassDeclaration, + ClassExpression, + Debug, + Diagnostics, + ExportDeclaration, + ExportSpecifier, + Expression, + ExpressionStatement, + FunctionDeclaration, + FunctionExpression, + Identifier, + ImportDeclaration, + ImportSpecifier, + InternalSymbolName, + MethodDeclaration, + Modifier, + Node, + NodeArray, + NodeFlags, + ObjectLiteralElementLike, + ObjectLiteralExpression, + PropertyAccessExpression, + QuotePreference, + ReadonlyCollection, + ScriptTarget, + SourceFile, + Statement, + StringLiteralLike, + SymbolFlags, + SyntaxKind, + TypeChecker, + VariableStatement, + __String, + arrayFrom, + concatenate, + copyEntries, + createMultiMap, + createRange, + emptyMap, + factory, + filter, + findChildOfKind, + flatMap, + forEach, + getEmitScriptTarget, + getModeForUsageLocation, + getQuotePreference, + getResolvedModule, + getSynthesizedDeepClone, + getSynthesizedDeepCloneWithReplacements, + getSynthesizedDeepClones, + getSynthesizedDeepClonesWithReplacements, + importFromModuleSpecifier, + isArray, + isArrowFunction, + isBinaryExpression, + isClassExpression, + isExportsOrModuleExportsOrAlias, + isFunctionExpression, + isIdentifier, + isNonContextualKeyword, + isObjectLiteralExpression, + isPropertyAccessExpression, + isRequireCall, + isVariableStatement, + makeImport, + map, + mapAllOrFail, + mapIterator, + rangeContainsRange, + some, + textChanges, } from "../_namespaces/ts"; registerCodeFix({ diff --git a/src/services/codefixes/convertToMappedObjectType.ts b/src/services/codefixes/convertToMappedObjectType.ts index 5625eecdd166a..ed80aef7764da 100644 --- a/src/services/codefixes/convertToMappedObjectType.ts +++ b/src/services/codefixes/convertToMappedObjectType.ts @@ -1,10 +1,32 @@ import { - cast, Diagnostics, emptyArray, factory, first, getAllSuperTypeNodes, getTokenAtPosition, - hasEffectiveReadonlyModifier, idText, IndexSignatureDeclaration, InterfaceDeclaration, isIdentifier, - isIndexSignatureDeclaration, isInterfaceDeclaration, isTypeAliasDeclaration, SourceFile, SyntaxKind, textChanges, - tryCast, TypeAliasDeclaration, TypeLiteralNode, TypeNode, + Diagnostics, + IndexSignatureDeclaration, + InterfaceDeclaration, + SourceFile, + SyntaxKind, + TypeAliasDeclaration, + TypeLiteralNode, + TypeNode, + cast, + emptyArray, + factory, + first, + getAllSuperTypeNodes, + getTokenAtPosition, + hasEffectiveReadonlyModifier, + idText, + isIdentifier, + isIndexSignatureDeclaration, + isInterfaceDeclaration, + isTypeAliasDeclaration, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixConvertToMappedObjectType"; const errorCodes = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code]; diff --git a/src/services/codefixes/convertToTypeOnlyExport.ts b/src/services/codefixes/convertToTypeOnlyExport.ts index 276bdcd5072d5..c8fbc5fce3e39 100644 --- a/src/services/codefixes/convertToTypeOnlyExport.ts +++ b/src/services/codefixes/convertToTypeOnlyExport.ts @@ -1,9 +1,28 @@ import { - addToSeen, CodeFixContextBase, contains, createTextSpanFromNode, Diagnostics, ExportSpecifier, factory, filter, - findDiagnosticForNode, getDiagnosticsWithinSpan, getNodeId, getTokenAtPosition, isExportSpecifier, SourceFile, - SyntaxKind, textChanges, TextSpan, tryCast, + CodeFixContextBase, + Diagnostics, + ExportSpecifier, + SourceFile, + SyntaxKind, + TextSpan, + addToSeen, + contains, + createTextSpanFromNode, + factory, + filter, + findDiagnosticForNode, + getDiagnosticsWithinSpan, + getNodeId, + getTokenAtPosition, + isExportSpecifier, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const errorCodes = [Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type.code]; const fixId = "convertToTypeOnlyExport"; diff --git a/src/services/codefixes/convertToTypeOnlyImport.ts b/src/services/codefixes/convertToTypeOnlyImport.ts index d124ceae5870c..d58e559a3292d 100644 --- a/src/services/codefixes/convertToTypeOnlyImport.ts +++ b/src/services/codefixes/convertToTypeOnlyImport.ts @@ -1,8 +1,20 @@ import { - CodeFixContextBase, Diagnostics, factory, getTokenAtPosition, ImportDeclaration, isImportDeclaration, SourceFile, - textChanges, TextSpan, tryCast, + CodeFixContextBase, + Diagnostics, + ImportDeclaration, + SourceFile, + TextSpan, + factory, + getTokenAtPosition, + isImportDeclaration, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const errorCodes = [Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code]; const fixId = "convertToTypeOnlyImport"; diff --git a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts index 4c228bae00e30..b2f1d20aed13b 100644 --- a/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts +++ b/src/services/codefixes/correctQualifiedNameToIndexedAccessType.ts @@ -1,8 +1,21 @@ import { - Debug, Diagnostics, factory, findAncestor, getTokenAtPosition, Identifier, isIdentifier, isQualifiedName, - QualifiedName, SourceFile, textChanges, + Debug, + Diagnostics, + Identifier, + QualifiedName, + SourceFile, + factory, + findAncestor, + getTokenAtPosition, + isIdentifier, + isQualifiedName, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "correctQualifiedNameToIndexedAccessType"; const errorCodes = [Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code]; diff --git a/src/services/codefixes/disableJsDiagnostics.ts b/src/services/codefixes/disableJsDiagnostics.ts index 1ea24128c08dc..e9187463faacb 100644 --- a/src/services/codefixes/disableJsDiagnostics.ts +++ b/src/services/codefixes/disableJsDiagnostics.ts @@ -1,10 +1,25 @@ import { - CodeFixAction, createTextChange, createTextSpan, createTextSpanFromBounds, DiagnosticCategory, Diagnostics, - getLineAndCharacterOfPosition, getNewLineOrDefaultFromHost, isCheckJsEnabledForFile, isInJSFile, mapDefined, - SourceFile, textChanges, tryAddToSet, + CodeFixAction, + DiagnosticCategory, + Diagnostics, + SourceFile, + createTextChange, + createTextSpan, + createTextSpanFromBounds, + getLineAndCharacterOfPosition, + getNewLineOrDefaultFromHost, + isCheckJsEnabledForFile, + isInJSFile, + mapDefined, + textChanges, + tryAddToSet, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createCodeFixActionWithoutFixAll, createFileTextChanges, registerCodeFix, + codeFixAll, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + createFileTextChanges, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixName = "disableJsDiagnostics"; diff --git a/src/services/codefixes/fixAddMissingConstraint.ts b/src/services/codefixes/fixAddMissingConstraint.ts index 2a3954369f02c..e2e2048cb2d99 100644 --- a/src/services/codefixes/fixAddMissingConstraint.ts +++ b/src/services/codefixes/fixAddMissingConstraint.ts @@ -1,12 +1,40 @@ import { - addToSeen, createTextSpan, DiagnosticMessageChain, Diagnostics, factory, find, flattenDiagnosticMessageText, - getEmitScriptTarget, getNodeId, getTokenAtPosition, isExpression, isIdentifier, isMappedTypeNode, isString, - isTypeNode, isTypeParameterDeclaration, LanguageServiceHost, Node, Program, SourceFile, textChanges, TextSpan, - Type, TypeChecker, TypeParameterDeclaration, UserPreferences, + DiagnosticMessageChain, + Diagnostics, + LanguageServiceHost, + Node, + Program, + SourceFile, + TextSpan, + Type, + TypeChecker, + TypeParameterDeclaration, + UserPreferences, + addToSeen, + createTextSpan, + factory, + find, + flattenDiagnosticMessageText, + getEmitScriptTarget, + getNodeId, + getTokenAtPosition, + isExpression, + isIdentifier, + isMappedTypeNode, + isString, + isTypeNode, + isTypeParameterDeclaration, + textChanges, } from "../_namespaces/ts"; import { - createCodeFixAction, createCombinedCodeActions, createImportAdder, eachDiagnostic, findAncestorMatchingSpan, - getNoopSymbolTrackerWithResolver, registerCodeFix, typeToAutoImportableTypeNode, + createCodeFixAction, + createCombinedCodeActions, + createImportAdder, + eachDiagnostic, + findAncestorMatchingSpan, + getNoopSymbolTrackerWithResolver, + registerCodeFix, + typeToAutoImportableTypeNode, } from "../_namespaces/ts.codefix"; const fixId = "addMissingConstraint"; diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index 6c8ff9d3f0561..98f640935287b 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -1,26 +1,127 @@ import { - __String, addToSeen, arrayFrom, BigIntLiteralType, BinaryExpression, CallExpression, CheckFlags, - ClassLikeDeclaration, CodeFixAction, CodeFixContext, CodeFixContextBase, concatenate, - createPropertyNameNodeForIdentifierOrLiteral, Debug, Diagnostics, emptyArray, EnumDeclaration, Expression, factory, - filter, find, findAncestor, findIndex, firstDefined, firstOrUndefined, FunctionExpression, getCheckFlags, - getClassLikeDeclarationOfSymbol, getEmitScriptTarget, getFirstConstructorWithBody, getNodeId, getObjectFlags, - getOrUpdate, getQuotePreference, getSourceFileOfNode, getTokenAtPosition, hasAbstractModifier, hasInitializer, - Identifier, idText, InterfaceDeclaration, isCallExpression, isClassLike, isComputedPropertyName, - isConstructorDeclaration, isEnumDeclaration, isFunctionTypeNode, isIdentifier, isIdentifierText, - isInterfaceDeclaration, isJsxAttribute, isJsxExpression, isJsxOpeningLikeElement, isJsxSpreadAttribute, - isMemberName, isMethodDeclaration, isMethodSignature, isModuleDeclaration, isObjectLiteralExpression, isParameter, - isPrivateIdentifier, isPropertyAccessExpression, isPropertyDeclaration, isReturnStatement, isSourceFile, - isSourceFileFromLibrary, isSourceFileJS, isTransientSymbol, isTypeLiteralNode, JsxOpeningLikeElement, - LanguageVariant, length, map, MethodDeclaration, ModifierFlags, ModuleDeclaration, Node, NodeBuilderFlags, - NumberLiteralType, ObjectFlags, ObjectLiteralExpression, or, PrivateIdentifier, Program, PropertyDeclaration, - QuotePreference, ReturnStatement, ScriptTarget, setParent, Signature, SignatureKind, singleElementArray, - singleOrUndefined, skipConstraint, some, SourceFile, startsWithUnderscore, StringLiteralType, Symbol, SymbolFlags, - SyntaxKind, textChanges, tryCast, Type, TypeChecker, TypeFlags, TypeLiteralNode, TypeNode, TypeReference, UnionType, + BigIntLiteralType, + BinaryExpression, + CallExpression, + CheckFlags, + ClassLikeDeclaration, + CodeFixAction, + CodeFixContext, + CodeFixContextBase, + Debug, + Diagnostics, + EnumDeclaration, + Expression, + FunctionExpression, + Identifier, + InterfaceDeclaration, + JsxOpeningLikeElement, + LanguageVariant, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + Node, + NodeBuilderFlags, + NumberLiteralType, + ObjectFlags, + ObjectLiteralExpression, + PrivateIdentifier, + Program, + PropertyDeclaration, + QuotePreference, + ReturnStatement, + ScriptTarget, + Signature, + SignatureKind, + SourceFile, + StringLiteralType, + Symbol, + SymbolFlags, + SyntaxKind, + Type, + TypeChecker, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeReference, + UnionType, + __String, + addToSeen, + arrayFrom, + concatenate, + createPropertyNameNodeForIdentifierOrLiteral, + emptyArray, + factory, + filter, + find, + findAncestor, + findIndex, + firstDefined, + firstOrUndefined, + getCheckFlags, + getClassLikeDeclarationOfSymbol, + getEmitScriptTarget, + getFirstConstructorWithBody, + getNodeId, + getObjectFlags, + getOrUpdate, + getQuotePreference, + getSourceFileOfNode, + getTokenAtPosition, + hasAbstractModifier, + hasInitializer, + idText, + isCallExpression, + isClassLike, + isComputedPropertyName, + isConstructorDeclaration, + isEnumDeclaration, + isFunctionTypeNode, + isIdentifier, + isIdentifierText, + isInterfaceDeclaration, + isJsxAttribute, + isJsxExpression, + isJsxOpeningLikeElement, + isJsxSpreadAttribute, + isMemberName, + isMethodDeclaration, + isMethodSignature, + isModuleDeclaration, + isObjectLiteralExpression, + isParameter, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyDeclaration, + isReturnStatement, + isSourceFile, + isSourceFileFromLibrary, + isSourceFileJS, + isTransientSymbol, + isTypeLiteralNode, + length, + map, + or, + setParent, + singleElementArray, + singleOrUndefined, + skipConstraint, + some, + startsWithUnderscore, + textChanges, + tryCast, } from "../_namespaces/ts"; import { - createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, createImportAdder, - createSignatureDeclarationFromCallExpression, createSignatureDeclarationFromSignature, createStubbedBody, - eachDiagnostic, getAllSupers, ImportAdder, registerCodeFix, + ImportAdder, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + createCombinedCodeActions, + createImportAdder, + createSignatureDeclarationFromCallExpression, + createSignatureDeclarationFromSignature, + createStubbedBody, + eachDiagnostic, + getAllSupers, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixMissingMember = "fixMissingMember"; diff --git a/src/services/codefixes/fixAddMissingNewOperator.ts b/src/services/codefixes/fixAddMissingNewOperator.ts index fc8db24afabb7..d21da714a0e39 100644 --- a/src/services/codefixes/fixAddMissingNewOperator.ts +++ b/src/services/codefixes/fixAddMissingNewOperator.ts @@ -1,8 +1,20 @@ import { - cast, Diagnostics, factory, getTokenAtPosition, isCallExpression, Node, SourceFile, textChanges, TextSpan, + Diagnostics, + Node, + SourceFile, + TextSpan, + cast, + factory, + getTokenAtPosition, + isCallExpression, + textChanges, textSpanEnd, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "addMissingNewOperator"; const errorCodes = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; diff --git a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts index dd5ad944760a5..cfcb1abcae757 100644 --- a/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts +++ b/src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts @@ -1,7 +1,18 @@ import { - Debug, Diagnostics, factory, getTokenAtPosition, ImportTypeNode, SourceFile, SyntaxKind, textChanges, + Debug, + Diagnostics, + ImportTypeNode, + SourceFile, + SyntaxKind, + factory, + getTokenAtPosition, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof"; const fixId = fixIdAddMissingTypeof; diff --git a/src/services/codefixes/fixAddVoidToPromise.ts b/src/services/codefixes/fixAddVoidToPromise.ts index c4281a5315bda..e2e6c36305797 100644 --- a/src/services/codefixes/fixAddVoidToPromise.ts +++ b/src/services/codefixes/fixAddVoidToPromise.ts @@ -1,10 +1,35 @@ import { - CodeFixAllContext, Diagnostics, factory, getJSDocTypeTag, getTokenAtPosition, idText, isCallExpression, - isIdentifier, isInJSFile, isNewExpression, isParameter, isParenthesizedExpression, isParenthesizedTypeNode, - isTypeReferenceNode, isUnionTypeNode, NewExpression, ParameterDeclaration, Program, skipTrivia, some, - SourceFile, SyntaxKind, textChanges, TextSpan, TypeFlags, + CodeFixAllContext, + Diagnostics, + NewExpression, + ParameterDeclaration, + Program, + SourceFile, + SyntaxKind, + TextSpan, + TypeFlags, + factory, + getJSDocTypeTag, + getTokenAtPosition, + idText, + isCallExpression, + isIdentifier, + isInJSFile, + isNewExpression, + isParameter, + isParenthesizedExpression, + isParenthesizedTypeNode, + isTypeReferenceNode, + isUnionTypeNode, + skipTrivia, + some, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "addVoidToPromise"; const fixId = "addVoidToPromise"; diff --git a/src/services/codefixes/fixAwaitInSyncFunction.ts b/src/services/codefixes/fixAwaitInSyncFunction.ts index b79aa7f3641fb..f8283609be9d4 100644 --- a/src/services/codefixes/fixAwaitInSyncFunction.ts +++ b/src/services/codefixes/fixAwaitInSyncFunction.ts @@ -1,9 +1,30 @@ import { - addToSeen, ArrowFunction, Diagnostics, factory, findChildOfKind, first, FunctionDeclaration, FunctionExpression, - getContainingFunction, getEntityNameFromTypeNode, getNodeId, getTokenAtPosition, isFunctionTypeNode, - isVariableDeclaration, MethodDeclaration, Node, SourceFile, SyntaxKind, textChanges, TypeNode, + ArrowFunction, + Diagnostics, + FunctionDeclaration, + FunctionExpression, + MethodDeclaration, + Node, + SourceFile, + SyntaxKind, + TypeNode, + addToSeen, + factory, + findChildOfKind, + first, + getContainingFunction, + getEntityNameFromTypeNode, + getNodeId, + getTokenAtPosition, + isFunctionTypeNode, + isVariableDeclaration, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixAwaitInSyncFunction"; const errorCodes = [ diff --git a/src/services/codefixes/fixCannotFindModule.ts b/src/services/codefixes/fixCannotFindModule.ts index fb959282f6e76..d49b9feeb9316 100644 --- a/src/services/codefixes/fixCannotFindModule.ts +++ b/src/services/codefixes/fixCannotFindModule.ts @@ -1,8 +1,22 @@ import { - Debug, Diagnostics, getTokenAtPosition, getTypesPackageName, InstallPackageAction, isExternalModuleNameRelative, - isStringLiteral, JsTyping, LanguageServiceHost, parsePackageName, SourceFile, tryCast, + Debug, + Diagnostics, + InstallPackageAction, + JsTyping, + LanguageServiceHost, + SourceFile, + getTokenAtPosition, + getTypesPackageName, + isExternalModuleNameRelative, + isStringLiteral, + parsePackageName, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "fixCannotFindModule"; const fixIdInstallTypesPackage = "installTypesPackage"; diff --git a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts index 95cc015aa9120..f5a009c00e55d 100644 --- a/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts +++ b/src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -1,11 +1,28 @@ import { - addToSeen, cast, ClassElement, ClassLikeDeclaration, Diagnostics, first, getEffectiveBaseTypeNode, getNodeId, - getSyntacticModifierFlags, getTokenAtPosition, isClassLike, ModifierFlags, SourceFile, Symbol, textChanges, + ClassElement, + ClassLikeDeclaration, + Diagnostics, + ModifierFlags, + SourceFile, + Symbol, UserPreferences, + addToSeen, + cast, + first, + getEffectiveBaseTypeNode, + getNodeId, + getSyntacticModifierFlags, + getTokenAtPosition, + isClassLike, + textChanges, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createImportAdder, createMissingMemberNodes, registerCodeFix, TypeConstructionContext, + codeFixAll, + createCodeFixAction, + createImportAdder, + createMissingMemberNodes, + registerCodeFix, } from "../_namespaces/ts.codefix"; const errorCodes = [ diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index defbd8b001ec4..cba4f1eba2854 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -1,13 +1,41 @@ import { - addToSeen, and, ClassElement, ClassLikeDeclaration, CodeFixAction, createSymbolTable, Debug, Diagnostics, - ExpressionWithTypeArguments, find, getContainingClass, getEffectiveBaseTypeNode, getEffectiveImplementsTypeNodes, - getEffectiveModifierFlags, getNodeId, getTokenAtPosition, IndexKind, InterfaceDeclaration, InterfaceType, - isConstructorDeclaration, mapDefined, ModifierFlags, SourceFile, Symbol, SymbolTable, textChanges, TypeChecker, + ClassElement, + ClassLikeDeclaration, + CodeFixAction, + Debug, + Diagnostics, + ExpressionWithTypeArguments, + IndexKind, + InterfaceDeclaration, + InterfaceType, + ModifierFlags, + SourceFile, + Symbol, + SymbolTable, + TypeChecker, UserPreferences, + addToSeen, + and, + createSymbolTable, + find, + getContainingClass, + getEffectiveBaseTypeNode, + getEffectiveImplementsTypeNodes, + getEffectiveModifierFlags, + getNodeId, + getTokenAtPosition, + isConstructorDeclaration, + mapDefined, + textChanges, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createImportAdder, createMissingMemberNodes, getNoopSymbolTrackerWithResolver, - registerCodeFix, TypeConstructionContext, + TypeConstructionContext, + codeFixAll, + createCodeFixAction, + createImportAdder, + createMissingMemberNodes, + getNoopSymbolTrackerWithResolver, + registerCodeFix, } from "../_namespaces/ts.codefix"; const errorCodes = [ diff --git a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts index 0a452fc040b9b..0cb3b1087158d 100644 --- a/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts +++ b/src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts @@ -1,9 +1,27 @@ import { - addToSeen, CallExpression, ConstructorDeclaration, Diagnostics, ExpressionStatement, forEachChild, - getContainingFunction, getNodeId, getTokenAtPosition, isExpressionStatement, isFunctionLike, - isPropertyAccessExpression, isSuperCall, Node, SourceFile, SyntaxKind, textChanges, + CallExpression, + ConstructorDeclaration, + Diagnostics, + ExpressionStatement, + Node, + SourceFile, + SyntaxKind, + addToSeen, + forEachChild, + getContainingFunction, + getNodeId, + getTokenAtPosition, + isExpressionStatement, + isFunctionLike, + isPropertyAccessExpression, + isSuperCall, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "classSuperMustPrecedeThisAccess"; const errorCodes = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; diff --git a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts index 118b1b630f4c3..9b46c41d685de 100644 --- a/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts +++ b/src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts @@ -1,8 +1,19 @@ import { - ConstructorDeclaration, Debug, Diagnostics, emptyArray, factory, getTokenAtPosition, isConstructorDeclaration, - SourceFile, textChanges, + ConstructorDeclaration, + Debug, + Diagnostics, + SourceFile, + emptyArray, + factory, + getTokenAtPosition, + isConstructorDeclaration, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "constructorForDerivedNeedSuperCall"; const errorCodes = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; diff --git a/src/services/codefixes/fixEnableExperimentalDecorators.ts b/src/services/codefixes/fixEnableExperimentalDecorators.ts index 913ba7ee80f75..281afd5ebeb1f 100644 --- a/src/services/codefixes/fixEnableExperimentalDecorators.ts +++ b/src/services/codefixes/fixEnableExperimentalDecorators.ts @@ -1,6 +1,14 @@ -import { Diagnostics, factory, textChanges, TsConfigSourceFile } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixActionWithoutFixAll, registerCodeFix, setJsonCompilerOptionValue, + Diagnostics, + TsConfigSourceFile, + factory, + textChanges, +} from "../_namespaces/ts"; +import { + codeFixAll, + createCodeFixActionWithoutFixAll, + registerCodeFix, + setJsonCompilerOptionValue, } from "../_namespaces/ts.codefix"; const fixId = "enableExperimentalDecorators"; diff --git a/src/services/codefixes/fixEnableJsxFlag.ts b/src/services/codefixes/fixEnableJsxFlag.ts index 7fb645b03d374..2dab4970f1f68 100644 --- a/src/services/codefixes/fixEnableJsxFlag.ts +++ b/src/services/codefixes/fixEnableJsxFlag.ts @@ -1,6 +1,14 @@ -import { Diagnostics, factory, textChanges, TsConfigSourceFile } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixActionWithoutFixAll, registerCodeFix, setJsonCompilerOptionValue, + Diagnostics, + TsConfigSourceFile, + factory, + textChanges, +} from "../_namespaces/ts"; +import { + codeFixAll, + createCodeFixActionWithoutFixAll, + registerCodeFix, + setJsonCompilerOptionValue, } from "../_namespaces/ts.codefix"; const fixID = "fixEnableJsxFlag"; diff --git a/src/services/codefixes/fixExpectedComma.ts b/src/services/codefixes/fixExpectedComma.ts index 795ff8a6a49e7..7fcb9311e7de9 100644 --- a/src/services/codefixes/fixExpectedComma.ts +++ b/src/services/codefixes/fixExpectedComma.ts @@ -1,8 +1,19 @@ import { - Diagnostics, factory, getTokenAtPosition, isArrayLiteralExpression, isObjectLiteralExpression, Node, SourceFile, - SyntaxKind, textChanges, + Diagnostics, + Node, + SourceFile, + SyntaxKind, + factory, + getTokenAtPosition, + isArrayLiteralExpression, + isObjectLiteralExpression, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixExpectedComma"; const expectedErrorCode = Diagnostics._0_expected.code; diff --git a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts index 9cd8edb6ac997..f7eeff43a6a25 100644 --- a/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts +++ b/src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts @@ -1,8 +1,20 @@ import { - Diagnostics, factory, getContainingClass, getTokenAtPosition, HeritageClause, isWhiteSpaceSingleLine, Node, - SourceFile, SyntaxKind, textChanges, + Diagnostics, + HeritageClause, + Node, + SourceFile, + SyntaxKind, + factory, + getContainingClass, + getTokenAtPosition, + isWhiteSpaceSingleLine, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "extendsInterfaceBecomesImplements"; const errorCodes = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; diff --git a/src/services/codefixes/fixForgottenThisPropertyAccess.ts b/src/services/codefixes/fixForgottenThisPropertyAccess.ts index cf441e9315605..a90d84936425f 100644 --- a/src/services/codefixes/fixForgottenThisPropertyAccess.ts +++ b/src/services/codefixes/fixForgottenThisPropertyAccess.ts @@ -1,8 +1,21 @@ import { - Diagnostics, factory, getContainingClass, getTokenAtPosition, Identifier, isIdentifier, isPrivateIdentifier, - PrivateIdentifier, SourceFile, suppressLeadingAndTrailingTrivia, textChanges, + Diagnostics, + Identifier, + PrivateIdentifier, + SourceFile, + factory, + getContainingClass, + getTokenAtPosition, + isIdentifier, + isPrivateIdentifier, + suppressLeadingAndTrailingTrivia, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "forgottenThisPropertyAccess"; const didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; diff --git a/src/services/codefixes/fixImplicitThis.ts b/src/services/codefixes/fixImplicitThis.ts index bd795644946dd..6d392fbed1628 100644 --- a/src/services/codefixes/fixImplicitThis.ts +++ b/src/services/codefixes/fixImplicitThis.ts @@ -1,9 +1,28 @@ import { - ANONYMOUS, Debug, DiagnosticAndArguments, Diagnostics, emptyArray, factory, FindAllReferences, findChildOfKind, - getThisContainer, getTokenAtPosition, isFunctionDeclaration, isFunctionExpression, isSourceFile, isThis, SourceFile, - SyntaxKind, textChanges, TypeChecker, + ANONYMOUS, + Debug, + DiagnosticAndArguments, + Diagnostics, + FindAllReferences, + SourceFile, + SyntaxKind, + TypeChecker, + emptyArray, + factory, + findChildOfKind, + getThisContainer, + getTokenAtPosition, + isFunctionDeclaration, + isFunctionExpression, + isSourceFile, + isThis, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixImplicitThis"; const errorCodes = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; diff --git a/src/services/codefixes/fixImportNonExportedMember.ts b/src/services/codefixes/fixImportNonExportedMember.ts index ce81a02dd3085..24749a9f1e28c 100644 --- a/src/services/codefixes/fixImportNonExportedMember.ts +++ b/src/services/codefixes/fixImportNonExportedMember.ts @@ -1,12 +1,40 @@ import { - canHaveExportModifier, Declaration, Diagnostics, ExportDeclaration, factory, find, findAncestor, findLast, - firstOrUndefined, getResolvedModule, getTokenAtPosition, Identifier, isExportDeclaration, isIdentifier, - isImportDeclaration, isNamedExports, isSourceFileFromLibrary, isStringLiteral, isTypeDeclaration, - isVariableDeclaration, isVariableStatement, length, map, Node, Program, SourceFile, Symbol, textChanges, - tryCast, VariableStatement, + Declaration, + Diagnostics, + ExportDeclaration, + Identifier, + Node, + Program, + SourceFile, + Symbol, + VariableStatement, + canHaveExportModifier, + factory, + find, + findAncestor, + findLast, + firstOrUndefined, + getResolvedModule, + getTokenAtPosition, + isExportDeclaration, + isIdentifier, + isImportDeclaration, + isNamedExports, + isSourceFileFromLibrary, + isStringLiteral, + isTypeDeclaration, + isVariableDeclaration, + isVariableStatement, + length, + map, + textChanges, + tryCast, } from "../_namespaces/ts"; import { - createCodeFixAction, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixAction, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; const fixId = "fixImportNonExportedMember"; diff --git a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts index f9ce4f3167317..38081bd81ecc9 100644 --- a/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts +++ b/src/services/codefixes/fixIncorrectNamedTupleSyntax.ts @@ -1,8 +1,20 @@ import { - Diagnostics, factory, findAncestor, getTokenAtPosition, NamedTupleMember, OptionalTypeNode, ParenthesizedTypeNode, - RestTypeNode, SourceFile, SyntaxKind, textChanges, + Diagnostics, + NamedTupleMember, + OptionalTypeNode, + ParenthesizedTypeNode, + RestTypeNode, + SourceFile, + SyntaxKind, + factory, + findAncestor, + getTokenAtPosition, + textChanges, } from "../_namespaces/ts"; -import { createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixIncorrectNamedTupleSyntax"; const errorCodes = [ diff --git a/src/services/codefixes/fixInvalidImportSyntax.ts b/src/services/codefixes/fixInvalidImportSyntax.ts index d326e8e4cb94b..544b37d9f853c 100644 --- a/src/services/codefixes/fixInvalidImportSyntax.ts +++ b/src/services/codefixes/fixInvalidImportSyntax.ts @@ -1,10 +1,34 @@ import { - addRange, CallExpression, CodeFixAction, CodeFixContext, Diagnostics, factory, findAncestor, getEmitModuleKind, - getNamespaceDeclarationNode, getQuotePreference, getSourceFileOfNode, getTokenAtPosition, ImportDeclaration, - isExpression, isImportCall, isNamedDeclaration, makeImport, ModuleKind, NamespaceImport, NewExpression, Node, - SourceFile, SyntaxKind, textChanges, TransientSymbol, + CallExpression, + CodeFixAction, + CodeFixContext, + Diagnostics, + ImportDeclaration, + ModuleKind, + NamespaceImport, + NewExpression, + Node, + SourceFile, + SyntaxKind, + TransientSymbol, + addRange, + factory, + findAncestor, + getEmitModuleKind, + getNamespaceDeclarationNode, + getQuotePreference, + getSourceFileOfNode, + getTokenAtPosition, + isExpression, + isImportCall, + isNamedDeclaration, + makeImport, + textChanges, } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "invalidImportSyntax"; diff --git a/src/services/codefixes/fixInvalidJsxCharacters.ts b/src/services/codefixes/fixInvalidJsxCharacters.ts index b439ac6e6a380..d5b5a0ffd4f9b 100644 --- a/src/services/codefixes/fixInvalidJsxCharacters.ts +++ b/src/services/codefixes/fixInvalidJsxCharacters.ts @@ -1,5 +1,16 @@ -import { Diagnostics, hasProperty, quote, SourceFile, textChanges, UserPreferences } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + Diagnostics, + SourceFile, + UserPreferences, + hasProperty, + quote, + textChanges, +} from "../_namespaces/ts"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixIdExpression = "fixInvalidJsxCharacters_expression"; const fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity"; diff --git a/src/services/codefixes/fixJSDocTypes.ts b/src/services/codefixes/fixJSDocTypes.ts index 56cd99ddc3938..a5cb3e2b79533 100644 --- a/src/services/codefixes/fixJSDocTypes.ts +++ b/src/services/codefixes/fixJSDocTypes.ts @@ -1,11 +1,39 @@ import { - AsExpression, CallSignatureDeclaration, CodeFixAction, ConstructSignatureDeclaration, DiagnosticMessage, - Diagnostics, findAncestor, FunctionDeclaration, GetAccessorDeclaration, getTokenAtPosition, - IndexSignatureDeclaration, MappedTypeNode, MethodDeclaration, MethodSignature, Node, ParameterDeclaration, - PropertyDeclaration, PropertySignature, SetAccessorDeclaration, SourceFile, SyntaxKind, textChanges, Type, - TypeAliasDeclaration, TypeAssertion, TypeChecker, TypeFlags, TypeNode, VariableDeclaration, + AsExpression, + CallSignatureDeclaration, + CodeFixAction, + ConstructSignatureDeclaration, + DiagnosticMessage, + Diagnostics, + FunctionDeclaration, + GetAccessorDeclaration, + IndexSignatureDeclaration, + MappedTypeNode, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, + PropertyDeclaration, + PropertySignature, + SetAccessorDeclaration, + SourceFile, + SyntaxKind, + Type, + TypeAliasDeclaration, + TypeAssertion, + TypeChecker, + TypeFlags, + TypeNode, + VariableDeclaration, + findAncestor, + getTokenAtPosition, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixIdPlain = "fixJSDocTypes_plain"; const fixIdNullable = "fixJSDocTypes_nullable"; diff --git a/src/services/codefixes/fixMissingCallParentheses.ts b/src/services/codefixes/fixMissingCallParentheses.ts index a4d20b3759025..06cceb0968d57 100644 --- a/src/services/codefixes/fixMissingCallParentheses.ts +++ b/src/services/codefixes/fixMissingCallParentheses.ts @@ -1,8 +1,19 @@ import { - Diagnostics, getTokenAtPosition, Identifier, isIdentifier, isPropertyAccessExpression, PrivateIdentifier, - PropertyAccessExpression, SourceFile, textChanges, + Diagnostics, + Identifier, + PrivateIdentifier, + PropertyAccessExpression, + SourceFile, + getTokenAtPosition, + isIdentifier, + isPropertyAccessExpression, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixMissingCallParentheses"; const errorCodes = [ diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 71142e4cd08b9..323c6e3d0679a 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -1,9 +1,20 @@ import { - createCodeFixActionWithoutFixAll, registerCodeFix, setJsonCompilerOptionValue, setJsonCompilerOptionValues, + createCodeFixActionWithoutFixAll, + registerCodeFix, + setJsonCompilerOptionValue, + setJsonCompilerOptionValues, } from "../_namespaces/ts.codefix"; import { - CodeFixAction, Diagnostics, Expression, factory, getEmitModuleKind, getEmitScriptTarget, - getTsConfigObjectLiteralExpression, ModuleKind, ScriptTarget, textChanges, + CodeFixAction, + Diagnostics, + Expression, + ModuleKind, + ScriptTarget, + factory, + getEmitModuleKind, + getEmitScriptTarget, + getTsConfigObjectLiteralExpression, + textChanges, } from "../_namespaces/ts"; registerCodeFix({ diff --git a/src/services/codefixes/fixNaNEquality.ts b/src/services/codefixes/fixNaNEquality.ts index 02d2c8240620e..3a84eedb2a59e 100644 --- a/src/services/codefixes/fixNaNEquality.ts +++ b/src/services/codefixes/fixNaNEquality.ts @@ -1,9 +1,26 @@ import { - BinaryExpression, createTextSpan, DiagnosticMessageChain, Diagnostics, Expression, factory, find, - flattenDiagnosticMessageText, isBinaryExpression, isExpression, Program, SourceFile, SyntaxKind, textChanges, + BinaryExpression, + DiagnosticMessageChain, + Diagnostics, + Expression, + Program, + SourceFile, + SyntaxKind, TextSpan, + createTextSpan, + factory, + find, + flattenDiagnosticMessageText, + isBinaryExpression, + isExpression, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, findAncestorMatchingSpan, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + findAncestorMatchingSpan, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixNaNEquality"; const errorCodes = [ diff --git a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts index 33e80189797e9..adaeaf39c7694 100644 --- a/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts +++ b/src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts @@ -1,8 +1,22 @@ import { - cast, Diagnostics, factory, getQuotePreference, getTokenAtPosition, isPropertyAccessChain, - isPropertyAccessExpression, PropertyAccessExpression, QuotePreference, SourceFile, textChanges, UserPreferences, + Diagnostics, + PropertyAccessExpression, + QuotePreference, + SourceFile, + UserPreferences, + cast, + factory, + getQuotePreference, + getTokenAtPosition, + isPropertyAccessChain, + isPropertyAccessExpression, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixNoPropertyAccessFromIndexSignature"; const errorCodes = [ diff --git a/src/services/codefixes/fixOverrideModifier.ts b/src/services/codefixes/fixOverrideModifier.ts index c298256f1cda0..46ab91a11866f 100644 --- a/src/services/codefixes/fixOverrideModifier.ts +++ b/src/services/codefixes/fixOverrideModifier.ts @@ -1,12 +1,42 @@ import { - CodeFixAllContext, CodeFixContext, ConstructorDeclaration, Debug, DiagnosticMessage, Diagnostics, emptyArray, - factory, find, findAncestor, findLast, GetAccessorDeclaration, getTokenAtPosition, isAbstractModifier, - isAccessibilityModifier, isClassLike, isDecorator, isJSDocOverrideTag, isOverrideModifier, - isParameterPropertyDeclaration, isSourceFileJS, isStaticModifier, MethodDeclaration, Node, not, - ParameterPropertyDeclaration, PropertyDeclaration, SetAccessorDeclaration, skipTrivia, SourceFile, SyntaxKind, + CodeFixAllContext, + CodeFixContext, + ConstructorDeclaration, + Debug, + DiagnosticMessage, + Diagnostics, + GetAccessorDeclaration, + MethodDeclaration, + Node, + ParameterPropertyDeclaration, + PropertyDeclaration, + SetAccessorDeclaration, + SourceFile, + SyntaxKind, + emptyArray, + factory, + find, + findAncestor, + findLast, + getTokenAtPosition, + isAbstractModifier, + isAccessibilityModifier, + isClassLike, + isDecorator, + isJSDocOverrideTag, + isOverrideModifier, + isParameterPropertyDeclaration, + isSourceFileJS, + isStaticModifier, + not, + skipTrivia, textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixActionMaybeFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixActionMaybeFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "fixOverrideModifier"; const fixAddOverrideId = "fixAddOverrideModifier"; diff --git a/src/services/codefixes/fixPropertyAssignment.ts b/src/services/codefixes/fixPropertyAssignment.ts index 52b250ed43cc3..e57879b5899cd 100644 --- a/src/services/codefixes/fixPropertyAssignment.ts +++ b/src/services/codefixes/fixPropertyAssignment.ts @@ -1,8 +1,19 @@ import { - cast, Diagnostics, Expression, factory, getTokenAtPosition, isShorthandPropertyAssignment, - ShorthandPropertyAssignment, SourceFile, textChanges, + Diagnostics, + Expression, + ShorthandPropertyAssignment, + SourceFile, + cast, + factory, + getTokenAtPosition, + isShorthandPropertyAssignment, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixPropertyAssignment"; const errorCodes = [ diff --git a/src/services/codefixes/fixPropertyOverrideAccessor.ts b/src/services/codefixes/fixPropertyOverrideAccessor.ts index 8c229c3dc70b3..5116f291cfdbb 100644 --- a/src/services/codefixes/fixPropertyOverrideAccessor.ts +++ b/src/services/codefixes/fixPropertyOverrideAccessor.ts @@ -1,9 +1,23 @@ import { - CodeFixAllContext, CodeFixContext, Debug, Diagnostics, getSourceFileOfNode, getTextOfPropertyName, - getTokenAtPosition, isAccessor, isClassLike, singleOrUndefined, SourceFile, unescapeLeadingUnderscores, + CodeFixAllContext, + CodeFixContext, + Debug, + Diagnostics, + SourceFile, + getSourceFileOfNode, + getTextOfPropertyName, + getTokenAtPosition, + isAccessor, + isClassLike, + singleOrUndefined, + unescapeLeadingUnderscores, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, generateAccessorFromProperty, getAllSupers, registerCodeFix, + codeFixAll, + createCodeFixAction, + generateAccessorFromProperty, + getAllSupers, + registerCodeFix, } from "../_namespaces/ts.codefix"; const errorCodes = [ diff --git a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts index d29797a1a7071..464800e46e95f 100644 --- a/src/services/codefixes/fixReturnTypeInAsyncFunction.ts +++ b/src/services/codefixes/fixReturnTypeInAsyncFunction.ts @@ -1,8 +1,21 @@ import { - Diagnostics, factory, findAncestor, getTokenAtPosition, isFunctionLikeDeclaration, isInJSFile, SourceFile, - textChanges, Type, TypeChecker, TypeNode, + Diagnostics, + SourceFile, + Type, + TypeChecker, + TypeNode, + factory, + findAncestor, + getTokenAtPosition, + isFunctionLikeDeclaration, + isInJSFile, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixReturnTypeInAsyncFunction"; const errorCodes = [ diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index cf7768ddfe95c..5be6d9b423404 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -1,13 +1,50 @@ import { - CodeFixContextBase, Debug, Diagnostics, factory, findAncestor, getEffectiveBaseTypeNode, getEmitScriptTarget, - getMeaningFromLocation, getModeForUsageLocation, getResolvedModule, getTextOfNode, getTokenAtPosition, - hasSyntacticModifier, ImportDeclaration, isBinaryExpression, isClassElement, isClassLike, isIdentifier, - isIdentifierText, isImportDeclaration, isImportSpecifier, isJsxAttribute, isJsxOpeningLikeElement, isMemberName, - isNamedDeclaration, isPrivateIdentifier, isPropertyAccessExpression, isQualifiedName, isStringLiteralLike, - ModifierFlags, Node, NodeFlags, ScriptTarget, SemanticMeaning, SourceFile, Symbol, SymbolFlags, symbolName, - SyntaxKind, textChanges, + CodeFixContextBase, + Debug, + Diagnostics, + ImportDeclaration, + ModifierFlags, + Node, + NodeFlags, + ScriptTarget, + SemanticMeaning, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + factory, + findAncestor, + getEffectiveBaseTypeNode, + getEmitScriptTarget, + getMeaningFromLocation, + getModeForUsageLocation, + getResolvedModule, + getTextOfNode, + getTokenAtPosition, + hasSyntacticModifier, + isBinaryExpression, + isClassElement, + isClassLike, + isIdentifier, + isIdentifierText, + isImportDeclaration, + isImportSpecifier, + isJsxAttribute, + isJsxOpeningLikeElement, + isMemberName, + isNamedDeclaration, + isPrivateIdentifier, + isPropertyAccessExpression, + isQualifiedName, + isStringLiteralLike, + symbolName, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixSpelling"; const errorCodes = [ diff --git a/src/services/codefixes/fixStrictClassInitialization.ts b/src/services/codefixes/fixStrictClassInitialization.ts index 5dc35843d7462..e84a766a25e20 100644 --- a/src/services/codefixes/fixStrictClassInitialization.ts +++ b/src/services/codefixes/fixStrictClassInitialization.ts @@ -1,11 +1,38 @@ import { - append, BigIntLiteralType, CodeFixAction, CodeFixContext, Debug, Diagnostics, Expression, factory, firstDefined, - getClassLikeDeclarationOfSymbol, getEffectiveTypeAnnotationNode, getFirstConstructorWithBody, getTokenAtPosition, - hasSyntacticModifier, isIdentifier, isInJSFile, isPropertyDeclaration, isUnionTypeNode, ModifierFlags, - PropertyDeclaration, SourceFile, suppressLeadingAndTrailingTrivia, SyntaxKind, textChanges, Type, TypeChecker, - TypeFlags, TypeNode, + BigIntLiteralType, + CodeFixAction, + CodeFixContext, + Debug, + Diagnostics, + Expression, + ModifierFlags, + PropertyDeclaration, + SourceFile, + SyntaxKind, + Type, + TypeChecker, + TypeFlags, + TypeNode, + append, + factory, + firstDefined, + getClassLikeDeclarationOfSymbol, + getEffectiveTypeAnnotationNode, + getFirstConstructorWithBody, + getTokenAtPosition, + hasSyntacticModifier, + isIdentifier, + isInJSFile, + isPropertyDeclaration, + isUnionTypeNode, + suppressLeadingAndTrailingTrivia, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "strictClassInitialization"; const fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions"; diff --git a/src/services/codefixes/fixUnmatchedParameter.ts b/src/services/codefixes/fixUnmatchedParameter.ts index cfeb0fe7200e9..9cd1c5abbc299 100644 --- a/src/services/codefixes/fixUnmatchedParameter.ts +++ b/src/services/codefixes/fixUnmatchedParameter.ts @@ -1,10 +1,31 @@ import { - __String, append, CodeFixAction, CodeFixContext, Diagnostics, factory, firstDefined, getHostSignatureFromJSDoc, - getJSDocTags, getTokenAtPosition, Identifier, isIdentifier, isJSDocParameterTag, JSDocParameterTag, JSDocTag, - length, map, SignatureDeclaration, SourceFile, textChanges, + CodeFixAction, + CodeFixContext, + Diagnostics, + Identifier, + JSDocParameterTag, + JSDocTag, + SignatureDeclaration, + SourceFile, + __String, + append, + factory, + firstDefined, + getHostSignatureFromJSDoc, + getJSDocTags, + getTokenAtPosition, + isIdentifier, + isJSDocParameterTag, + length, + map, + textChanges, } from "../_namespaces/ts"; import { - createCodeFixAction, createCodeFixActionWithoutFixAll, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixAction, + createCodeFixActionWithoutFixAll, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; const deleteUnmatchedParameter = "deleteUnmatchedParameter"; diff --git a/src/services/codefixes/fixUnreachableCode.ts b/src/services/codefixes/fixUnreachableCode.ts index 5e3fa6f45d7d4..6287923a313b5 100644 --- a/src/services/codefixes/fixUnreachableCode.ts +++ b/src/services/codefixes/fixUnreachableCode.ts @@ -1,8 +1,24 @@ import { - Debug, Diagnostics, emptyArray, factory, findAncestor, first, getTokenAtPosition, IfStatement, isBlock, isStatement, - sliceAfter, SourceFile, SyntaxKind, textChanges, + Debug, + Diagnostics, + IfStatement, + SourceFile, + SyntaxKind, + emptyArray, + factory, + findAncestor, + first, + getTokenAtPosition, + isBlock, + isStatement, + sliceAfter, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixUnreachableCode"; const errorCodes = [Diagnostics.Unreachable_code_detected.code]; diff --git a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts index 9340f7ddaadea..960a4d8cb9022 100644 --- a/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts +++ b/src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts @@ -1,10 +1,33 @@ import { - append, CodeFixAction, Diagnostics, emptyArray, find, forEachImportClauseDeclaration, getTokenAtPosition, - ImportClause, ImportEqualsDeclaration, ImportSpecifier, isIdentifier, isImportClause, isImportEqualsDeclaration, - isImportSpecifier, Node, or, Program, refactor, skipAlias, SourceFile, SymbolFlags, SyntaxKind, textChanges, + CodeFixAction, + Diagnostics, + ImportClause, + ImportEqualsDeclaration, + ImportSpecifier, + Node, + Program, + SourceFile, + SymbolFlags, + SyntaxKind, + append, + emptyArray, + find, + forEachImportClauseDeclaration, + getTokenAtPosition, + isIdentifier, + isImportClause, + isImportEqualsDeclaration, + isImportSpecifier, + or, + refactor, + skipAlias, + textChanges, tryCast, } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixUnreferenceableDecoratorMetadata"; const errorCodes = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code]; diff --git a/src/services/codefixes/fixUnusedIdentifier.ts b/src/services/codefixes/fixUnusedIdentifier.ts index c07250c280ae7..e16d098c709a2 100644 --- a/src/services/codefixes/fixUnusedIdentifier.ts +++ b/src/services/codefixes/fixUnusedIdentifier.ts @@ -1,15 +1,62 @@ import { - ArrayBindingPattern, CancellationToken, cast, CodeFixAction, Debug, DiagnosticAndArguments, DiagnosticMessage, - Diagnostics, factory, FileTextChanges, FindAllReferences, first, forEach, FunctionLikeDeclaration, - getJSDocParameterTags, getTokenAtPosition, Identifier, ImportDeclaration, isArrayBindingPattern, isBinaryExpression, - isCallExpression, isComputedPropertyName, isDeclarationWithTypeParameterChildren, isExpressionStatement, - isIdentifier, isImportClause, isImportDeclaration, isInferTypeNode, isJSDocTemplateTag, isMethodDeclaration, - isMethodSignature, isModifier, isObjectBindingPattern, isParameter, isPostfixUnaryExpression, - isPrefixUnaryExpression, isPropertyAccessExpression, isSuperKeyword, isVariableDeclarationList, map, Node, - ObjectBindingPattern, ParameterDeclaration, Program, showModuleSpecifier, SourceFile, SyntaxKind, textChanges, - tryCast, TypeChecker, VariableDeclaration, VariableDeclarationList, + ArrayBindingPattern, + CancellationToken, + CodeFixAction, + Debug, + DiagnosticAndArguments, + DiagnosticMessage, + Diagnostics, + FileTextChanges, + FindAllReferences, + FunctionLikeDeclaration, + Identifier, + ImportDeclaration, + Node, + ObjectBindingPattern, + ParameterDeclaration, + Program, + SourceFile, + SyntaxKind, + TypeChecker, + VariableDeclaration, + VariableDeclarationList, + cast, + factory, + first, + forEach, + getJSDocParameterTags, + getTokenAtPosition, + isArrayBindingPattern, + isBinaryExpression, + isCallExpression, + isComputedPropertyName, + isDeclarationWithTypeParameterChildren, + isExpressionStatement, + isIdentifier, + isImportClause, + isImportDeclaration, + isInferTypeNode, + isJSDocTemplateTag, + isMethodDeclaration, + isMethodSignature, + isModifier, + isObjectBindingPattern, + isParameter, + isPostfixUnaryExpression, + isPrefixUnaryExpression, + isPropertyAccessExpression, + isSuperKeyword, + isVariableDeclarationList, + map, + showModuleSpecifier, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixName = "unusedIdentifier"; const fixIdPrefix = "unusedIdentifier_prefix"; diff --git a/src/services/codefixes/fixUnusedLabel.ts b/src/services/codefixes/fixUnusedLabel.ts index 2d6fbba8b2016..ed32e3d7d2faf 100644 --- a/src/services/codefixes/fixUnusedLabel.ts +++ b/src/services/codefixes/fixUnusedLabel.ts @@ -1,8 +1,20 @@ import { - cast, Diagnostics, findChildOfKind, getTokenAtPosition, isLabeledStatement, positionsAreOnSameLine, skipTrivia, - SourceFile, SyntaxKind, textChanges, + Diagnostics, + SourceFile, + SyntaxKind, + cast, + findChildOfKind, + getTokenAtPosition, + isLabeledStatement, + positionsAreOnSameLine, + skipTrivia, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "fixUnusedLabel"; const errorCodes = [Diagnostics.Unused_label.code]; diff --git a/src/services/codefixes/generateAccessors.ts b/src/services/codefixes/generateAccessors.ts index e6d09c1ad862a..1c68baaade8fd 100644 --- a/src/services/codefixes/generateAccessors.ts +++ b/src/services/codefixes/generateAccessors.ts @@ -1,14 +1,59 @@ import { - AccessorDeclaration, canHaveDecorators, cast, ClassLikeDeclaration, concatenate, ConstructorDeclaration, - DeclarationName, Diagnostics, factory, FileTextChanges, find, findAncestor, getClassExtendsHeritageElement, - getDecorators, getEffectiveModifierFlags, getFirstConstructorWithBody, getLocaleSpecificMessage, getTokenAtPosition, - getTypeAnnotationNode, getUniqueName, hasEffectiveReadonlyModifier, hasStaticModifier, Identifier, - InterfaceDeclaration, isClassLike, isElementAccessExpression, isFunctionLike, isIdentifier, - isParameterPropertyDeclaration, isPropertyAccessExpression, isPropertyAssignment, isPropertyDeclaration, - isSourceFileJS, isStringLiteral, isUnionTypeNode, isWriteAccess, ModifierFlags, ModifierLike, Node, - nodeOverlapsWithStartEnd, ObjectLiteralExpression, ParameterPropertyDeclaration, Program, PropertyAssignment, - PropertyDeclaration, refactor, SourceFile, startsWithUnderscore, StringLiteral, suppressLeadingAndTrailingTrivia, - SymbolFlags, SyntaxKind, textChanges, TypeChecker, TypeNode, + AccessorDeclaration, + ClassLikeDeclaration, + ConstructorDeclaration, + DeclarationName, + Diagnostics, + FileTextChanges, + Identifier, + InterfaceDeclaration, + ModifierFlags, + ModifierLike, + Node, + ObjectLiteralExpression, + ParameterPropertyDeclaration, + Program, + PropertyAssignment, + PropertyDeclaration, + SourceFile, + StringLiteral, + SymbolFlags, + SyntaxKind, + TypeChecker, + TypeNode, + canHaveDecorators, + cast, + concatenate, + factory, + find, + findAncestor, + getClassExtendsHeritageElement, + getDecorators, + getEffectiveModifierFlags, + getFirstConstructorWithBody, + getLocaleSpecificMessage, + getTokenAtPosition, + getTypeAnnotationNode, + getUniqueName, + hasEffectiveReadonlyModifier, + hasStaticModifier, + isClassLike, + isElementAccessExpression, + isFunctionLike, + isIdentifier, + isParameterPropertyDeclaration, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyDeclaration, + isSourceFileJS, + isStringLiteral, + isUnionTypeNode, + isWriteAccess, + nodeOverlapsWithStartEnd, + refactor, + startsWithUnderscore, + suppressLeadingAndTrailingTrivia, + textChanges, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index d6f66de1d2bad..9fcec04c92033 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -1,20 +1,103 @@ import { - AccessorDeclaration, append, arrayFrom, ArrowFunction, Block, CallExpression, CharacterCodes, ClassLikeDeclaration, - CodeFixContextBase, Debug, Diagnostics, emptyArray, EntityName, Expression, factory, find, flatMap, - FunctionDeclaration, FunctionExpression, GetAccessorDeclaration, getAllAccessorDeclarations, - getEffectiveModifierFlags, getEmitScriptTarget, getFirstIdentifier, getModuleSpecifierResolverHost, - getNameForExportedSymbol, getNameOfDeclaration, getQuotePreference, getSetAccessorValueParameter, - getSynthesizedDeepClone, getTokenAtPosition, getTsConfigObjectLiteralExpression, Identifier, idText, - IntersectionType, isArrowFunction, isAutoAccessorPropertyDeclaration, isFunctionDeclaration, isFunctionExpression, - isGetAccessorDeclaration, isIdentifier, isImportTypeNode, isInJSFile, isLiteralImportTypeNode, isMethodDeclaration, - isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isSetAccessorDeclaration, - isStringLiteral, isYieldExpression, LanguageServiceHost, length, map, MethodDeclaration, MethodSignature, Modifier, - ModifierFlags, Node, NodeArray, NodeBuilderFlags, NodeFlags, nullTransformationContext, ObjectFlags, - ObjectLiteralExpression, ObjectType, ParameterDeclaration, Program, PropertyAssignment, PropertyDeclaration, - PropertyName, QuotePreference, sameMap, ScriptTarget, SetAccessorDeclaration, setTextRange, Signature, - SignatureDeclaration, signatureHasRestParameter, some, SourceFile, Symbol, SymbolFlags, SymbolTracker, SyntaxKind, - textChanges, TextSpan, textSpanEnd, tryCast, TsConfigSourceFile, Type, TypeChecker, TypeFlags, TypeNode, - TypeParameterDeclaration, UnionType, UserPreferences, visitEachChild, visitNode, + AccessorDeclaration, + ArrowFunction, + Block, + CallExpression, + CharacterCodes, + ClassLikeDeclaration, + CodeFixContextBase, + Debug, + Diagnostics, + EntityName, + Expression, + FunctionDeclaration, + FunctionExpression, + GetAccessorDeclaration, + Identifier, + IntersectionType, + LanguageServiceHost, + MethodDeclaration, + MethodSignature, + Modifier, + ModifierFlags, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + ObjectFlags, + ObjectLiteralExpression, + ObjectType, + ParameterDeclaration, + Program, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + QuotePreference, + ScriptTarget, + SetAccessorDeclaration, + Signature, + SignatureDeclaration, + SourceFile, + Symbol, + SymbolFlags, + SymbolTracker, + SyntaxKind, + TextSpan, + TsConfigSourceFile, + Type, + TypeChecker, + TypeFlags, + TypeNode, + TypeParameterDeclaration, + UnionType, + UserPreferences, + append, + arrayFrom, + emptyArray, + factory, + find, + flatMap, + getAllAccessorDeclarations, + getEffectiveModifierFlags, + getEmitScriptTarget, + getFirstIdentifier, + getModuleSpecifierResolverHost, + getNameForExportedSymbol, + getNameOfDeclaration, + getQuotePreference, + getSetAccessorValueParameter, + getSynthesizedDeepClone, + getTokenAtPosition, + getTsConfigObjectLiteralExpression, + idText, + isArrowFunction, + isAutoAccessorPropertyDeclaration, + isFunctionDeclaration, + isFunctionExpression, + isGetAccessorDeclaration, + isIdentifier, + isImportTypeNode, + isInJSFile, + isLiteralImportTypeNode, + isMethodDeclaration, + isObjectLiteralExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isSetAccessorDeclaration, + isStringLiteral, + isYieldExpression, + length, + map, + nullTransformationContext, + sameMap, + setTextRange, + signatureHasRestParameter, + some, + textChanges, + textSpanEnd, + tryCast, + visitEachChild, + visitNode, } from "../_namespaces/ts"; import { ImportAdder } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 7dc2007c18148..233a148f889b6 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -1,30 +1,146 @@ import { - AnyImportOrRequire, AnyImportOrRequireStatement, AnyImportSyntax, arrayFrom, CancellationToken, cast, CodeAction, - CodeFixAction, CodeFixContextBase, combine, compareBooleans, compareNumberOfDirectorySeparators, compareValues, - Comparison, CompilerOptions, createModuleSpecifierResolutionHost, createMultiMap, createPackageJsonImportFilter, - Debug, DiagnosticAndArguments, Diagnostics, DiagnosticWithLocation, emptyArray, escapeLeadingUnderscores, - every, ExportKind, factory, first, firstDefined, flatMap, flatMapIterator, forEachExternalModuleToImportFrom, - formatting, getAllowSyntheticDefaultImports, getBaseFileName, getDefaultLikeExportInfo, getDirectoryPath, - getEmitModuleKind, getEmitModuleResolutionKind, getEmitScriptTarget, getExportInfoMap, getMeaningFromDeclaration, - getMeaningFromLocation, getNameForExportedSymbol, getNodeId, getQuoteFromPreference, getQuotePreference, - getSourceFileOfNode, getSymbolId, getTokenAtPosition, getTypeKeywordOfTypeOnlyImport, getUniqueSymbolId, - hostGetCanonicalFileName, Identifier, ImportClause, ImportEqualsDeclaration, importFromModuleSpecifier, ImportKind, - ImportsNotUsedAsValues, insertImports, InternalSymbolName, isExternalModule, isExternalModuleReference, - isIdentifier, isIdentifierPart, isIdentifierStart, isImportableFile, isImportEqualsDeclaration, isInJSFile, - isIntrinsicJsxName, isJsxClosingElement, isJsxOpeningFragment, isJsxOpeningLikeElement, isJSXTagName, - isNamedImports, isNamespaceImport, isSourceFileJS, isStringANonContextualKeyword, isStringLiteral, - isStringLiteralLike, isTypeOnlyImportOrExportDeclaration, isUMDExportSymbol, isValidTypeOnlyAliasUseSite, - isVariableDeclarationInitializedToRequire, jsxModeNeedsExplicitImport, LanguageServiceHost, last, makeImport, - makeStringLiteral, mapDefined, memoizeOne, ModuleKind, ModuleResolutionKind, moduleResolutionUsesNodeModules, - moduleSpecifiers, MultiMap, Mutable, NamedImports, Node, NodeFlags, nodeIsMissing, ObjectBindingPattern, - OrganizeImports, PackageJsonImportFilter, Path, pathContainsNodeModules, pathIsBareSpecifier, Program, - QuotePreference, removeFileExtension, removeSuffix, RequireVariableStatement, ScriptTarget, - SemanticMeaning, shouldUseUriStyleNodeCoreModules, single, skipAlias, some, sort, SourceFile, stableSort, - startsWith, StringLiteral, stripQuotes, Symbol, SymbolExportInfo, SymbolFlags, SymbolId, SyntaxKind, textChanges, - toPath, tryCast, tryGetModuleSpecifierFromDeclaration, TypeChecker, TypeOnlyAliasDeclaration, UserPreferences, + AnyImportOrRequire, + AnyImportOrRequireStatement, + AnyImportSyntax, + CancellationToken, + CodeAction, + CodeFixAction, + CodeFixContextBase, + Comparison, + CompilerOptions, + Debug, + DiagnosticAndArguments, + DiagnosticWithLocation, + Diagnostics, + ExportKind, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportKind, + ImportsNotUsedAsValues, + InternalSymbolName, + LanguageServiceHost, + ModuleKind, + ModuleResolutionKind, + MultiMap, + Mutable, + NamedImports, + Node, + NodeFlags, + ObjectBindingPattern, + OrganizeImports, + PackageJsonImportFilter, + Path, + Program, + QuotePreference, + RequireVariableStatement, + ScriptTarget, + SemanticMeaning, + SourceFile, + StringLiteral, + Symbol, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TypeChecker, + TypeOnlyAliasDeclaration, + UserPreferences, + arrayFrom, + cast, + combine, + compareBooleans, + compareNumberOfDirectorySeparators, + compareValues, + createModuleSpecifierResolutionHost, + createMultiMap, + createPackageJsonImportFilter, + emptyArray, + escapeLeadingUnderscores, + every, + factory, + first, + firstDefined, + flatMap, + flatMapIterator, + forEachExternalModuleToImportFrom, + formatting, + getAllowSyntheticDefaultImports, + getBaseFileName, + getDefaultLikeExportInfo, + getDirectoryPath, + getEmitModuleKind, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getExportInfoMap, + getMeaningFromDeclaration, + getMeaningFromLocation, + getNameForExportedSymbol, + getNodeId, + getQuoteFromPreference, + getQuotePreference, + getSourceFileOfNode, + getSymbolId, + getTokenAtPosition, + getTypeKeywordOfTypeOnlyImport, + getUniqueSymbolId, + hostGetCanonicalFileName, + importFromModuleSpecifier, + insertImports, + isExternalModule, + isExternalModuleReference, + isIdentifier, + isIdentifierPart, + isIdentifierStart, + isImportEqualsDeclaration, + isImportableFile, + isInJSFile, + isIntrinsicJsxName, + isJSXTagName, + isJsxClosingElement, + isJsxOpeningFragment, + isJsxOpeningLikeElement, + isNamedImports, + isNamespaceImport, + isSourceFileJS, + isStringANonContextualKeyword, + isStringLiteral, + isStringLiteralLike, + isTypeOnlyImportOrExportDeclaration, + isUMDExportSymbol, + isValidTypeOnlyAliasUseSite, + isVariableDeclarationInitializedToRequire, + jsxModeNeedsExplicitImport, + last, + makeImport, + makeStringLiteral, + mapDefined, + memoizeOne, + moduleResolutionUsesNodeModules, + moduleSpecifiers, + nodeIsMissing, + pathContainsNodeModules, + pathIsBareSpecifier, + removeFileExtension, + removeSuffix, + shouldUseUriStyleNodeCoreModules, + single, + skipAlias, + some, + sort, + stableSort, + startsWith, + stripQuotes, + textChanges, + toPath, + tryCast, + tryGetModuleSpecifierFromDeclaration, } from "../_namespaces/ts"; import { - createCodeFixAction, createCombinedCodeActions, eachDiagnostic, registerCodeFix, + createCodeFixAction, + createCombinedCodeActions, + eachDiagnostic, + registerCodeFix, } from "../_namespaces/ts.codefix"; /** @internal */ diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index dc380a9d901eb..d9604716d1b6f 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -1,23 +1,115 @@ import { - __String, AnonymousType, BinaryExpression, CallExpression, CancellationToken, CaseOrDefaultClause, cast, - createMultiMap, createSymbolTable, Debug, Declaration, DiagnosticMessage, Diagnostics, ElementAccessExpression, - EmitFlags, emptyArray, escapeLeadingUnderscores, Expression, factory, FindAllReferences, findChildOfKind, first, - firstOrUndefined, flatMap, forEach, forEachEntry, getContainingFunction, getEmitScriptTarget, getJSDocType, - getNameOfDeclaration, getObjectFlags, getSourceFileOfNode, getTextOfNode, getTokenAtPosition, - getTypeNodeIfAccessible, Identifier, IndexKind, isArrowFunction, isAssignmentExpression, isCallExpression, - isExpressionNode, isExpressionStatement, isFunctionExpression, isGetAccessorDeclaration, isIdentifier, isInJSFile, - isParameter, isParameterPropertyModifier, isPropertyAccessExpression, isPropertyDeclaration, isPropertySignature, - isRestParameter, isRightSideOfQualifiedNameOrPropertyAccess, isSetAccessorDeclaration, isVariableDeclaration, - isVariableStatement, LanguageServiceHost, last, length, map, mapDefined, mapEntries, NewExpression, Node, - nodeSeenTracker, NodeSeenTracker, ObjectFlags, ParameterDeclaration, PrefixUnaryExpression, PrivateIdentifier, - Program, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertyName, PropertySignature, - returnTrue, ScriptTarget, SetAccessorDeclaration, setEmitFlags, ShorthandPropertyAssignment, Signature, - SignatureDeclaration, SignatureFlags, SignatureKind, singleOrUndefined, SourceFile, Symbol, SymbolFlags, - SymbolLinks, SyntaxKind, textChanges, Token, TransientSymbol, tryCast, Type, TypeFlags, TypeNode, TypeReference, - UnderscoreEscapedMap, UnionOrIntersectionType, UnionReduction, UserPreferences, VariableDeclaration, + AnonymousType, + BinaryExpression, + CallExpression, + CancellationToken, + CaseOrDefaultClause, + Debug, + Declaration, + DiagnosticMessage, + Diagnostics, + ElementAccessExpression, + EmitFlags, + Expression, + FindAllReferences, + Identifier, + IndexKind, + LanguageServiceHost, + NewExpression, + Node, + NodeSeenTracker, + ObjectFlags, + ParameterDeclaration, + PrefixUnaryExpression, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyName, + PropertySignature, + ScriptTarget, + SetAccessorDeclaration, + ShorthandPropertyAssignment, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SourceFile, + Symbol, + SymbolFlags, + SymbolLinks, + SyntaxKind, + Token, + TransientSymbol, + Type, + TypeFlags, + TypeNode, + TypeReference, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionReduction, + UserPreferences, + VariableDeclaration, + __String, + cast, + createMultiMap, + createSymbolTable, + emptyArray, + escapeLeadingUnderscores, + factory, + findChildOfKind, + first, + firstOrUndefined, + flatMap, + forEach, + forEachEntry, + getContainingFunction, + getEmitScriptTarget, + getJSDocType, + getNameOfDeclaration, + getObjectFlags, + getSourceFileOfNode, + getTextOfNode, + getTokenAtPosition, + getTypeNodeIfAccessible, + isArrowFunction, + isAssignmentExpression, + isCallExpression, + isExpressionNode, + isExpressionStatement, + isFunctionExpression, + isGetAccessorDeclaration, + isIdentifier, + isInJSFile, + isParameter, + isParameterPropertyModifier, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isRestParameter, + isRightSideOfQualifiedNameOrPropertyAccess, + isSetAccessorDeclaration, + isVariableDeclaration, + isVariableStatement, + last, + length, + map, + mapDefined, + mapEntries, + nodeSeenTracker, + returnTrue, + setEmitFlags, + singleOrUndefined, + textChanges, + tryCast, } from "../_namespaces/ts"; import { - codeFixAll, createCodeFixAction, createImportAdder, ImportAdder, registerCodeFix, + ImportAdder, + codeFixAll, + createCodeFixAction, + createImportAdder, + registerCodeFix, tryGetAutoImportableReferenceFromTypeNode, } from "../_namespaces/ts.codefix"; diff --git a/src/services/codefixes/removeAccidentalCallParentheses.ts b/src/services/codefixes/removeAccidentalCallParentheses.ts index b12146f562864..c4ad5c9ea3721 100644 --- a/src/services/codefixes/removeAccidentalCallParentheses.ts +++ b/src/services/codefixes/removeAccidentalCallParentheses.ts @@ -1,5 +1,14 @@ -import { Diagnostics, findAncestor, getTokenAtPosition, isCallExpression, textChanges } from "../_namespaces/ts"; -import { createCodeFixActionWithoutFixAll, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + Diagnostics, + findAncestor, + getTokenAtPosition, + isCallExpression, + textChanges, +} from "../_namespaces/ts"; +import { + createCodeFixActionWithoutFixAll, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "removeAccidentalCallParentheses"; const errorCodes = [ diff --git a/src/services/codefixes/removeUnnecessaryAwait.ts b/src/services/codefixes/removeUnnecessaryAwait.ts index 6508b0fc8895b..0c6b2a243a98c 100644 --- a/src/services/codefixes/removeUnnecessaryAwait.ts +++ b/src/services/codefixes/removeUnnecessaryAwait.ts @@ -1,8 +1,24 @@ import { - AwaitKeywordToken, Diagnostics, findPrecedingToken, getLeftmostExpression, getTokenAtPosition, isAwaitExpression, - isIdentifier, isParenthesizedExpression, Node, SourceFile, SyntaxKind, textChanges, TextSpan, tryCast, + AwaitKeywordToken, + Diagnostics, + Node, + SourceFile, + SyntaxKind, + TextSpan, + findPrecedingToken, + getLeftmostExpression, + getTokenAtPosition, + isAwaitExpression, + isIdentifier, + isParenthesizedExpression, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "removeUnnecessaryAwait"; const errorCodes = [ diff --git a/src/services/codefixes/requireInTs.ts b/src/services/codefixes/requireInTs.ts index 8bd23cb737357..45cabbb7134d2 100644 --- a/src/services/codefixes/requireInTs.ts +++ b/src/services/codefixes/requireInTs.ts @@ -1,9 +1,32 @@ import { - cast, Debug, Diagnostics, factory, first, getAllowSyntheticDefaultImports, getTokenAtPosition, Identifier, - ImportSpecifier, isIdentifier, isObjectBindingPattern, isRequireCall, isVariableDeclaration, isVariableStatement, - NamedImports, ObjectBindingPattern, Program, SourceFile, StringLiteralLike, textChanges, tryCast, VariableStatement, + Debug, + Diagnostics, + Identifier, + ImportSpecifier, + NamedImports, + ObjectBindingPattern, + Program, + SourceFile, + StringLiteralLike, + VariableStatement, + cast, + factory, + first, + getAllowSyntheticDefaultImports, + getTokenAtPosition, + isIdentifier, + isObjectBindingPattern, + isRequireCall, + isVariableDeclaration, + isVariableStatement, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "requireInTs"; const errorCodes = [Diagnostics.require_call_may_be_converted_to_an_import.code]; diff --git a/src/services/codefixes/returnValueCorrect.ts b/src/services/codefixes/returnValueCorrect.ts index f27cdb2470cb7..b56d81e7ad2d7 100644 --- a/src/services/codefixes/returnValueCorrect.ts +++ b/src/services/codefixes/returnValueCorrect.ts @@ -1,12 +1,50 @@ import { - append, ArrowFunction, CodeFixContext, copyComments, createSymbolTable, Debug, Diagnostics, Expression, factory, - findAncestor, first, FunctionLikeDeclaration, getTokenAtPosition, hasSyntacticModifier, Identifier, isArrowFunction, - isBlock, isCallExpression, isDeclarationName, isExpressionStatement, isFunctionLikeDeclaration, isJsxAttribute, - isJsxExpression, isLabeledStatement, isVariableLike, length, ModifierFlags, needsParentheses, Node, - probablyUsesSemicolons, rangeContainsRange, SourceFile, Statement, suppressLeadingAndTrailingTrivia, SymbolFlags, - SyntaxKind, textChanges, Type, TypeChecker, VariableLikeDeclaration, + ArrowFunction, + CodeFixContext, + Debug, + Diagnostics, + Expression, + FunctionLikeDeclaration, + Identifier, + ModifierFlags, + Node, + SourceFile, + Statement, + SymbolFlags, + SyntaxKind, + Type, + TypeChecker, + VariableLikeDeclaration, + append, + copyComments, + createSymbolTable, + factory, + findAncestor, + first, + getTokenAtPosition, + hasSyntacticModifier, + isArrowFunction, + isBlock, + isCallExpression, + isDeclarationName, + isExpressionStatement, + isFunctionLikeDeclaration, + isJsxAttribute, + isJsxExpression, + isLabeledStatement, + isVariableLike, + length, + needsParentheses, + probablyUsesSemicolons, + rangeContainsRange, + suppressLeadingAndTrailingTrivia, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "returnValueCorrect"; const fixIdAddReturnStatement = "fixAddReturnStatement"; diff --git a/src/services/codefixes/splitTypeOnlyImport.ts b/src/services/codefixes/splitTypeOnlyImport.ts index 1a15a46b61ea7..5bca880f21e30 100644 --- a/src/services/codefixes/splitTypeOnlyImport.ts +++ b/src/services/codefixes/splitTypeOnlyImport.ts @@ -1,8 +1,21 @@ import { - CodeFixContextBase, Debug, Diagnostics, factory, findAncestor, getTokenAtPosition, ImportDeclaration, - isImportDeclaration, SourceFile, textChanges, TextSpan, + CodeFixContextBase, + Debug, + Diagnostics, + ImportDeclaration, + SourceFile, + TextSpan, + factory, + findAncestor, + getTokenAtPosition, + isImportDeclaration, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const errorCodes = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code]; const fixId = "splitTypeOnlyImport"; diff --git a/src/services/codefixes/useBigintLiteral.ts b/src/services/codefixes/useBigintLiteral.ts index 4dd32727965e0..093e3ce400e5a 100644 --- a/src/services/codefixes/useBigintLiteral.ts +++ b/src/services/codefixes/useBigintLiteral.ts @@ -1,7 +1,18 @@ import { - Diagnostics, factory, getTokenAtPosition, isNumericLiteral, SourceFile, textChanges, TextSpan, tryCast, + Diagnostics, + SourceFile, + TextSpan, + factory, + getTokenAtPosition, + isNumericLiteral, + textChanges, + tryCast, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "useBigintLiteral"; const errorCodes = [ diff --git a/src/services/codefixes/useDefaultImport.ts b/src/services/codefixes/useDefaultImport.ts index 2ea1b66abe515..4219714e0d7e4 100644 --- a/src/services/codefixes/useDefaultImport.ts +++ b/src/services/codefixes/useDefaultImport.ts @@ -1,9 +1,24 @@ import { - AnyImportSyntax, Diagnostics, Expression, getQuotePreference, getTokenAtPosition, Identifier, - isExternalModuleReference, isIdentifier, isImportEqualsDeclaration, isNamespaceImport, makeImport, SourceFile, - textChanges, UserPreferences, + AnyImportSyntax, + Diagnostics, + Expression, + Identifier, + SourceFile, + UserPreferences, + getQuotePreference, + getTokenAtPosition, + isExternalModuleReference, + isIdentifier, + isImportEqualsDeclaration, + isNamespaceImport, + makeImport, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixId = "useDefaultImport"; const errorCodes = [Diagnostics.Import_may_be_converted_to_a_default_import.code]; diff --git a/src/services/codefixes/wrapJsxInFragment.ts b/src/services/codefixes/wrapJsxInFragment.ts index 68c8760a18f28..bc488d5e0802c 100644 --- a/src/services/codefixes/wrapJsxInFragment.ts +++ b/src/services/codefixes/wrapJsxInFragment.ts @@ -1,8 +1,22 @@ import { - BinaryExpression, Diagnostics, factory, getTokenAtPosition, isBinaryExpression, isJsxChild, JsxChild, Node, - nodeIsMissing, SourceFile, SyntaxKind, textChanges, + BinaryExpression, + Diagnostics, + JsxChild, + Node, + SourceFile, + SyntaxKind, + factory, + getTokenAtPosition, + isBinaryExpression, + isJsxChild, + nodeIsMissing, + textChanges, } from "../_namespaces/ts"; -import { codeFixAll, createCodeFixAction, registerCodeFix } from "../_namespaces/ts.codefix"; +import { + codeFixAll, + createCodeFixAction, + registerCodeFix, +} from "../_namespaces/ts.codefix"; const fixID = "wrapJsxInFragment"; const errorCodes = [Diagnostics.JSX_expressions_must_have_one_parent_element.code]; diff --git a/src/services/completions.ts b/src/services/completions.ts index 80c5e022a614e..4a0e1097cb1cd 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,64 +1,336 @@ import { - __String, addToSeen, append, BinaryExpression, BreakOrContinueStatement, CancellationToken, cast, CharacterCodes, - ClassElement, CodeAction, codefix, compareNumberOfDirectorySeparators, compareStringsCaseSensitiveUI, - compareTextSpans, Comparison, CompilerOptions, compilerOptionsIndicateEsModules, CompletionEntry, - CompletionEntryData, CompletionEntryDataAutoImport, CompletionEntryDataResolved, CompletionEntryDataUnresolved, - CompletionEntryDetails, CompletionEntryLabelDetails, CompletionInfo, CompletionInfoFlags, - CompletionsTriggerCharacter, CompletionTriggerKind, concatenate, ConstructorDeclaration, ContextFlags, - createModuleSpecifierResolutionHost, createPackageJsonImportFilter, createPrinter, createSortedArray, - createTextRangeFromSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, Debug, - Declaration, Diagnostics, diagnosticToString, displayPart, EmitHint, EmitTextWriter, escapeSnippetText, every, - ExportKind, Expression, factory, filter, find, findAncestor, findChildOfKind, findPrecedingToken, first, - firstDefined, flatMap, formatting, FunctionLikeDeclaration, getAllSuperTypeNodes, getAncestor, - getCombinedLocalAndExportSymbolFlags, getContainingClass, getContextualTypeFromParent, - getDeclarationModifierFlagsFromSymbol, getEffectiveBaseTypeNode, getEffectiveModifierFlags, - getEffectiveTypeAnnotationNode, getEmitModuleResolutionKind, getEmitScriptTarget, - getEscapedTextOfIdentifierOrLiteral, getExportInfoMap, getFormatCodeSettingsForWriting, getLanguageVariant, - getLeftmostAccessExpression, getLineAndCharacterOfPosition, getLineStartPositionForPosition, - getLocalSymbolForExportDefault, getNameForExportedSymbol, getNameOfDeclaration, getNameTable, getNewLineCharacter, - getNewLineKind, getPropertyNameForPropertyNameNode, getQuotePreference, getReplacementSpanForContextToken, - getRootDeclaration, getSourceFileOfModule, getSwitchedType, getSymbolId, getSynthesizedDeepClone, - getTokenAtPosition, getTouchingPropertyName, hasDocComment, hasEffectiveModifier, hasInitializer, hasType, - Identifier, ImportDeclaration, ImportEqualsDeclaration, ImportKind, ImportOrExportSpecifier, ImportSpecifier, - ImportTypeNode, IncompleteCompletionsCache, insertSorted, InternalSymbolName, isAbstractConstructorSymbol, - isArrowFunction, isAssertionExpression, isBigIntLiteral, isBinaryExpression, isBindingElement, isBindingPattern, - isBreakOrContinueStatement, isCallExpression, isCaseClause, isCheckJsEnabledForFile, isClassElement, isClassLike, - isClassMemberModifier, isClassOrTypeElement, isClassStaticBlockDeclaration, isComputedPropertyName, - isConstructorDeclaration, isContextualKeyword, isDeclarationName, isDeprecatedDeclaration, isEntityName, - isEqualityOperatorKind, isExportAssignment, isExportDeclaration, isExpression, isExternalModuleNameRelative, - isExternalModuleReference, isExternalModuleSymbol, isFunctionBlock, isFunctionLike, isFunctionLikeDeclaration, - isFunctionLikeKind, isFunctionTypeNode, isIdentifier, isIdentifierText, isImportableFile, isImportDeclaration, - isImportEqualsDeclaration, isImportKeyword, isImportSpecifier, isInComment, isInitializedProperty, isInJSFile, - isInRightSideOfInternalImportEqualsDeclaration, isInString, isIntersectionTypeNode, isJSDoc, isJSDocParameterTag, - isJSDocTag, isJSDocTemplateTag, isJsxAttribute, isJsxClosingElement, isJsxElement, isJsxExpression, isJsxFragment, - isJsxOpeningLikeElement, isJsxSpreadAttribute, isKeyword, isKnownSymbol, isLabeledStatement, - isLiteralImportTypeNode, isMemberName, isMethodDeclaration, isModifier, isModifierKind, isModuleDeclaration, - isNamedExports, isNamedImports, isNamedImportsOrExports, isNamespaceImport, isObjectBindingPattern, - isObjectLiteralExpression, isObjectTypeDeclaration, isParameter, isParameterPropertyModifier, isPartOfTypeNode, - isPossiblyTypeArgumentPosition, isPrivateIdentifier, isPrivateIdentifierClassElementDeclaration, - isPropertyAccessExpression, isPropertyDeclaration, isPropertyNameLiteral, isRegularExpressionLiteral, - isShorthandPropertyAssignment, isSingleOrDoubleQuote, isSourceFile, isSourceFileJS, isSpreadAssignment, isStatement, - isStatic, isString, isStringANonContextualKeyword, isStringLiteralLike, isStringLiteralOrTemplate, - isStringTextContainingNode, isSyntaxList, isTypeKeyword, isTypeKeywordTokenOrIdentifier, isTypeLiteralNode, - isTypeNode, isTypeOfExpression, isTypeOnlyImportOrExportDeclaration, isTypeReferenceType, - isValidTypeOnlyAliasUseSite, isVariableDeclaration, isVariableLike, JsDoc, JSDocParameterTag, JSDocPropertyTag, - JSDocReturnTag, JSDocTag, JSDocTagInfo, JSDocTemplateTag, JSDocTypedefTag, JSDocTypeExpression, JSDocTypeTag, - JsTyping, JsxAttribute, JsxAttributes, JsxClosingElement, JsxElement, JsxOpeningLikeElement, JsxSpreadAttribute, - LanguageServiceHost, LanguageVariant, last, lastOrUndefined, length, ListFormat, mapDefined, maybeBind, - MemberOverrideStatus, memoize, memoizeOne, MethodDeclaration, ModifierFlags, modifiersToFlags, ModifierSyntaxKind, - modifierToFlag, ModuleDeclaration, ModuleReference, moduleResolutionRespectsExports, NamedImportBindings, Node, - NodeArray, NodeBuilderFlags, NodeFlags, nodeIsMissing, ObjectBindingPattern, ObjectLiteralExpression, ObjectType, - ObjectTypeDeclaration, or, positionBelongsToNode, positionIsASICandidate, positionsAreOnSameLine, PrinterOptions, - probablyUsesSemicolons, Program, programContainsModules, PropertyAccessExpression, PropertyDeclaration, - PropertyName, PseudoBigInt, pseudoBigIntToString, QualifiedName, quote, QuotePreference, rangeContainsPosition, - rangeContainsPositionExclusive, rangeIsOnSingleLine, ScriptElementKind, ScriptElementKindModifier, ScriptTarget, - SemanticMeaning, setSnippetElement, shouldUseUriStyleNodeCoreModules, SignatureHelp, SignatureKind, - singleElementArray, skipAlias, SnippetKind, some, SortedArray, SourceFile, SpreadAssignment, stableSort, startsWith, - stringToToken, stripQuotes, Symbol, SymbolDisplay, SymbolDisplayPart, SymbolDisplayPartKind, SymbolExportInfo, - SymbolFlags, SymbolId, SyntaxKind, TextChange, textChanges, textPart, TextRange, TextSpan, timestamp, Token, - TokenSyntaxKind, tokenToString, tryCast, tryGetImportFromModuleSpecifier, Type, TypeChecker, TypeElement, TypeFlags, - typeHasCallOrConstructSignatures, TypeLiteralNode, TypeOnlyAliasDeclaration, unescapeLeadingUnderscores, - UnionReduction, UnionType, UserPreferences, VariableDeclaration, walkUpParenthesizedExpressions, + BinaryExpression, + BreakOrContinueStatement, + CancellationToken, + CharacterCodes, + ClassElement, + CodeAction, + Comparison, + CompilerOptions, + CompletionEntry, + CompletionEntryData, + CompletionEntryDataAutoImport, + CompletionEntryDataResolved, + CompletionEntryDataUnresolved, + CompletionEntryDetails, + CompletionEntryLabelDetails, + CompletionInfo, + CompletionInfoFlags, + CompletionTriggerKind, + CompletionsTriggerCharacter, + ConstructorDeclaration, + ContextFlags, + Debug, + Declaration, + Diagnostics, + EmitHint, + EmitTextWriter, + ExportKind, + Expression, + FunctionLikeDeclaration, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + ImportKind, + ImportOrExportSpecifier, + ImportSpecifier, + ImportTypeNode, + IncompleteCompletionsCache, + InternalSymbolName, + JSDocParameterTag, + JSDocPropertyTag, + JSDocReturnTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypeExpression, + JSDocTypeTag, + JSDocTypedefTag, + JsDoc, + JsTyping, + JsxAttribute, + JsxAttributes, + JsxClosingElement, + JsxElement, + JsxOpeningLikeElement, + JsxSpreadAttribute, + LanguageServiceHost, + LanguageVariant, + ListFormat, + MemberOverrideStatus, + MethodDeclaration, + ModifierFlags, + ModifierSyntaxKind, + ModuleDeclaration, + ModuleReference, + NamedImportBindings, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + ObjectBindingPattern, + ObjectLiteralExpression, + ObjectType, + ObjectTypeDeclaration, + PrinterOptions, + Program, + PropertyAccessExpression, + PropertyDeclaration, + PropertyName, + PseudoBigInt, + QualifiedName, + QuotePreference, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + SemanticMeaning, + SignatureHelp, + SignatureKind, + SnippetKind, + SortedArray, + SourceFile, + SpreadAssignment, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolExportInfo, + SymbolFlags, + SymbolId, + SyntaxKind, + TextChange, + TextRange, + TextSpan, + Token, + TokenSyntaxKind, + Type, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeOnlyAliasDeclaration, + UnionReduction, + UnionType, + UserPreferences, + VariableDeclaration, + __String, + addToSeen, + append, + cast, + codefix, + compareNumberOfDirectorySeparators, + compareStringsCaseSensitiveUI, + compareTextSpans, + compilerOptionsIndicateEsModules, + concatenate, + createModuleSpecifierResolutionHost, + createPackageJsonImportFilter, + createPrinter, + createSortedArray, + createTextRangeFromSpan, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + diagnosticToString, + displayPart, + escapeSnippetText, + every, + factory, + filter, + find, + findAncestor, + findChildOfKind, + findPrecedingToken, + first, + firstDefined, + flatMap, + formatting, + getAllSuperTypeNodes, + getAncestor, + getCombinedLocalAndExportSymbolFlags, + getContainingClass, + getContextualTypeFromParent, + getDeclarationModifierFlagsFromSymbol, + getEffectiveBaseTypeNode, + getEffectiveModifierFlags, + getEffectiveTypeAnnotationNode, + getEmitModuleResolutionKind, + getEmitScriptTarget, + getEscapedTextOfIdentifierOrLiteral, + getExportInfoMap, + getFormatCodeSettingsForWriting, + getLanguageVariant, + getLeftmostAccessExpression, + getLineAndCharacterOfPosition, + getLineStartPositionForPosition, + getLocalSymbolForExportDefault, + getNameForExportedSymbol, + getNameOfDeclaration, + getNameTable, + getNewLineCharacter, + getNewLineKind, + getPropertyNameForPropertyNameNode, + getQuotePreference, + getReplacementSpanForContextToken, + getRootDeclaration, + getSourceFileOfModule, + getSwitchedType, + getSymbolId, + getSynthesizedDeepClone, + getTokenAtPosition, + getTouchingPropertyName, + hasDocComment, + hasEffectiveModifier, + hasInitializer, + hasType, + insertSorted, + isAbstractConstructorSymbol, + isArrowFunction, + isAssertionExpression, + isBigIntLiteral, + isBinaryExpression, + isBindingElement, + isBindingPattern, + isBreakOrContinueStatement, + isCallExpression, + isCaseClause, + isCheckJsEnabledForFile, + isClassElement, + isClassLike, + isClassMemberModifier, + isClassOrTypeElement, + isClassStaticBlockDeclaration, + isComputedPropertyName, + isConstructorDeclaration, + isContextualKeyword, + isDeclarationName, + isDeprecatedDeclaration, + isEntityName, + isEqualityOperatorKind, + isExportAssignment, + isExportDeclaration, + isExpression, + isExternalModuleNameRelative, + isExternalModuleReference, + isExternalModuleSymbol, + isFunctionBlock, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionLikeKind, + isFunctionTypeNode, + isIdentifier, + isIdentifierText, + isImportDeclaration, + isImportEqualsDeclaration, + isImportKeyword, + isImportSpecifier, + isImportableFile, + isInComment, + isInJSFile, + isInRightSideOfInternalImportEqualsDeclaration, + isInString, + isInitializedProperty, + isIntersectionTypeNode, + isJSDoc, + isJSDocParameterTag, + isJSDocTag, + isJSDocTemplateTag, + isJsxAttribute, + isJsxClosingElement, + isJsxElement, + isJsxExpression, + isJsxFragment, + isJsxOpeningLikeElement, + isJsxSpreadAttribute, + isKeyword, + isKnownSymbol, + isLabeledStatement, + isLiteralImportTypeNode, + isMemberName, + isMethodDeclaration, + isModifier, + isModifierKind, + isModuleDeclaration, + isNamedExports, + isNamedImports, + isNamedImportsOrExports, + isNamespaceImport, + isObjectBindingPattern, + isObjectLiteralExpression, + isObjectTypeDeclaration, + isParameter, + isParameterPropertyModifier, + isPartOfTypeNode, + isPossiblyTypeArgumentPosition, + isPrivateIdentifier, + isPrivateIdentifierClassElementDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertyNameLiteral, + isRegularExpressionLiteral, + isShorthandPropertyAssignment, + isSingleOrDoubleQuote, + isSourceFile, + isSourceFileJS, + isSpreadAssignment, + isStatement, + isStatic, + isString, + isStringANonContextualKeyword, + isStringLiteralLike, + isStringLiteralOrTemplate, + isStringTextContainingNode, + isSyntaxList, + isTypeKeyword, + isTypeKeywordTokenOrIdentifier, + isTypeLiteralNode, + isTypeNode, + isTypeOfExpression, + isTypeOnlyImportOrExportDeclaration, + isTypeReferenceType, + isValidTypeOnlyAliasUseSite, + isVariableDeclaration, + isVariableLike, + last, + lastOrUndefined, + length, + mapDefined, + maybeBind, + memoize, + memoizeOne, + modifierToFlag, + modifiersToFlags, + moduleResolutionRespectsExports, + nodeIsMissing, + or, + positionBelongsToNode, + positionIsASICandidate, + positionsAreOnSameLine, + probablyUsesSemicolons, + programContainsModules, + pseudoBigIntToString, + quote, + rangeContainsPosition, + rangeContainsPositionExclusive, + rangeIsOnSingleLine, + setSnippetElement, + shouldUseUriStyleNodeCoreModules, + singleElementArray, + skipAlias, + some, + stableSort, + startsWith, + stringToToken, + stripQuotes, + textChanges, + textPart, + timestamp, + tokenToString, + tryCast, + tryGetImportFromModuleSpecifier, + typeHasCallOrConstructSignatures, + unescapeLeadingUnderscores, + walkUpParenthesizedExpressions, } from "./_namespaces/ts"; import { StringCompletions } from "./_namespaces/ts.Completions"; diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index ddd211eeaf3fa..dce36fc57044c 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -1,16 +1,84 @@ import { - __String, arrayFrom, arrayToMultiMap, Block, BreakOrContinueStatement, CancellationToken, CaseClause, cast, - concatenate, ConstructorDeclaration, contains, createGetCanonicalFileName, createTextSpanFromBounds, - createTextSpanFromNode, Debug, DefaultClause, find, FindAllReferences, findAncestor, findChildOfKind, findModifier, - forEach, forEachChild, forEachReturnStatement, FunctionDeclaration, FunctionLikeDeclaration, getContainingFunction, - getTouchingPropertyName, HighlightSpan, HighlightSpanKind, IfStatement, isAccessor, isAwaitExpression, isBlock, - isBreakOrContinueStatement, isCaseClause, isClassDeclaration, isClassLike, isConstructorDeclaration, isDeclaration, - isDefaultClause, isFunctionBlock, isFunctionLike, isIfStatement, isInterfaceDeclaration, isIterationStatement, - isJsxClosingElement, isJsxOpeningElement, isLabeledStatement, isModifierKind, isModuleDeclaration, - isReturnStatement, isSwitchStatement, isThrowStatement, isTryStatement, isTypeAliasDeclaration, isTypeNode, - isVariableStatement, isWhiteSpaceSingleLine, isYieldExpression, IterationStatement, mapDefined, MethodDeclaration, - Modifier, ModifierFlags, modifierToFlag, ModuleBlock, Node, ObjectLiteralExpression, ObjectTypeDeclaration, Program, - Push, ReturnStatement, SourceFile, SwitchStatement, SyntaxKind, ThrowStatement, toArray, toPath, TryStatement, + Block, + BreakOrContinueStatement, + CancellationToken, + CaseClause, + ConstructorDeclaration, + Debug, + DefaultClause, + FindAllReferences, + FunctionDeclaration, + FunctionLikeDeclaration, + HighlightSpan, + HighlightSpanKind, + IfStatement, + IterationStatement, + MethodDeclaration, + Modifier, + ModifierFlags, + ModuleBlock, + Node, + ObjectLiteralExpression, + ObjectTypeDeclaration, + Program, + Push, + ReturnStatement, + SourceFile, + SwitchStatement, + SyntaxKind, + ThrowStatement, + TryStatement, + __String, + arrayFrom, + arrayToMultiMap, + cast, + concatenate, + contains, + createGetCanonicalFileName, + createTextSpanFromBounds, + createTextSpanFromNode, + find, + findAncestor, + findChildOfKind, + findModifier, + forEach, + forEachChild, + forEachReturnStatement, + getContainingFunction, + getTouchingPropertyName, + isAccessor, + isAwaitExpression, + isBlock, + isBreakOrContinueStatement, + isCaseClause, + isClassDeclaration, + isClassLike, + isConstructorDeclaration, + isDeclaration, + isDefaultClause, + isFunctionBlock, + isFunctionLike, + isIfStatement, + isInterfaceDeclaration, + isIterationStatement, + isJsxClosingElement, + isJsxOpeningElement, + isLabeledStatement, + isModifierKind, + isModuleDeclaration, + isReturnStatement, + isSwitchStatement, + isThrowStatement, + isTryStatement, + isTypeAliasDeclaration, + isTypeNode, + isVariableStatement, + isWhiteSpaceSingleLine, + isYieldExpression, + mapDefined, + modifierToFlag, + toArray, + toPath, } from "./_namespaces/ts"; export interface DocumentHighlights { diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 022f3147a2452..f06edbcf41433 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -1,9 +1,34 @@ import { - arrayFrom, CompilerOptions, createGetCanonicalFileName, createLanguageServiceSourceFile, CreateSourceFileOptions, - Debug, ensureScriptKind, firstDefinedIterator, forEachEntry, getCompilerOptionValue, getEmitScriptTarget, - getImpliedNodeFormatForFile, getOrUpdate, getSetExternalModuleIndicator, hasProperty, identity, isArray, - IScriptSnapshot, isDeclarationFileName, map, MinimalResolutionCacheHost, Path, ResolutionMode, ScriptKind, - ScriptTarget, SourceFile, sourceFileAffectingCompilerOptions, toPath, tracing, updateLanguageServiceSourceFile, + CompilerOptions, + CreateSourceFileOptions, + Debug, + IScriptSnapshot, + MinimalResolutionCacheHost, + Path, + ResolutionMode, + ScriptKind, + ScriptTarget, + SourceFile, + arrayFrom, + createGetCanonicalFileName, + createLanguageServiceSourceFile, + ensureScriptKind, + firstDefinedIterator, + forEachEntry, + getCompilerOptionValue, + getEmitScriptTarget, + getImpliedNodeFormatForFile, + getOrUpdate, + getSetExternalModuleIndicator, + hasProperty, + identity, + isArray, + isDeclarationFileName, + map, + sourceFileAffectingCompilerOptions, + toPath, + tracing, + updateLanguageServiceSourceFile, } from "./_namespaces/ts"; /** diff --git a/src/services/exportInfoMap.ts b/src/services/exportInfoMap.ts index 2abd6214159bf..56fd00c2ae786 100644 --- a/src/services/exportInfoMap.ts +++ b/src/services/exportInfoMap.ts @@ -1,15 +1,64 @@ import { - __String, addToSeen, arrayIsEqualTo, CancellationToken, CompilerOptions, consumesNodeCoreModules, createMultiMap, - Debug, emptyArray, findIndex, firstDefined, forEachAncestorDirectory, forEachEntry, getBaseFileName, - GetCanonicalFileName, getDirectoryPath, getLocalSymbolForExportDefault, getNameForExportedSymbol, - getNamesForExportedSymbol, getNodeModulePathParts, getPackageNameFromTypesPackageName, getPatternFromSpec, - getRegexFromPattern, getSymbolId, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, InternalSymbolName, - isExportAssignment, isExportSpecifier, isExternalModuleNameRelative, isExternalModuleSymbol, - isExternalOrCommonJsModule, isIdentifier, isKnownSymbol, isNonGlobalAmbientModule, isPrivateIdentifierSymbol, - LanguageServiceHost, mapDefined, ModuleSpecifierCache, ModuleSpecifierResolutionHost, moduleSpecifiers, - nodeModulesPathPart, PackageJsonImportFilter, Path, Program, skipAlias, skipOuterExpressions, SourceFile, - startsWith, Statement, stringContains, stripQuotes, Symbol, SymbolFlags, timestamp, tryCast, TypeChecker, - unescapeLeadingUnderscores, unmangleScopedPackageName, UserPreferences, + CancellationToken, + CompilerOptions, + Debug, + GetCanonicalFileName, + InternalSymbolName, + LanguageServiceHost, + ModuleSpecifierCache, + ModuleSpecifierResolutionHost, + PackageJsonImportFilter, + Path, + Program, + SourceFile, + Statement, + Symbol, + SymbolFlags, + TypeChecker, + UserPreferences, + __String, + addToSeen, + arrayIsEqualTo, + consumesNodeCoreModules, + createMultiMap, + emptyArray, + findIndex, + firstDefined, + forEachAncestorDirectory, + forEachEntry, + getBaseFileName, + getDirectoryPath, + getLocalSymbolForExportDefault, + getNameForExportedSymbol, + getNamesForExportedSymbol, + getNodeModulePathParts, + getPackageNameFromTypesPackageName, + getPatternFromSpec, + getRegexFromPattern, + getSymbolId, + hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, + isExportAssignment, + isExportSpecifier, + isExternalModuleNameRelative, + isExternalModuleSymbol, + isExternalOrCommonJsModule, + isIdentifier, + isKnownSymbol, + isNonGlobalAmbientModule, + isPrivateIdentifierSymbol, + mapDefined, + moduleSpecifiers, + nodeModulesPathPart, + skipAlias, + skipOuterExpressions, + startsWith, + stringContains, + stripQuotes, + timestamp, + tryCast, + unescapeLeadingUnderscores, + unmangleScopedPackageName, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 041c9d16cf709..a0d9c1088c562 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,53 +1,252 @@ import { - __String, addToSeen, append, AssignmentDeclarationKind, BinaryExpression, BindingElement, Block, CallExpression, - CancellationToken, cast, CheckFlags, ClassLikeDeclaration, climbPastPropertyAccess, compareValues, - ConstructorDeclaration, contains, createQueue, createTextSpan, createTextSpanFromBounds, createTextSpanFromRange, - Debug, Declaration, displayPart, DocumentSpan, emptyArray, emptyOptions, escapeLeadingUnderscores, - ExportSpecifier, Expression, FileIncludeReason, FileReference, filter, find, findAncestor, findChildOfKind, - findIndex, first, firstDefined, firstOrUndefined, flatMap, forEachChild, forEachReturnStatement, ForInOrOfStatement, - FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, GetAccessorDeclaration, - getAdjustedReferenceLocation, getAdjustedRenameLocation, getAllSuperTypeNodes, getAncestor, - getAssignmentDeclarationKind, getCheckFlags, getContainerNode, getContainingObjectLiteralElement, - getContextualTypeFromParentOrAncestorTypeNode, getDeclarationFromName, getDeclarationOfKind, - getEffectiveModifierFlags, getLocalSymbolForExportDefault, getMeaningFromDeclaration, getMeaningFromLocation, - getModeForUsageLocation, getNameOfDeclaration, getNameTable, getNextJSDocCommentLocation, getNodeId, getNodeKind, - getPropertySymbolFromBindingElement, getPropertySymbolsFromContextualType, getReferencedFileLocation, - getSuperContainer, getSymbolId, getSyntacticModifierFlags, getTargetLabel, getTextOfNode, getThisContainer, - getTouchingPropertyName, GoToDefinition, hasEffectiveModifier, hasInitializer, hasSyntacticModifier, hasType, - HighlightSpan, HighlightSpanKind, Identifier, ImplementationLocation, InterfaceDeclaration, InternalSymbolName, - isAccessExpression, isArrayLiteralOrObjectLiteralDestructuringPattern, isAssertionExpression, isBinaryExpression, - isBindableObjectDefinePropertyCall, isBindingElement, isBreakOrContinueStatement, isCallExpression, - isCallExpressionTarget, isCatchClause, isClassLike, isClassStaticBlockDeclaration, isComputedPropertyName, - isConstructorDeclaration, isDeclaration, isDeclarationName, isExportAssignment, isExportSpecifier, - isExpressionOfExternalModuleImportEqualsDeclaration, isExpressionStatement, isExpressionWithTypeArguments, - isExternalModule, isExternalModuleSymbol, isExternalOrCommonJsModule, isForInOrOfStatement, isFunctionExpression, - isFunctionLike, isFunctionLikeDeclaration, isIdentifier, isIdentifierPart, isImportMeta, isImportOrExportSpecifier, - isImportSpecifier, isImportTypeNode, isInJSFile, isInNonReferenceComment, isInString, isInterfaceDeclaration, - isJSDocMemberName, isJSDocTag, isJsxClosingElement, isJsxOpeningElement, isJsxSelfClosingElement, - isJumpStatementTarget, isLabeledStatement, isLabelOfLabeledStatement, isLiteralComputedPropertyDeclarationName, - isLiteralNameOfPropertyDeclarationOrIndexAccess, isLiteralTypeNode, isMethodOrAccessor, isModuleDeclaration, - isModuleExportsAccessExpression, isModuleOrEnumDeclaration, isModuleSpecifierLike, isNameOfModuleDeclaration, - isNamespaceExportDeclaration, isNewExpressionTarget, isNoSubstitutionTemplateLiteral, - isObjectBindingElementWithoutPropertyName, isObjectLiteralExpression, isObjectLiteralMethod, isParameter, - isParameterPropertyDeclaration, isPrivateIdentifierClassElementDeclaration, isPropertyAccessExpression, - isQualifiedName, isReferencedFile, isReferenceFileLocation, isRightSideOfPropertyAccess, - isShorthandPropertyAssignment, isSourceFile, isStatement, isStatic, isStaticModifier, isStringLiteralLike, - isSuperProperty, isThis, isTypeAliasDeclaration, isTypeElement, isTypeKeyword, isTypeLiteralNode, isTypeNode, - isTypeOperatorNode, isUnionTypeNode, isVariableDeclarationInitializedToBareOrAccessedRequire, - isVariableDeclarationList, isVariableLike, isVariableStatement, isVoidExpression, isWriteAccess, JSDocTag, map, - mapDefined, MethodDeclaration, ModifierFlags, ModuleDeclaration, MultiMap, NamedDeclaration, Node, NodeFlags, - nodeSeenTracker, NumericLiteral, ParameterDeclaration, ParenthesizedExpression, Path, PrivateIdentifier, Program, - PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, punctuationPart, Push, rangeIsOnSingleLine, - ReferencedSymbol, ReferencedSymbolDefinitionInfo, ReferencedSymbolEntry, ReferenceEntry, - RenameLocation, ScriptElementKind, ScriptTarget, SemanticMeaning, SetAccessorDeclaration, SignatureDeclaration, - skipAlias, some, SourceFile, Statement, StringLiteral, StringLiteralLike, stripQuotes, Symbol, SymbolDisplay, - SymbolDisplayPart, SymbolDisplayPartKind, SymbolFlags, SymbolId, symbolName, SyntaxKind, textPart, TextSpan, - tokenToString, tryAddToSet, tryCast, tryGetClassExtendingExpressionWithTypeArguments, - tryGetImportFromModuleSpecifier, TypeChecker, VariableDeclaration, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + Block, + CallExpression, + CancellationToken, + CheckFlags, + ClassLikeDeclaration, + ConstructorDeclaration, + Debug, + Declaration, + DocumentSpan, + ExportSpecifier, + Expression, + FileIncludeReason, + FileReference, + ForInOrOfStatement, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + GoToDefinition, + HighlightSpan, + HighlightSpanKind, + Identifier, + ImplementationLocation, + InterfaceDeclaration, + InternalSymbolName, + JSDocTag, + MethodDeclaration, + ModifierFlags, + ModuleDeclaration, + MultiMap, + NamedDeclaration, + Node, + NodeFlags, + NumericLiteral, + ParameterDeclaration, + ParenthesizedExpression, + Path, + PrivateIdentifier, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + Push, + ReferenceEntry, + ReferencedSymbol, + ReferencedSymbolDefinitionInfo, + ReferencedSymbolEntry, + RenameLocation, + ScriptElementKind, + ScriptTarget, + SemanticMeaning, + SetAccessorDeclaration, + SignatureDeclaration, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolId, + SyntaxKind, + TextSpan, + TypeChecker, + VariableDeclaration, + __String, + addToSeen, + append, + cast, + climbPastPropertyAccess, + compareValues, + contains, + createQueue, + createTextSpan, + createTextSpanFromBounds, + createTextSpanFromRange, + displayPart, + emptyArray, + emptyOptions, + escapeLeadingUnderscores, + filter, + find, + findAncestor, + findChildOfKind, + findIndex, + first, + firstDefined, + firstOrUndefined, + flatMap, + forEachChild, + forEachReturnStatement, + getAdjustedReferenceLocation, + getAdjustedRenameLocation, + getAllSuperTypeNodes, + getAncestor, + getAssignmentDeclarationKind, + getCheckFlags, + getContainerNode, + getContainingObjectLiteralElement, + getContextualTypeFromParentOrAncestorTypeNode, + getDeclarationFromName, + getDeclarationOfKind, + getEffectiveModifierFlags, + getLocalSymbolForExportDefault, + getMeaningFromDeclaration, + getMeaningFromLocation, + getModeForUsageLocation, + getNameOfDeclaration, + getNameTable, + getNextJSDocCommentLocation, + getNodeId, + getNodeKind, + getPropertySymbolFromBindingElement, + getPropertySymbolsFromContextualType, + getReferencedFileLocation, + getSuperContainer, + getSymbolId, + getSyntacticModifierFlags, + getTargetLabel, + getTextOfNode, + getThisContainer, + getTouchingPropertyName, + hasEffectiveModifier, + hasInitializer, + hasSyntacticModifier, + hasType, + isAccessExpression, + isArrayLiteralOrObjectLiteralDestructuringPattern, + isAssertionExpression, + isBinaryExpression, + isBindableObjectDefinePropertyCall, + isBindingElement, + isBreakOrContinueStatement, + isCallExpression, + isCallExpressionTarget, + isCatchClause, + isClassLike, + isClassStaticBlockDeclaration, + isComputedPropertyName, + isConstructorDeclaration, + isDeclaration, + isDeclarationName, + isExportAssignment, + isExportSpecifier, + isExpressionOfExternalModuleImportEqualsDeclaration, + isExpressionStatement, + isExpressionWithTypeArguments, + isExternalModule, + isExternalModuleSymbol, + isExternalOrCommonJsModule, + isForInOrOfStatement, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isIdentifier, + isIdentifierPart, + isImportMeta, + isImportOrExportSpecifier, + isImportSpecifier, + isImportTypeNode, + isInJSFile, + isInNonReferenceComment, + isInString, + isInterfaceDeclaration, + isJSDocMemberName, + isJSDocTag, + isJsxClosingElement, + isJsxOpeningElement, + isJsxSelfClosingElement, + isJumpStatementTarget, + isLabelOfLabeledStatement, + isLabeledStatement, + isLiteralComputedPropertyDeclarationName, + isLiteralNameOfPropertyDeclarationOrIndexAccess, + isLiteralTypeNode, + isMethodOrAccessor, + isModuleDeclaration, + isModuleExportsAccessExpression, + isModuleOrEnumDeclaration, + isModuleSpecifierLike, + isNameOfModuleDeclaration, + isNamespaceExportDeclaration, + isNewExpressionTarget, + isNoSubstitutionTemplateLiteral, + isObjectBindingElementWithoutPropertyName, + isObjectLiteralExpression, + isObjectLiteralMethod, + isParameter, + isParameterPropertyDeclaration, + isPrivateIdentifierClassElementDeclaration, + isPropertyAccessExpression, + isQualifiedName, + isReferenceFileLocation, + isReferencedFile, + isRightSideOfPropertyAccess, + isShorthandPropertyAssignment, + isSourceFile, + isStatement, + isStatic, + isStaticModifier, + isStringLiteralLike, + isSuperProperty, + isThis, + isTypeAliasDeclaration, + isTypeElement, + isTypeKeyword, + isTypeLiteralNode, + isTypeNode, + isTypeOperatorNode, + isUnionTypeNode, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableDeclarationList, + isVariableLike, + isVariableStatement, + isVoidExpression, + isWriteAccess, + map, + mapDefined, + nodeSeenTracker, + punctuationPart, + rangeIsOnSingleLine, + skipAlias, + some, + stripQuotes, + symbolName, + textPart, + tokenToString, + tryAddToSet, + tryCast, + tryGetClassExtendingExpressionWithTypeArguments, + tryGetImportFromModuleSpecifier, } from "./_namespaces/ts"; import { - createImportTracker, ExportInfo, ExportKind, findModuleReferences, getExportInfo, getImportOrExportSymbol, - ImportExport, ImportsResult, ImportTracker, ModuleReference, + ExportInfo, + ExportKind, + ImportExport, + ImportTracker, + ImportsResult, + ModuleReference, + createImportTracker, + findModuleReferences, + getExportInfo, + getImportOrExportSymbol, } from "./_namespaces/ts.FindAllReferences"; /** @internal */ diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 0d53a1474d57a..2223105546fa7 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1,19 +1,80 @@ import { - Block, CallExpression, canHaveModifiers, CatchClause, CharacterCodes, ClassDeclaration, CommentRange, concatenate, - createTextChangeFromStartLength, Debug, Declaration, Diagnostic, EditorSettings, find, findAncestor, findIndex, - findPrecedingToken, forEachChild, forEachRight, FormatCodeSettings, FormattingHost, FunctionDeclaration, - getEndLinePosition, getLeadingCommentRangesOfNode, getLineStartPositionForPosition, getNameOfDeclaration, - getNewLineOrDefaultFromHost, getNonDecoratorTokenPosOfNode, getStartPositionOfLine, getTokenAtPosition, - getTrailingCommentRanges, hasDecorators, InterfaceDeclaration, isComment, isDecorator, isJSDoc, isLineBreak, - isModifier, isNodeArray, isStringOrRegularExpressionOrTemplateLiteral, isToken, isWhiteSpaceSingleLine, - LanguageVariant, last, LineAndCharacter, MethodDeclaration, ModuleDeclaration, Node, NodeArray, nodeIsMissing, - nodeIsSynthesized, rangeContainsPositionExclusive, rangeContainsRange, rangeContainsStartEnd, - rangeOverlapsWithStartEnd, repeatString, SourceFile, SourceFileLike, startEndContainsRange, - startEndOverlapsWithStartEnd, SyntaxKind, TextChange, TextRange, TriviaSyntaxKind, TypeReferenceNode, + Block, + CallExpression, + CatchClause, + CharacterCodes, + ClassDeclaration, + CommentRange, + Debug, + Declaration, + Diagnostic, + EditorSettings, + FormatCodeSettings, + FormattingHost, + FunctionDeclaration, + InterfaceDeclaration, + LanguageVariant, + LineAndCharacter, + MethodDeclaration, + ModuleDeclaration, + Node, + NodeArray, + SourceFile, + SourceFileLike, + SyntaxKind, + TextChange, + TextRange, + TriviaSyntaxKind, + TypeReferenceNode, + canHaveModifiers, + concatenate, + createTextChangeFromStartLength, + find, + findAncestor, + findIndex, + findPrecedingToken, + forEachChild, + forEachRight, + getEndLinePosition, + getLeadingCommentRangesOfNode, + getLineStartPositionForPosition, + getNameOfDeclaration, + getNewLineOrDefaultFromHost, + getNonDecoratorTokenPosOfNode, + getStartPositionOfLine, + getTokenAtPosition, + getTrailingCommentRanges, + hasDecorators, + isComment, + isDecorator, + isJSDoc, + isLineBreak, + isModifier, + isNodeArray, + isStringOrRegularExpressionOrTemplateLiteral, + isToken, + isWhiteSpaceSingleLine, + last, + nodeIsMissing, + nodeIsSynthesized, + rangeContainsPositionExclusive, + rangeContainsRange, + rangeContainsStartEnd, + rangeOverlapsWithStartEnd, + repeatString, + startEndContainsRange, + startEndOverlapsWithStartEnd, } from "../_namespaces/ts"; import { - FormattingContext, FormattingRequestKind, FormattingScanner, getFormattingScanner, Rule, RuleAction, RuleFlags, - RulesMap, SmartIndenter, + FormattingContext, + FormattingRequestKind, + FormattingScanner, + Rule, + RuleAction, + RuleFlags, + RulesMap, + SmartIndenter, + getFormattingScanner, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index c42ff32dedacd..4c90a6f312c4f 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -1,5 +1,12 @@ import { TextRangeWithKind } from "../_namespaces/ts.formatting"; -import { Debug, findChildOfKind, FormatCodeSettings, Node, SourceFileLike, SyntaxKind } from "../_namespaces/ts"; +import { + Debug, + FormatCodeSettings, + Node, + SourceFileLike, + SyntaxKind, + findChildOfKind, +} from "../_namespaces/ts"; /** @internal */ export const enum FormattingRequestKind { diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 0941d277d2ac3..7ddb731cf3a26 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -1,9 +1,25 @@ import { - append, createScanner, Debug, isJsxAttribute, isJsxElement, isJsxText, isKeyword, isToken, isTrivia, - LanguageVariant, last, Node, NodeArray, ScriptTarget, SyntaxKind, + Debug, + LanguageVariant, + Node, + NodeArray, + ScriptTarget, + SyntaxKind, + append, + createScanner, + isJsxAttribute, + isJsxElement, + isJsxText, + isKeyword, + isToken, + isTrivia, + last, } from "../_namespaces/ts"; import { - createTextRangeWithKind, TextRangeWithKind, TextRangeWithTriviaKind, TokenInfo, + TextRangeWithKind, + TextRangeWithTriviaKind, + TokenInfo, + createTextRangeWithKind, } from "../_namespaces/ts.formatting"; const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard); diff --git a/src/services/formatting/rule.ts b/src/services/formatting/rule.ts index ed4e96232d5d1..ebea49a117888 100644 --- a/src/services/formatting/rule.ts +++ b/src/services/formatting/rule.ts @@ -1,5 +1,8 @@ import { FormattingContext } from "../_namespaces/ts.formatting"; -import { emptyArray, SyntaxKind } from "../_namespaces/ts"; +import { + SyntaxKind, + emptyArray, +} from "../_namespaces/ts"; /** @internal */ export interface Rule { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index df1cfeb76a992..74d6240b6aa7f 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -1,12 +1,36 @@ import { - anyContext, ContextPredicate, FormattingContext, FormattingRequestKind, Rule, RuleAction, RuleFlags, - TextRangeWithKind, TokenRange, + ContextPredicate, + FormattingContext, + FormattingRequestKind, + Rule, + RuleAction, + RuleFlags, + TextRangeWithKind, + TokenRange, + anyContext, } from "../_namespaces/ts.formatting"; import { - BinaryExpression, contains, findAncestor, findNextToken, FormatCodeSettings, hasDecorators, hasProperty, isArray, - isExpression, isFunctionLikeKind, isNumericLiteral, isPropertyAccessExpression, isPropertyDeclaration, - isPropertySignature, isTrivia, Node, positionIsASICandidate, SemicolonPreference, SyntaxKind, typeKeywords, + BinaryExpression, + FormatCodeSettings, + Node, + SemicolonPreference, + SyntaxKind, YieldExpression, + contains, + findAncestor, + findNextToken, + hasDecorators, + hasProperty, + isArray, + isExpression, + isFunctionLikeKind, + isNumericLiteral, + isPropertyAccessExpression, + isPropertyDeclaration, + isPropertySignature, + isTrivia, + positionIsASICandidate, + typeKeywords, } from "../_namespaces/ts"; /** @internal */ diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 4cdd1b4ca0864..caa4808d4de17 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -1,6 +1,18 @@ -import { Debug, every, FormatCodeSettings, FormattingHost, SyntaxKind } from "../_namespaces/ts"; import { - anyContext, FormatContext, FormattingContext, getAllRules, Rule, RuleAction, RuleSpec, + Debug, + FormatCodeSettings, + FormattingHost, + SyntaxKind, + every, +} from "../_namespaces/ts"; +import { + FormatContext, + FormattingContext, + Rule, + RuleAction, + RuleSpec, + anyContext, + getAllRules, } from "../_namespaces/ts.formatting"; /** @internal */ diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index bc522163651de..948bf0fb0e3fe 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -1,16 +1,62 @@ import { - ArrayBindingPattern, ArrayLiteralExpression, CallExpression, CharacterCodes, ClassDeclaration, ClassExpression, - CommentRange, contains, Debug, EditorSettings, find, findChildOfKind, findListItemInfo, findNextToken, - findPrecedingToken, FormatCodeSettings, GetAccessorDeclaration, getLineAndCharacterOfPosition, - getLineStartPositionForPosition, getStartPositionOfLine, getTokenAtPosition, IfStatement, ImportClause, IndentStyle, - InterfaceDeclaration, isCallExpression, isCallOrNewExpression, isConditionalExpression, isDeclaration, - isStatementButNotDeclaration, isStringOrRegularExpressionOrTemplateLiteral, isWhiteSpaceLike, - isWhiteSpaceSingleLine, JSDocTemplateTag, LineAndCharacter, NamedImportsOrExports, Node, NodeArray, - ObjectBindingPattern, ObjectLiteralExpression, positionBelongsToNode, rangeContainsRange, rangeContainsStartEnd, - SignatureDeclaration, skipTrivia, SourceFile, SourceFileLike, SyntaxKind, TextRange, TypeAliasDeclaration, - TypeLiteralNode, TypeReferenceNode, VariableDeclarationList, + ArrayBindingPattern, + ArrayLiteralExpression, + CallExpression, + CharacterCodes, + ClassDeclaration, + ClassExpression, + CommentRange, + Debug, + EditorSettings, + FormatCodeSettings, + GetAccessorDeclaration, + IfStatement, + ImportClause, + IndentStyle, + InterfaceDeclaration, + JSDocTemplateTag, + LineAndCharacter, + NamedImportsOrExports, + Node, + NodeArray, + ObjectBindingPattern, + ObjectLiteralExpression, + SignatureDeclaration, + SourceFile, + SourceFileLike, + SyntaxKind, + TextRange, + TypeAliasDeclaration, + TypeLiteralNode, + TypeReferenceNode, + VariableDeclarationList, + contains, + find, + findChildOfKind, + findListItemInfo, + findNextToken, + findPrecedingToken, + getLineAndCharacterOfPosition, + getLineStartPositionForPosition, + getStartPositionOfLine, + getTokenAtPosition, + isCallExpression, + isCallOrNewExpression, + isConditionalExpression, + isDeclaration, + isStatementButNotDeclaration, + isStringOrRegularExpressionOrTemplateLiteral, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, + positionBelongsToNode, + rangeContainsRange, + rangeContainsStartEnd, + skipTrivia, } from "../_namespaces/ts"; -import { getRangeOfEnclosingComment, TextRangeWithKind } from "../_namespaces/ts.formatting"; +import { + TextRangeWithKind, + getRangeOfEnclosingComment, +} from "../_namespaces/ts.formatting"; /** @internal */ export namespace SmartIndenter { diff --git a/src/services/getEditsForFileRename.ts b/src/services/getEditsForFileRename.ts index 2c2096a86004d..e8371e232b7d7 100644 --- a/src/services/getEditsForFileRename.ts +++ b/src/services/getEditsForFileRename.ts @@ -1,13 +1,55 @@ import { - combinePaths, createGetCanonicalFileName, createModuleSpecifierResolutionHost, createRange, Debug, emptyArray, - endsWith, ensurePathIsNonModuleName, Expression, factory, FileTextChanges, find, forEach, formatting, - GetCanonicalFileName, getDirectoryPath, getFileMatcherPatterns, getModeForUsageLocation, getOptionFromName, - getRegexFromPattern, getRelativePathFromDirectory, getRelativePathFromFile, getTsConfigObjectLiteralExpression, - hostUsesCaseSensitiveFileNames, isAmbientModule, isArrayLiteralExpression, isObjectLiteralExpression, - isPropertyAssignment, isSourceFile, isStringLiteral, LanguageServiceHost, last, mapDefined, ModuleResolutionHost, - moduleSpecifiers, normalizePath, Path, pathIsRelative, Program, PropertyAssignment, - ResolvedModuleWithFailedLookupLocations, resolveModuleName, SourceFile, SourceFileLike, SourceMapper, - StringLiteralLike, Symbol, textChanges, TextRange, tryRemoveDirectoryPrefix, UserPreferences, + Debug, + Expression, + FileTextChanges, + GetCanonicalFileName, + LanguageServiceHost, + ModuleResolutionHost, + Path, + Program, + PropertyAssignment, + ResolvedModuleWithFailedLookupLocations, + SourceFile, + SourceFileLike, + SourceMapper, + StringLiteralLike, + Symbol, + TextRange, + UserPreferences, + combinePaths, + createGetCanonicalFileName, + createModuleSpecifierResolutionHost, + createRange, + emptyArray, + endsWith, + ensurePathIsNonModuleName, + factory, + find, + forEach, + formatting, + getDirectoryPath, + getFileMatcherPatterns, + getModeForUsageLocation, + getOptionFromName, + getRegexFromPattern, + getRelativePathFromDirectory, + getRelativePathFromFile, + getTsConfigObjectLiteralExpression, + hostUsesCaseSensitiveFileNames, + isAmbientModule, + isArrayLiteralExpression, + isObjectLiteralExpression, + isPropertyAssignment, + isSourceFile, + isStringLiteral, + last, + mapDefined, + moduleSpecifiers, + normalizePath, + pathIsRelative, + resolveModuleName, + textChanges, + tryRemoveDirectoryPrefix, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/goToDefinition.ts b/src/services/goToDefinition.ts index 1a8ebd80f4843..39fb28caa0ff4 100644 --- a/src/services/goToDefinition.ts +++ b/src/services/goToDefinition.ts @@ -1,22 +1,101 @@ import { - AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, CallLikeExpression, concatenate, - createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, createTextSpanFromRange, Debug, Declaration, - DefinitionInfo, DefinitionInfoAndBoundSpan, emptyArray, every, FileReference, filter, find, FindAllReferences, - findAncestor, first, flatMap, forEach, FunctionLikeDeclaration, getAssignmentDeclarationKind, - getContainingObjectLiteralElement, getDirectoryPath, getEffectiveBaseTypeNode, getInvokedExpression, - getModeForUsageLocation, getNameFromPropertyName, getNameOfDeclaration, getPropertySymbolsFromContextualType, - getTargetLabel, getTextOfPropertyName, getTouchingPropertyName, getTouchingToken, hasEffectiveModifier, - hasInitializer, hasStaticModifier, isAnyImportOrBareOrAccessedRequire, isAssignmentDeclaration, - isAssignmentExpression, isBindingElement, isCallLikeExpression, isCallOrNewExpressionTarget, isClassElement, - isClassExpression, isClassLike, isClassStaticBlockDeclaration, isConstructorDeclaration, isDeclarationFileName, - isExternalModuleNameRelative, isFunctionLike, isFunctionLikeDeclaration, isFunctionTypeNode, isIdentifier, - isImportMeta, isJSDocOverrideTag, isJsxOpeningLikeElement, isJumpStatementTarget, isModuleSpecifierLike, - isNameOfFunctionDeclaration, isNewExpressionTarget, isObjectBindingPattern, isPropertyName, - isRightSideOfPropertyAccess, isStaticModifier, isVariableDeclaration, last, map, mapDefined, ModifierFlags, - moveRangePastModifiers, Node, NodeFlags, Program, resolvePath, ScriptElementKind, SignatureDeclaration, skipAlias, - skipParentheses, skipTrivia, some, SourceFile, Symbol, SymbolDisplay, SymbolFlags, SyntaxKind, - textRangeContainsPositionInclusive, TextSpan, tryCast, tryGetModuleSpecifierFromDeclaration, Type, TypeChecker, - TypeFlags, unescapeLeadingUnderscores, + AssignmentDeclarationKind, + AssignmentExpression, + AssignmentOperatorToken, + CallLikeExpression, + Debug, + Declaration, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + FileReference, + FindAllReferences, + FunctionLikeDeclaration, + ModifierFlags, + Node, + NodeFlags, + Program, + ScriptElementKind, + SignatureDeclaration, + SourceFile, + Symbol, + SymbolDisplay, + SymbolFlags, + SyntaxKind, + TextSpan, + Type, + TypeChecker, + TypeFlags, + concatenate, + createTextSpan, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + emptyArray, + every, + filter, + find, + findAncestor, + first, + flatMap, + forEach, + getAssignmentDeclarationKind, + getContainingObjectLiteralElement, + getDirectoryPath, + getEffectiveBaseTypeNode, + getInvokedExpression, + getModeForUsageLocation, + getNameFromPropertyName, + getNameOfDeclaration, + getPropertySymbolsFromContextualType, + getTargetLabel, + getTextOfPropertyName, + getTouchingPropertyName, + getTouchingToken, + hasEffectiveModifier, + hasInitializer, + hasStaticModifier, + isAnyImportOrBareOrAccessedRequire, + isAssignmentDeclaration, + isAssignmentExpression, + isBindingElement, + isCallLikeExpression, + isCallOrNewExpressionTarget, + isClassElement, + isClassExpression, + isClassLike, + isClassStaticBlockDeclaration, + isConstructorDeclaration, + isDeclarationFileName, + isExternalModuleNameRelative, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionTypeNode, + isIdentifier, + isImportMeta, + isJSDocOverrideTag, + isJsxOpeningLikeElement, + isJumpStatementTarget, + isModuleSpecifierLike, + isNameOfFunctionDeclaration, + isNewExpressionTarget, + isObjectBindingPattern, + isPropertyName, + isRightSideOfPropertyAccess, + isStaticModifier, + isVariableDeclaration, + last, + map, + mapDefined, + moveRangePastModifiers, + resolvePath, + skipAlias, + skipParentheses, + skipTrivia, + some, + textRangeContainsPositionInclusive, + tryCast, + tryGetModuleSpecifierFromDeclaration, + unescapeLeadingUnderscores, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index 802fe1d5417b8..5c0a1d6e6f588 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -1,18 +1,82 @@ import { - __String, AnyImportOrReExport, AssignmentDeclarationKind, BinaryExpression, BindingElement, CallExpression, - CancellationToken, canHaveModifiers, cast, Debug, ExportAssignment, ExportDeclaration, FileReference, - findAncestor, forEach, getAssignmentDeclarationKind, getFirstIdentifier, getNameOfAccessExpression, - getSourceFileOfNode, getSymbolId, hasSyntacticModifier, Identifier, ImportCall, ImportClause, ImportDeclaration, - ImportEqualsDeclaration, importFromModuleSpecifier, ImportSpecifier, InternalSymbolName, isAccessExpression, - isBinaryExpression, isBindingElement, isCatchClause, isDefaultImport, isExportAssignment, isExportDeclaration, - isExportModifier, isExportSpecifier, isExternalModuleAugmentation, isExternalModuleSymbol, isImportCall, - isImportEqualsDeclaration, isImportTypeNode, isInJSFile, isJSDocTypedefTag, isModuleExportsAccessExpression, - isNamedExports, isNamespaceExport, isPrivateIdentifier, isPropertyAccessExpression, isShorthandPropertyAssignment, - isSourceFile, isStringLiteral, isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, - isVariableStatement, ModifierFlags, ModuleBlock, ModuleDeclaration, NamedImportsOrExports, NamespaceImport, - Node, nodeSeenTracker, Program, some, SourceFile, Statement, StringLiteral, StringLiteralLike, Symbol, - symbolEscapedNameNoDefault, SymbolFlags, symbolName, SyntaxKind, TypeChecker, ValidImportTypeNode, - VariableDeclaration, walkUpBindingElementsAndPatterns, + AnyImportOrReExport, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + CallExpression, + CancellationToken, + Debug, + ExportAssignment, + ExportDeclaration, + FileReference, + Identifier, + ImportCall, + ImportClause, + ImportDeclaration, + ImportEqualsDeclaration, + ImportSpecifier, + InternalSymbolName, + ModifierFlags, + ModuleBlock, + ModuleDeclaration, + NamedImportsOrExports, + NamespaceImport, + Node, + Program, + SourceFile, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SymbolFlags, + SyntaxKind, + TypeChecker, + ValidImportTypeNode, + VariableDeclaration, + __String, + canHaveModifiers, + cast, + findAncestor, + forEach, + getAssignmentDeclarationKind, + getFirstIdentifier, + getNameOfAccessExpression, + getSourceFileOfNode, + getSymbolId, + hasSyntacticModifier, + importFromModuleSpecifier, + isAccessExpression, + isBinaryExpression, + isBindingElement, + isCatchClause, + isDefaultImport, + isExportAssignment, + isExportDeclaration, + isExportModifier, + isExportSpecifier, + isExternalModuleAugmentation, + isExternalModuleSymbol, + isImportCall, + isImportEqualsDeclaration, + isImportTypeNode, + isInJSFile, + isJSDocTypedefTag, + isModuleExportsAccessExpression, + isNamedExports, + isNamespaceExport, + isPrivateIdentifier, + isPropertyAccessExpression, + isShorthandPropertyAssignment, + isSourceFile, + isStringLiteral, + isVariableDeclaration, + isVariableDeclarationInitializedToBareOrAccessedRequire, + isVariableStatement, + nodeSeenTracker, + some, + symbolEscapedNameNoDefault, + symbolName, + walkUpBindingElementsAndPatterns, } from "./_namespaces/ts"; /* Code for finding imports of an exported symbol. Used only by FindAllReferences. */ diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index 2d890d7f31cfc..3af19b6c9e731 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -1,17 +1,73 @@ import { - __String, ArrowFunction, CallExpression, createPrinter, Debug, EmitHint, EnumMember, equateStringsCaseInsensitive, - Expression, findChildOfKind, forEachChild, FunctionDeclaration, FunctionExpression, FunctionLikeDeclaration, - GetAccessorDeclaration, getEffectiveReturnTypeNode, getEffectiveTypeAnnotationNode, getLanguageVariant, - getLeadingCommentRanges, hasContextSensitiveParameters, Identifier, InlayHint, InlayHintKind, InlayHintsContext, - isArrowFunction, isAssertionExpression, isBindingPattern, isCallExpression, isEnumMember, - isExpressionWithTypeArguments, isFunctionDeclaration, isFunctionExpression, isFunctionLikeDeclaration, - isGetAccessorDeclaration, isIdentifier, isIdentifierText, isInfinityOrNaNString, isLiteralExpression, - isMethodDeclaration, isNewExpression, isObjectLiteralExpression, isParameter, isParameterDeclaration, - isPropertyAccessExpression, isPropertyDeclaration, isTypeNode, isVarConst, isVariableDeclaration, MethodDeclaration, - NewExpression, Node, NodeBuilderFlags, ParameterDeclaration, PrefixUnaryExpression, PrinterOptions, - PropertyDeclaration, Signature, skipParentheses, some, Symbol, SymbolFlags, SyntaxKind, textSpanIntersectsWith, - Type, TypeFormatFlags, unescapeLeadingUnderscores, UserPreferences, usingSingleLineStringWriter, + ArrowFunction, + CallExpression, + Debug, + EmitHint, + EnumMember, + Expression, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + GetAccessorDeclaration, + Identifier, + InlayHint, + InlayHintKind, + InlayHintsContext, + MethodDeclaration, + NewExpression, + Node, + NodeBuilderFlags, + ParameterDeclaration, + PrefixUnaryExpression, + PrinterOptions, + PropertyDeclaration, + Signature, + Symbol, + SymbolFlags, + SyntaxKind, + Type, + TypeFormatFlags, + UserPreferences, VariableDeclaration, + __String, + createPrinter, + equateStringsCaseInsensitive, + findChildOfKind, + forEachChild, + getEffectiveReturnTypeNode, + getEffectiveTypeAnnotationNode, + getLanguageVariant, + getLeadingCommentRanges, + hasContextSensitiveParameters, + isArrowFunction, + isAssertionExpression, + isBindingPattern, + isCallExpression, + isEnumMember, + isExpressionWithTypeArguments, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLikeDeclaration, + isGetAccessorDeclaration, + isIdentifier, + isIdentifierText, + isInfinityOrNaNString, + isLiteralExpression, + isMethodDeclaration, + isNewExpression, + isObjectLiteralExpression, + isParameter, + isParameterDeclaration, + isPropertyAccessExpression, + isPropertyDeclaration, + isTypeNode, + isVarConst, + isVariableDeclaration, + skipParentheses, + some, + textSpanIntersectsWith, + unescapeLeadingUnderscores, + usingSingleLineStringWriter, } from "./_namespaces/ts"; const maxHintsLength = 30; diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index b6b7ba77b0cbe..fa2335f019790 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -1,18 +1,91 @@ import { - arraysEqual, ArrowFunction, AssignmentDeclarationKind, BinaryExpression, buildLinkParts, ClassExpression, - CompletionEntry, CompletionEntryDetails, Completions, ConstructorDeclaration, contains, Declaration, - DocCommentTemplateOptions, emptyArray, Expression, ExpressionStatement, find, findAncestor, flatMap, flatten, - forEach, forEachAncestor, forEachReturnStatement, forEachUnique, FunctionDeclaration, FunctionExpression, - getAssignmentDeclarationKind, getJSDocCommentsAndTags, getJSDocTags, getLineStartPositionForPosition, - getTokenAtPosition, hasJSDocNodes, hasJSFileExtension, intersperse, isArrowFunction, isBlock, - isConstructorDeclaration, isExpression, isFunctionExpression, isFunctionLike, isFunctionLikeDeclaration, - isFunctionTypeNode, isIdentifier, isJSDoc, isJSDocParameterTag, isWhiteSpaceSingleLine, JSDoc, JSDocAugmentsTag, - JSDocCallbackTag, JSDocComment, JSDocImplementsTag, JSDocParameterTag, JSDocPropertyTag, JSDocSeeTag, JSDocTag, - JSDocTagInfo, JSDocTemplateTag, JSDocTypedefTag, JSDocTypeTag, lastOrUndefined, length, lineBreakPart, map, - mapDefined, MethodDeclaration, MethodSignature, Node, ParameterDeclaration, parameterNamePart, - ParenthesizedExpression, PropertyAssignment, PropertyDeclaration, propertyNamePart, PropertySignature, - punctuationPart, ScriptElementKind, SourceFile, spacePart, startsWith, SymbolDisplayPart, SyntaxKind, TextInsertion, - textPart, typeAliasNamePart, TypeChecker, typeParameterNamePart, VariableStatement, + ArrowFunction, + AssignmentDeclarationKind, + BinaryExpression, + ClassExpression, + CompletionEntry, + CompletionEntryDetails, + Completions, + ConstructorDeclaration, + Declaration, + DocCommentTemplateOptions, + Expression, + ExpressionStatement, + FunctionDeclaration, + FunctionExpression, + JSDoc, + JSDocAugmentsTag, + JSDocCallbackTag, + JSDocComment, + JSDocImplementsTag, + JSDocParameterTag, + JSDocPropertyTag, + JSDocSeeTag, + JSDocTag, + JSDocTagInfo, + JSDocTemplateTag, + JSDocTypeTag, + JSDocTypedefTag, + MethodDeclaration, + MethodSignature, + Node, + ParameterDeclaration, + ParenthesizedExpression, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + ScriptElementKind, + SourceFile, + SymbolDisplayPart, + SyntaxKind, + TextInsertion, + TypeChecker, + VariableStatement, + arraysEqual, + buildLinkParts, + contains, + emptyArray, + find, + findAncestor, + flatMap, + flatten, + forEach, + forEachAncestor, + forEachReturnStatement, + forEachUnique, + getAssignmentDeclarationKind, + getJSDocCommentsAndTags, + getJSDocTags, + getLineStartPositionForPosition, + getTokenAtPosition, + hasJSDocNodes, + hasJSFileExtension, + intersperse, + isArrowFunction, + isBlock, + isConstructorDeclaration, + isExpression, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isFunctionTypeNode, + isIdentifier, + isJSDoc, + isJSDocParameterTag, + isWhiteSpaceSingleLine, + lastOrUndefined, + length, + lineBreakPart, + map, + mapDefined, + parameterNamePart, + propertyNamePart, + punctuationPart, + spacePart, + startsWith, + textPart, + typeAliasNamePart, + typeParameterNamePart, } from "./_namespaces/ts"; const jsDocTagNames = [ diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 0d0f78140556d..d9bb97eb9d9eb 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -1,9 +1,32 @@ import { - CancellationToken, compareStringsCaseSensitiveUI, compareValues, createPatternMatcher, createTextSpanFromNode, - Declaration, emptyArray, Expression, getContainerNode, getNameOfDeclaration, getNodeKind, getNodeModifiers, - getTextOfIdentifierOrLiteral, Identifier, ImportClause, ImportEqualsDeclaration, ImportSpecifier, - isPropertyAccessExpression, isPropertyNameLiteral, NavigateToItem, Node, PatternMatcher, PatternMatchKind, Push, - ScriptElementKind, SourceFile, SyntaxKind, TypeChecker, + CancellationToken, + Declaration, + Expression, + Identifier, + ImportClause, + ImportEqualsDeclaration, + ImportSpecifier, + NavigateToItem, + Node, + PatternMatchKind, + PatternMatcher, + Push, + ScriptElementKind, + SourceFile, + SyntaxKind, + TypeChecker, + compareStringsCaseSensitiveUI, + compareValues, + createPatternMatcher, + createTextSpanFromNode, + emptyArray, + getContainerNode, + getNameOfDeclaration, + getNodeKind, + getNodeModifiers, + getTextOfIdentifierOrLiteral, + isPropertyAccessExpression, + isPropertyNameLiteral, } from "./_namespaces/ts"; interface RawNavigateToItem { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 7d73da78ba472..ef79aa8f4ff3d 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -1,24 +1,113 @@ import { - ArrowFunction, AssignmentDeclarationKind, BinaryExpression, BindableElementAccessExpression, - BindableObjectDefinePropertyCall, BindableStaticNameExpression, BindingElement, CallExpression, CancellationToken, - ClassElement, ClassExpression, ClassLikeDeclaration, compareStringsCaseSensitiveUI, compareValues, concatenate, - ConstructorDeclaration, contains, createTextSpanFromNode, createTextSpanFromRange, Debug, Declaration, - DeclarationName, declarationNameToString, EntityNameExpression, EnumDeclaration, EnumMember, escapeString, - ExportAssignment, Expression, factory, filterMutate, forEach, forEachChild, FunctionDeclaration, FunctionExpression, - FunctionLikeDeclaration, getAssignmentDeclarationKind, getBaseFileName, getElementOrPropertyAccessName, - getFullWidth, getNameOfDeclaration, getNameOrArgument, getNodeKind, getNodeModifiers, - getPropertyNameForPropertyNameNode, getSyntacticModifierFlags, getTextOfIdentifierOrLiteral, getTextOfNode, - hasDynamicName, hasJSDocNodes, Identifier, idText, ImportClause, InterfaceDeclaration, InternalSymbolName, - isAmbientModule, isArrowFunction, isBinaryExpression, isBindableStaticAccessExpression, isBindingPattern, - isCallExpression, isClassDeclaration, isClassLike, isDeclaration, isElementAccessExpression, isExportAssignment, - isExpression, isExternalModule, isFunctionDeclaration, isFunctionExpression, isIdentifier, isJSDocTypeAlias, - isModuleBlock, isModuleDeclaration, isObjectLiteralExpression, isParameterPropertyDeclaration, isPrivateIdentifier, - isPropertyAccessExpression, isPropertyAssignment, isPropertyName, isPropertyNameLiteral, isStatic, - isStringLiteralLike, isToken, isVariableDeclaration, lastOrUndefined, map, mapDefined, ModifierFlags, - ModuleDeclaration, NavigationBarItem, NavigationTree, Node, NodeFlags, normalizePath, PropertyAccessExpression, - PropertyAssignment, PropertyDeclaration, PropertyNameLiteral, removeFileExtension, setTextRange, - ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SyntaxKind, TextSpan, TypeElement, - unescapeLeadingUnderscores, VariableDeclaration, + ArrowFunction, + AssignmentDeclarationKind, + BinaryExpression, + BindableElementAccessExpression, + BindableObjectDefinePropertyCall, + BindableStaticNameExpression, + BindingElement, + CallExpression, + CancellationToken, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + ConstructorDeclaration, + Debug, + Declaration, + DeclarationName, + EntityNameExpression, + EnumDeclaration, + EnumMember, + ExportAssignment, + Expression, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + Identifier, + ImportClause, + InterfaceDeclaration, + InternalSymbolName, + ModifierFlags, + ModuleDeclaration, + NavigationBarItem, + NavigationTree, + Node, + NodeFlags, + PropertyAccessExpression, + PropertyAssignment, + PropertyDeclaration, + PropertyNameLiteral, + ShorthandPropertyAssignment, + SourceFile, + SpreadAssignment, + SyntaxKind, + TextSpan, + TypeElement, + VariableDeclaration, + compareStringsCaseSensitiveUI, + compareValues, + concatenate, + contains, + createTextSpanFromNode, + createTextSpanFromRange, + declarationNameToString, + escapeString, + factory, + filterMutate, + forEach, + forEachChild, + getAssignmentDeclarationKind, + getBaseFileName, + getElementOrPropertyAccessName, + getFullWidth, + getNameOfDeclaration, + getNameOrArgument, + getNodeKind, + getNodeModifiers, + getPropertyNameForPropertyNameNode, + getSyntacticModifierFlags, + getTextOfIdentifierOrLiteral, + getTextOfNode, + hasDynamicName, + hasJSDocNodes, + idText, + isAmbientModule, + isArrowFunction, + isBinaryExpression, + isBindableStaticAccessExpression, + isBindingPattern, + isCallExpression, + isClassDeclaration, + isClassLike, + isDeclaration, + isElementAccessExpression, + isExportAssignment, + isExpression, + isExternalModule, + isFunctionDeclaration, + isFunctionExpression, + isIdentifier, + isJSDocTypeAlias, + isModuleBlock, + isModuleDeclaration, + isObjectLiteralExpression, + isParameterPropertyDeclaration, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyAssignment, + isPropertyName, + isPropertyNameLiteral, + isStatic, + isStringLiteralLike, + isToken, + isVariableDeclaration, + lastOrUndefined, + map, + mapDefined, + normalizePath, + removeFileExtension, + setTextRange, + unescapeLeadingUnderscores, } from "./_namespaces/ts"; /** diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index f8204d4f4b4be..22a40608dca4c 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -1,14 +1,59 @@ import { - AnyImportOrRequireStatement, arrayIsSorted, binarySearch, compareBooleans, compareStringsCaseInsensitive, - compareValues, Comparison, createScanner, emptyArray, ExportDeclaration, ExportSpecifier, Expression, factory, + AnyImportOrRequireStatement, + Comparison, + ExportDeclaration, + ExportSpecifier, + Expression, FileTextChanges, - FindAllReferences, flatMap, formatting, getNewLineOrDefaultFromHost, group, Identifier, identity, ImportDeclaration, - ImportOrExportSpecifier, ImportSpecifier, isAmbientModule, isExportDeclaration, isExternalModuleNameRelative, - isExternalModuleReference, isImportDeclaration, isNamedExports, isNamedImports, isNamespaceImport, isString, - isStringLiteral, isStringLiteralLike, jsxModeNeedsExplicitImport, LanguageServiceHost, length, map, - NamedImportBindings, NamedImports, NamespaceImport, OrganizeImportsMode, Program, Scanner, some, - SortedReadonlyArray, SourceFile, stableSort, suppressLeadingTrivia, SyntaxKind, textChanges, TransformFlags, - tryCast, UserPreferences, + FindAllReferences, + Identifier, + ImportDeclaration, + ImportOrExportSpecifier, + ImportSpecifier, + LanguageServiceHost, + NamedImportBindings, + NamedImports, + NamespaceImport, + OrganizeImportsMode, + Program, + Scanner, + SortedReadonlyArray, + SourceFile, + SyntaxKind, + TransformFlags, + UserPreferences, + arrayIsSorted, + binarySearch, + compareBooleans, + compareStringsCaseInsensitive, + compareValues, + createScanner, + emptyArray, + factory, + flatMap, + formatting, + getNewLineOrDefaultFromHost, + group, + identity, + isAmbientModule, + isExportDeclaration, + isExternalModuleNameRelative, + isExternalModuleReference, + isImportDeclaration, + isNamedExports, + isNamedImports, + isNamespaceImport, + isString, + isStringLiteral, + isStringLiteralLike, + jsxModeNeedsExplicitImport, + length, + map, + some, + stableSort, + suppressLeadingTrivia, + textChanges, + tryCast, } from "./_namespaces/ts"; /** diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 5a80301e00055..b7933b52970ec 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -1,13 +1,58 @@ import { - ArrowFunction, Block, CallExpression, CancellationToken, CaseClause, createTextSpanFromBounds, - createTextSpanFromNode, createTextSpanFromRange, Debug, DefaultClause, findChildOfKind, getLeadingCommentRanges, - isAnyImportSyntax, isArrayLiteralExpression, isBinaryExpression, isBindingElement, isBlock, isCallExpression, - isCallOrNewExpression, isClassLike, isDeclaration, isFunctionLike, isIfStatement, isInComment, - isInterfaceDeclaration, isJsxText, isModuleBlock, isNodeArrayMultiLine, isParenthesizedExpression, - isPropertyAccessExpression, isReturnStatement, isTupleTypeNode, isVariableStatement, JsxAttributes, JsxElement, - JsxFragment, JsxOpeningLikeElement, Node, NodeArray, NoSubstitutionTemplateLiteral, OutliningSpan, - OutliningSpanKind, ParenthesizedExpression, positionsAreOnSameLine, Push, SignatureDeclaration, SourceFile, - startsWith, SyntaxKind, TemplateExpression, TextSpan, trimString, trimStringStart, TryStatement, + ArrowFunction, + Block, + CallExpression, + CancellationToken, + CaseClause, + Debug, + DefaultClause, + JsxAttributes, + JsxElement, + JsxFragment, + JsxOpeningLikeElement, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + OutliningSpan, + OutliningSpanKind, + ParenthesizedExpression, + Push, + SignatureDeclaration, + SourceFile, + SyntaxKind, + TemplateExpression, + TextSpan, + TryStatement, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + findChildOfKind, + getLeadingCommentRanges, + isAnyImportSyntax, + isArrayLiteralExpression, + isBinaryExpression, + isBindingElement, + isBlock, + isCallExpression, + isCallOrNewExpression, + isClassLike, + isDeclaration, + isFunctionLike, + isIfStatement, + isInComment, + isInterfaceDeclaration, + isJsxText, + isModuleBlock, + isNodeArrayMultiLine, + isParenthesizedExpression, + isPropertyAccessExpression, + isReturnStatement, + isTupleTypeNode, + isVariableStatement, + positionsAreOnSameLine, + startsWith, + trimString, + trimStringStart, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 21e6a62d70cf5..4e4004a774d9c 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -1,6 +1,15 @@ import { - CharacterCodes, compareBooleans, compareValues, Comparison, createTextSpan, isUnicodeIdentifierStart, last, - min, ScriptTarget, startsWith, TextSpan, + CharacterCodes, + Comparison, + ScriptTarget, + TextSpan, + compareBooleans, + compareValues, + createTextSpan, + isUnicodeIdentifierStart, + last, + min, + startsWith, } from "./_namespaces/ts"; // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. diff --git a/src/services/preProcess.ts b/src/services/preProcess.ts index be3823693ea75..af3194a019961 100644 --- a/src/services/preProcess.ts +++ b/src/services/preProcess.ts @@ -1,6 +1,16 @@ import { - FileReference, isKeyword, lastOrUndefined, length, noop, PragmaContext, PreProcessedFileInfo, processCommentPragmas, - processPragmasIntoFields, scanner, ScriptTarget, SyntaxKind, + FileReference, + PragmaContext, + PreProcessedFileInfo, + ScriptTarget, + SyntaxKind, + isKeyword, + lastOrUndefined, + length, + noop, + processCommentPragmas, + processPragmasIntoFields, + scanner, } from "./_namespaces/ts"; export function preProcessFile(sourceText: string, readImportFiles = true, detectJavaScriptImports = false): PreProcessedFileInfo { diff --git a/src/services/refactorProvider.ts b/src/services/refactorProvider.ts index 856708195654f..fc9ad1abc6ea0 100644 --- a/src/services/refactorProvider.ts +++ b/src/services/refactorProvider.ts @@ -1,5 +1,10 @@ import { - ApplicableRefactorInfo, arrayFrom, flatMapIterator, Refactor, RefactorContext, RefactorEditInfo, + ApplicableRefactorInfo, + Refactor, + RefactorContext, + RefactorEditInfo, + arrayFrom, + flatMapIterator, } from "./_namespaces/ts"; import { refactorKindBeginsWith } from "./_namespaces/ts.refactor"; diff --git a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts index d0548b1d785ab..c7f9f753025c4 100644 --- a/src/services/refactors/addOrRemoveBracesToArrowFunction.ts +++ b/src/services/refactors/addOrRemoveBracesToArrowFunction.ts @@ -1,12 +1,37 @@ import { - ApplicableRefactorInfo, ArrowFunction, ConciseBody, copyLeadingComments, copyTrailingAsLeadingComments, - copyTrailingComments, Debug, Diagnostics, emptyArray, Expression, factory, first, getContainingFunction, - getLocaleSpecificMessage, getTokenAtPosition, isArrowFunction, isBlock, isExpression, isReturnStatement, - needsParentheses, rangeContainsRange, RefactorContext, RefactorEditInfo, ReturnStatement, SourceFile, SyntaxKind, + ApplicableRefactorInfo, + ArrowFunction, + ConciseBody, + Debug, + Diagnostics, + Expression, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + SyntaxKind, + copyLeadingComments, + copyTrailingAsLeadingComments, + copyTrailingComments, + emptyArray, + factory, + first, + getContainingFunction, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isBlock, + isExpression, + isReturnStatement, + needsParentheses, + rangeContainsRange, textChanges, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, refactorKindBeginsWith, registerRefactor, + RefactorErrorInfo, + isRefactorErrorInfo, + refactorKindBeginsWith, + registerRefactor, } from "../_namespaces/ts.refactor"; const refactorName = "Add or remove braces in an arrow function"; diff --git a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts index 416f7caf3c1b1..f3938e271716e 100644 --- a/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts +++ b/src/services/refactors/convertArrowFunctionOrFunctionExpression.ts @@ -1,15 +1,61 @@ import { - ApplicableRefactorInfo, ArrowFunction, Block, ConciseBody, copyComments, copyTrailingAsLeadingComments, Debug, - Diagnostics, emptyArray, factory, FileTextChanges, FindAllReferences, first, forEachChild, FunctionExpression, - getCombinedModifierFlags, getContainingFunction, getEffectiveModifierFlags, getLocaleSpecificMessage, - getTokenAtPosition, Identifier, isArrowFunction, isClassLike, isExpression, isFunctionDeclaration, - isFunctionExpression, isIdentifier, isReturnStatement, isThis, isVariableDeclaration, - isVariableDeclarationInVariableStatement, isVariableDeclarationList, isVariableStatement, length, ModifierFlags, - Node, Program, rangeContainsRange, RefactorActionInfo, RefactorContext, RefactorEditInfo, ReturnStatement, - SourceFile, Statement, suppressLeadingAndTrailingTrivia, suppressLeadingTrivia, SyntaxKind, textChanges, - TypeChecker, VariableDeclaration, VariableDeclarationList, VariableStatement, + ApplicableRefactorInfo, + ArrowFunction, + Block, + ConciseBody, + Debug, + Diagnostics, + FileTextChanges, + FindAllReferences, + FunctionExpression, + Identifier, + ModifierFlags, + Node, + Program, + RefactorActionInfo, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + Statement, + SyntaxKind, + TypeChecker, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + copyComments, + copyTrailingAsLeadingComments, + emptyArray, + factory, + first, + forEachChild, + getCombinedModifierFlags, + getContainingFunction, + getEffectiveModifierFlags, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isClassLike, + isExpression, + isFunctionDeclaration, + isFunctionExpression, + isIdentifier, + isReturnStatement, + isThis, + isVariableDeclaration, + isVariableDeclarationInVariableStatement, + isVariableDeclarationList, + isVariableStatement, + length, + rangeContainsRange, + suppressLeadingAndTrailingTrivia, + suppressLeadingTrivia, + textChanges, } from "../_namespaces/ts"; -import { refactorKindBeginsWith, registerRefactor } from "../_namespaces/ts.refactor"; +import { + refactorKindBeginsWith, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert arrow function or function expression"; const refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression); diff --git a/src/services/refactors/convertExport.ts b/src/services/refactors/convertExport.ts index d759fdfbffce0..4ee420179c265 100644 --- a/src/services/refactors/convertExport.ts +++ b/src/services/refactors/convertExport.ts @@ -1,14 +1,60 @@ import { - ApplicableRefactorInfo, CancellationToken, ClassDeclaration, Debug, Diagnostics, emptyArray, EnumDeclaration, - ExportAssignment, ExportSpecifier, factory, FindAllReferences, findModifier, first, FunctionDeclaration, - getLocaleSpecificMessage, getParentNodeInSpan, getRefactorContextSpan, getSyntacticModifierFlags, - getTokenAtPosition, Identifier, ImportClause, ImportSpecifier, ImportTypeNode, InterfaceDeclaration, - InternalSymbolName, isAmbientModule, isExportAssignment, isExternalModuleAugmentation, isIdentifier, isModuleBlock, - isSourceFile, isStringLiteral, makeImport, ModifierFlags, NamespaceDeclaration, Node, NodeFlags, Program, - PropertyAccessExpression, QuotePreference, quotePreferenceFromString, RefactorContext, RefactorEditInfo, SourceFile, - Symbol, SyntaxKind, textChanges, TypeAliasDeclaration, TypeChecker, VariableStatement, + ApplicableRefactorInfo, + CancellationToken, + ClassDeclaration, + Debug, + Diagnostics, + EnumDeclaration, + ExportAssignment, + ExportSpecifier, + FindAllReferences, + FunctionDeclaration, + Identifier, + ImportClause, + ImportSpecifier, + ImportTypeNode, + InterfaceDeclaration, + InternalSymbolName, + ModifierFlags, + NamespaceDeclaration, + Node, + NodeFlags, + Program, + PropertyAccessExpression, + QuotePreference, + RefactorContext, + RefactorEditInfo, + SourceFile, + Symbol, + SyntaxKind, + TypeAliasDeclaration, + TypeChecker, + VariableStatement, + emptyArray, + factory, + findModifier, + first, + getLocaleSpecificMessage, + getParentNodeInSpan, + getRefactorContextSpan, + getSyntacticModifierFlags, + getTokenAtPosition, + isAmbientModule, + isExportAssignment, + isExternalModuleAugmentation, + isIdentifier, + isModuleBlock, + isSourceFile, + isStringLiteral, + makeImport, + quotePreferenceFromString, + textChanges, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + RefactorErrorInfo, + isRefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert export"; diff --git a/src/services/refactors/convertImport.ts b/src/services/refactors/convertImport.ts index 3f0e11d948205..69923c53466cc 100644 --- a/src/services/refactors/convertImport.ts +++ b/src/services/refactors/convertImport.ts @@ -1,13 +1,54 @@ import { - ApplicableRefactorInfo, arrayFrom, codefix, Debug, Diagnostics, emptyArray, Expression, factory, FindAllReferences, - findAncestor, findNextToken, getAllowSyntheticDefaultImports, getLocaleSpecificMessage, getOwnValues, - getParentNodeInSpan, getRefactorContextSpan, getTokenAtPosition, getUniqueName, Identifier, ImportClause, - ImportDeclaration, ImportKind, ImportSpecifier, isExportSpecifier, isImportDeclaration, isPropertyAccessExpression, - isPropertyAccessOrQualifiedName, isShorthandPropertyAssignment, isStringLiteral, NamedImports, NamespaceImport, - Program, PropertyAccessExpression, QualifiedName, RefactorContext, RefactorEditInfo, ScriptTarget, some, - SourceFile, Symbol, SymbolFlags, SyntaxKind, textChanges, TypeChecker, + ApplicableRefactorInfo, + Debug, + Diagnostics, + Expression, + FindAllReferences, + Identifier, + ImportClause, + ImportDeclaration, + ImportKind, + ImportSpecifier, + NamedImports, + NamespaceImport, + Program, + PropertyAccessExpression, + QualifiedName, + RefactorContext, + RefactorEditInfo, + ScriptTarget, + SourceFile, + Symbol, + SymbolFlags, + SyntaxKind, + TypeChecker, + arrayFrom, + codefix, + emptyArray, + factory, + findAncestor, + findNextToken, + getAllowSyntheticDefaultImports, + getLocaleSpecificMessage, + getOwnValues, + getParentNodeInSpan, + getRefactorContextSpan, + getTokenAtPosition, + getUniqueName, + isExportSpecifier, + isImportDeclaration, + isPropertyAccessExpression, + isPropertyAccessOrQualifiedName, + isShorthandPropertyAssignment, + isStringLiteral, + some, + textChanges, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + RefactorErrorInfo, + isRefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert import"; diff --git a/src/services/refactors/convertOverloadListToSingleSignature.ts b/src/services/refactors/convertOverloadListToSingleSignature.ts index ebe0535e0098e..f58b06d5e533a 100644 --- a/src/services/refactors/convertOverloadListToSingleSignature.ts +++ b/src/services/refactors/convertOverloadListToSingleSignature.ts @@ -1,10 +1,43 @@ import { - ApplicableRefactorInfo, CallSignatureDeclaration, ConstructorDeclaration, ConstructSignatureDeclaration, Debug, - Diagnostics, displayPartsToString, EmitFlags, emptyArray, every, factory, findAncestor, FunctionDeclaration, - getSourceFileOfNode, getSyntheticLeadingComments, getTokenAtPosition, isFunctionLikeDeclaration, isIdentifier, - length, map, mapDefined, MethodDeclaration, MethodSignature, NamedTupleMember, Node, NodeArray, - ParameterDeclaration, Program, rangeContainsPosition, RefactorContext, RefactorEditInfo, setEmitFlags, - setSyntheticLeadingComments, setTextRange, some, SourceFile, SyntaxKind, textChanges, TupleTypeNode, + ApplicableRefactorInfo, + CallSignatureDeclaration, + ConstructSignatureDeclaration, + ConstructorDeclaration, + Debug, + Diagnostics, + EmitFlags, + FunctionDeclaration, + MethodDeclaration, + MethodSignature, + NamedTupleMember, + Node, + NodeArray, + ParameterDeclaration, + Program, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + TupleTypeNode, + displayPartsToString, + emptyArray, + every, + factory, + findAncestor, + getSourceFileOfNode, + getSyntheticLeadingComments, + getTokenAtPosition, + isFunctionLikeDeclaration, + isIdentifier, + length, + map, + mapDefined, + rangeContainsPosition, + setEmitFlags, + setSyntheticLeadingComments, + setTextRange, + some, + textChanges, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertParamsToDestructuredObject.ts b/src/services/refactors/convertParamsToDestructuredObject.ts index a4072a335b8b7..c7cf380b53e6f 100644 --- a/src/services/refactors/convertParamsToDestructuredObject.ts +++ b/src/services/refactors/convertParamsToDestructuredObject.ts @@ -1,22 +1,108 @@ import { - addEmitFlags, ApplicableRefactorInfo, ArrowFunction, BindingElement, CallExpression, CancellationToken, CheckFlags, - ClassDeclaration, ClassExpression, compareValues, ConstructorDeclaration, contains, copyComments, Debug, - deduplicate, Diagnostics, ElementAccessExpression, EmitFlags, emptyArray, equateValues, every, Expression, factory, - FindAllReferences, findAncestor, findChildOfKind, findModifier, first, flatMap, FunctionBody, FunctionDeclaration, - FunctionExpression, FunctionLikeDeclaration, getCheckFlags, getContainingFunctionDeclaration, - getContainingObjectLiteralElement, getLocaleSpecificMessage, getMeaningFromLocation, getSourceFileOfNode, - getSymbolTarget, getSynthesizedDeepClone, getTextOfIdentifierOrLiteral, getTouchingToken, getTypeNodeIfAccessible, - Identifier, isCallOrNewExpression, isClassDeclaration, isConstructorDeclaration, isDeclaration, - isElementAccessExpression, isExportAssignment, isExportSpecifier, isExpressionWithTypeArgumentsInClassExtendsClause, - isFunctionLikeDeclaration, isIdentifier, isImportClause, isImportEqualsDeclaration, isImportSpecifier, - isInterfaceDeclaration, isJSDocNode, isMethodSignature, isNamespaceImport, isNewExpressionTarget, - isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isRestParameter, isSourceFileJS, - isThis, isTypeLiteralNode, isVarConst, isVariableDeclaration, LanguageServiceHost, last, map, MethodDeclaration, - MethodSignature, Modifier, NewExpression, Node, NodeArray, ObjectLiteralElementLike, ObjectLiteralExpression, - ParameterDeclaration, Program, PropertyAccessExpression, PropertyAssignment, PropertySignature, rangeContainsRange, - RefactorContext, RefactorEditInfo, SemanticMeaning, ShorthandPropertyAssignment, sortAndDeduplicate, SourceFile, - suppressLeadingAndTrailingTrivia, Symbol, SyntaxKind, textChanges, tryCast, TypeChecker, TypeLiteralNode, TypeNode, + ApplicableRefactorInfo, + ArrowFunction, + BindingElement, + CallExpression, + CancellationToken, + CheckFlags, + ClassDeclaration, + ClassExpression, + ConstructorDeclaration, + Debug, + Diagnostics, + ElementAccessExpression, + EmitFlags, + Expression, + FindAllReferences, + FunctionBody, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + Identifier, + LanguageServiceHost, + MethodDeclaration, + MethodSignature, + Modifier, + NewExpression, + Node, + NodeArray, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + Program, + PropertyAccessExpression, + PropertyAssignment, + PropertySignature, + RefactorContext, + RefactorEditInfo, + SemanticMeaning, + ShorthandPropertyAssignment, + SourceFile, + Symbol, + SyntaxKind, + TypeChecker, + TypeLiteralNode, + TypeNode, VariableDeclaration, + addEmitFlags, + compareValues, + contains, + copyComments, + deduplicate, + emptyArray, + equateValues, + every, + factory, + findAncestor, + findChildOfKind, + findModifier, + first, + flatMap, + getCheckFlags, + getContainingFunctionDeclaration, + getContainingObjectLiteralElement, + getLocaleSpecificMessage, + getMeaningFromLocation, + getSourceFileOfNode, + getSymbolTarget, + getSynthesizedDeepClone, + getTextOfIdentifierOrLiteral, + getTouchingToken, + getTypeNodeIfAccessible, + isCallOrNewExpression, + isClassDeclaration, + isConstructorDeclaration, + isDeclaration, + isElementAccessExpression, + isExportAssignment, + isExportSpecifier, + isExpressionWithTypeArgumentsInClassExtendsClause, + isFunctionLikeDeclaration, + isIdentifier, + isImportClause, + isImportEqualsDeclaration, + isImportSpecifier, + isInterfaceDeclaration, + isJSDocNode, + isMethodSignature, + isNamespaceImport, + isNewExpressionTarget, + isObjectLiteralExpression, + isPropertyAccessExpression, + isPropertyAssignment, + isRestParameter, + isSourceFileJS, + isThis, + isTypeLiteralNode, + isVarConst, + isVariableDeclaration, + last, + map, + rangeContainsRange, + sortAndDeduplicate, + suppressLeadingAndTrailingTrivia, + textChanges, + tryCast, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertStringOrTemplateLiteral.ts b/src/services/refactors/convertStringOrTemplateLiteral.ts index f3bff71ac5849..73eb5a1a1d871 100644 --- a/src/services/refactors/convertStringOrTemplateLiteral.ts +++ b/src/services/refactors/convertStringOrTemplateLiteral.ts @@ -1,10 +1,40 @@ import { - ApplicableRefactorInfo, BinaryExpression, BinaryOperator, copyTrailingAsLeadingComments, copyTrailingComments, - Debug, Diagnostics, emptyArray, Expression, factory, findAncestor, getLocaleSpecificMessage, getTextOfNode, - getTokenAtPosition, getTrailingCommentRanges, isBinaryExpression, isNoSubstitutionTemplateLiteral, - isParenthesizedExpression, isStringLiteral, isStringLiteralLike, isTemplateExpression, isTemplateHead, - isTemplateMiddle, map, Node, ParenthesizedExpression, RefactorContext, RefactorEditInfo, SourceFile, SyntaxKind, - TemplateHead, TemplateMiddle, TemplateSpan, TemplateTail, textChanges, Token, + ApplicableRefactorInfo, + BinaryExpression, + BinaryOperator, + Debug, + Diagnostics, + Expression, + Node, + ParenthesizedExpression, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + TemplateHead, + TemplateMiddle, + TemplateSpan, + TemplateTail, + Token, + copyTrailingAsLeadingComments, + copyTrailingComments, + emptyArray, + factory, + findAncestor, + getLocaleSpecificMessage, + getTextOfNode, + getTokenAtPosition, + getTrailingCommentRanges, + isBinaryExpression, + isNoSubstitutionTemplateLiteral, + isParenthesizedExpression, + isStringLiteral, + isStringLiteralLike, + isTemplateExpression, + isTemplateHead, + isTemplateMiddle, + map, + textChanges, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/refactors/convertToOptionalChainExpression.ts b/src/services/refactors/convertToOptionalChainExpression.ts index 5c8153ef5f876..4cc566753adb9 100644 --- a/src/services/refactors/convertToOptionalChainExpression.ts +++ b/src/services/refactors/convertToOptionalChainExpression.ts @@ -1,14 +1,51 @@ import { - ApplicableRefactorInfo, BinaryExpression, CallExpression, ConditionalExpression, createTextSpanFromBounds, Debug, - Diagnostics, ElementAccessExpression, emptyArray, Expression, ExpressionStatement, factory, - findTokenOnLeftOfPosition, getLocaleSpecificMessage, getRefactorContextSpan, getSingleVariableOfVariableStatement, - getTokenAtPosition, Identifier, isBinaryExpression, isCallExpression, isConditionalExpression, - isElementAccessExpression, isExpressionStatement, isIdentifier, isOptionalChain, isPropertyAccessExpression, - isReturnStatement, isStringOrNumericLiteralLike, isVariableStatement, Node, PropertyAccessExpression, - RefactorContext, RefactorEditInfo, ReturnStatement, skipParentheses, SourceFile, SyntaxKind, textChanges, TextSpan, - TypeChecker, VariableStatement, + ApplicableRefactorInfo, + BinaryExpression, + CallExpression, + ConditionalExpression, + Debug, + Diagnostics, + ElementAccessExpression, + Expression, + ExpressionStatement, + Identifier, + Node, + PropertyAccessExpression, + RefactorContext, + RefactorEditInfo, + ReturnStatement, + SourceFile, + SyntaxKind, + TextSpan, + TypeChecker, + VariableStatement, + createTextSpanFromBounds, + emptyArray, + factory, + findTokenOnLeftOfPosition, + getLocaleSpecificMessage, + getRefactorContextSpan, + getSingleVariableOfVariableStatement, + getTokenAtPosition, + isBinaryExpression, + isCallExpression, + isConditionalExpression, + isElementAccessExpression, + isExpressionStatement, + isIdentifier, + isOptionalChain, + isPropertyAccessExpression, + isReturnStatement, + isStringOrNumericLiteralLike, + isVariableStatement, + skipParentheses, + textChanges, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + RefactorErrorInfo, + isRefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Convert to optional chain expression"; const convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression); diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 0918765f6567e..605cd5449fe3d 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1,32 +1,168 @@ import { - __String, ANONYMOUS, ApplicableRefactorInfo, arrayFrom, assertType, BindingElement, Block, BlockLike, - BreakStatement, CancellationToken, canHaveModifiers, CharacterCodes, ClassElement, ClassLikeDeclaration, codefix, - compareProperties, compareStringsCaseSensitive, compareValues, contains, ContinueStatement, createDiagnosticForNode, - createFileDiagnostic, Debug, Declaration, Diagnostic, DiagnosticCategory, DiagnosticMessage, Diagnostics, EmitFlags, - emptyArray, EntityName, Expression, ExpressionStatement, factory, find, findAncestor, - findFirstNonJsxWhitespaceToken, findTokenOnLeftOfPosition, first, firstOrUndefined, forEachChild, - formatStringFromArgs, FunctionDeclaration, FunctionLikeDeclaration, getContainingClass, getContainingFunction, - getEffectiveTypeParameterDeclarations, getEmitScriptTarget, getEnclosingBlockScopeContainer, - getLocaleSpecificMessage, getModifiers, getNodeId, getParentNodeInSpan, getRefactorContextSpan, getRenameLocation, - getSymbolId, getSynthesizedDeepClone, getThisContainer, getUniqueName, hasEffectiveModifier, hasSyntacticModifier, - Identifier, isArray, isArrowFunction, isAssignmentExpression, isBinaryExpression, isBlock, isBlockScope, - isCaseClause, isClassLike, isConstructorDeclaration, isDeclaration, isDeclarationWithTypeParameters, - isElementAccessExpression, isExpression, isExpressionNode, isExpressionStatement, isFunctionBody, - isFunctionExpression, isFunctionLike, isFunctionLikeDeclaration, isIdentifier, isInJSFile, isIterationStatement, - isJsxAttribute, isJsxElement, isJsxFragment, isJsxSelfClosingElement, isKeyword, isModuleBlock, - isParenthesizedTypeNode, isPartOfTypeNode, isPrivateIdentifier, isPropertyAccessExpression, isPropertyDeclaration, - isQualifiedName, isReturnStatement, isShorthandPropertyAssignment, isSourceFile, isStatement, isStatic, - isStringLiteral, isSwitchStatement, isThis, isUnaryExpressionWithWrite, isUnionTypeNode, isVariableDeclaration, - isVariableDeclarationList, isVariableStatement, LabeledStatement, last, map, MethodDeclaration, Modifier, - ModifierFlags, ModuleBlock, NamedDeclaration, Node, NodeBuilderFlags, NodeFlags, nullTransformationContext, - ObjectLiteralElementLike, ParameterDeclaration, positionIsSynthesized, PropertyAccessExpression, - rangeContainsStartEnd, RefactorActionInfo, RefactorContext, RefactorEditInfo, setEmitFlags, - ShorthandPropertyAssignment, SignatureKind, singleOrUndefined, skipParentheses, SourceFile, Statement, - StringLiteral, suppressLeadingAndTrailingTrivia, Symbol, SymbolFlags, SyntaxKind, textChanges, TextRange, TextSpan, - textSpanEnd, TryStatement, Type, TypeChecker, TypeElement, TypeFlags, TypeLiteralNode, TypeNode, TypeParameter, - TypeParameterDeclaration, VariableDeclaration, visitEachChild, visitNode, visitNodes, VisitResult, + ANONYMOUS, + ApplicableRefactorInfo, + BindingElement, + Block, + BlockLike, + BreakStatement, + CancellationToken, + CharacterCodes, + ClassElement, + ClassLikeDeclaration, + ContinueStatement, + Debug, + Declaration, + Diagnostic, + DiagnosticCategory, + DiagnosticMessage, + Diagnostics, + EmitFlags, + EntityName, + Expression, + ExpressionStatement, + FunctionDeclaration, + FunctionLikeDeclaration, + Identifier, + LabeledStatement, + MethodDeclaration, + Modifier, + ModifierFlags, + ModuleBlock, + NamedDeclaration, + Node, + NodeBuilderFlags, + NodeFlags, + ObjectLiteralElementLike, + ParameterDeclaration, + PropertyAccessExpression, + RefactorActionInfo, + RefactorContext, + RefactorEditInfo, + ShorthandPropertyAssignment, + SignatureKind, + SourceFile, + Statement, + StringLiteral, + Symbol, + SymbolFlags, + SyntaxKind, + TextRange, + TextSpan, + TryStatement, + Type, + TypeChecker, + TypeElement, + TypeFlags, + TypeLiteralNode, + TypeNode, + TypeParameter, + TypeParameterDeclaration, + VariableDeclaration, + VisitResult, + __String, + arrayFrom, + assertType, + canHaveModifiers, + codefix, + compareProperties, + compareStringsCaseSensitive, + compareValues, + contains, + createDiagnosticForNode, + createFileDiagnostic, + emptyArray, + factory, + find, + findAncestor, + findFirstNonJsxWhitespaceToken, + findTokenOnLeftOfPosition, + first, + firstOrUndefined, + forEachChild, + formatStringFromArgs, + getContainingClass, + getContainingFunction, + getEffectiveTypeParameterDeclarations, + getEmitScriptTarget, + getEnclosingBlockScopeContainer, + getLocaleSpecificMessage, + getModifiers, + getNodeId, + getParentNodeInSpan, + getRefactorContextSpan, + getRenameLocation, + getSymbolId, + getSynthesizedDeepClone, + getThisContainer, + getUniqueName, + hasEffectiveModifier, + hasSyntacticModifier, + isArray, + isArrowFunction, + isAssignmentExpression, + isBinaryExpression, + isBlock, + isBlockScope, + isCaseClause, + isClassLike, + isConstructorDeclaration, + isDeclaration, + isDeclarationWithTypeParameters, + isElementAccessExpression, + isExpression, + isExpressionNode, + isExpressionStatement, + isFunctionBody, + isFunctionExpression, + isFunctionLike, + isFunctionLikeDeclaration, + isIdentifier, + isInJSFile, + isIterationStatement, + isJsxAttribute, + isJsxElement, + isJsxFragment, + isJsxSelfClosingElement, + isKeyword, + isModuleBlock, + isParenthesizedTypeNode, + isPartOfTypeNode, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyDeclaration, + isQualifiedName, + isReturnStatement, + isShorthandPropertyAssignment, + isSourceFile, + isStatement, + isStatic, + isStringLiteral, + isSwitchStatement, + isThis, + isUnaryExpressionWithWrite, + isUnionTypeNode, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + last, + map, + nullTransformationContext, + positionIsSynthesized, + rangeContainsStartEnd, + setEmitFlags, + singleOrUndefined, + skipParentheses, + suppressLeadingAndTrailingTrivia, + textChanges, + textSpanEnd, + visitEachChild, + visitNode, + visitNodes, } from "../_namespaces/ts"; -import { refactorKindBeginsWith, registerRefactor } from "../_namespaces/ts.refactor"; +import { + refactorKindBeginsWith, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Extract Symbol"; diff --git a/src/services/refactors/extractType.ts b/src/services/refactors/extractType.ts index 6cb298c0ffe13..8df87debd1542 100644 --- a/src/services/refactors/extractType.ts +++ b/src/services/refactors/extractType.ts @@ -1,16 +1,72 @@ import { - addRange, addToSeen, append, ApplicableRefactorInfo, cast, concatenate, createTextRangeFromSpan, Debug, Diagnostics, - EmitFlags, emptyArray, factory, findAncestor, forEach, forEachChild, getEffectiveConstraintOfTypeParameter, - getLineAndCharacterOfPosition, getLocaleSpecificMessage, getNameFromPropertyName, getRefactorContextSpan, - getRenameLocation, getTokenAtPosition, getUniqueName, ignoreSourceNewlines, isConditionalTypeNode, isFunctionLike, - isIdentifier, isInferTypeNode, isIntersectionTypeNode, isJSDocTypeExpression, isParenthesizedTypeNode, - isSourceFileJS, isStatement, isThisIdentifier, isThisTypeNode, isTupleTypeNode, isTypeLiteralNode, isTypeNode, - isTypeParameterDeclaration, isTypePredicateNode, isTypeQueryNode, isTypeReferenceNode, JSDocTag, JSDocTemplateTag, - Node, nodeOverlapsWithStartEnd, pushIfUnique, rangeContainsStartEnd, RefactorContext, RefactorEditInfo, - setEmitFlags, setTextRange, skipTrivia, SourceFile, Statement, SymbolFlags, textChanges, TextRange, TypeChecker, - TypeElement, TypeNode, TypeParameterDeclaration, + ApplicableRefactorInfo, + Debug, + Diagnostics, + EmitFlags, + JSDocTag, + JSDocTemplateTag, + Node, + RefactorContext, + RefactorEditInfo, + SourceFile, + Statement, + SymbolFlags, + TextRange, + TypeChecker, + TypeElement, + TypeNode, + TypeParameterDeclaration, + addRange, + addToSeen, + append, + cast, + concatenate, + createTextRangeFromSpan, + emptyArray, + factory, + findAncestor, + forEach, + forEachChild, + getEffectiveConstraintOfTypeParameter, + getLineAndCharacterOfPosition, + getLocaleSpecificMessage, + getNameFromPropertyName, + getRefactorContextSpan, + getRenameLocation, + getTokenAtPosition, + getUniqueName, + ignoreSourceNewlines, + isConditionalTypeNode, + isFunctionLike, + isIdentifier, + isInferTypeNode, + isIntersectionTypeNode, + isJSDocTypeExpression, + isParenthesizedTypeNode, + isSourceFileJS, + isStatement, + isThisIdentifier, + isThisTypeNode, + isTupleTypeNode, + isTypeLiteralNode, + isTypeNode, + isTypeParameterDeclaration, + isTypePredicateNode, + isTypeQueryNode, + isTypeReferenceNode, + nodeOverlapsWithStartEnd, + pushIfUnique, + rangeContainsStartEnd, + setEmitFlags, + setTextRange, + skipTrivia, + textChanges, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, RefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + RefactorErrorInfo, + isRefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const refactorName = "Extract type"; diff --git a/src/services/refactors/generateGetAccessorAndSetAccessor.ts b/src/services/refactors/generateGetAccessorAndSetAccessor.ts index d8d70a1ea3abf..58c8796cc08fd 100644 --- a/src/services/refactors/generateGetAccessorAndSetAccessor.ts +++ b/src/services/refactors/generateGetAccessorAndSetAccessor.ts @@ -1,8 +1,18 @@ import { - ApplicableRefactorInfo, codefix, Debug, Diagnostics, emptyArray, getRenameLocation, isIdentifier, isParameter, + ApplicableRefactorInfo, + Debug, + Diagnostics, RefactorContext, + codefix, + emptyArray, + getRenameLocation, + isIdentifier, + isParameter, } from "../_namespaces/ts"; -import { isRefactorErrorInfo, registerRefactor } from "../_namespaces/ts.refactor"; +import { + isRefactorErrorInfo, + registerRefactor, +} from "../_namespaces/ts.refactor"; const actionName = "Generate 'get' and 'set' accessors"; const actionDescription = Diagnostics.Generate_get_and_set_accessors.message; diff --git a/src/services/refactors/inferFunctionReturnType.ts b/src/services/refactors/inferFunctionReturnType.ts index c81a08bf4b164..7a31be79c606f 100644 --- a/src/services/refactors/inferFunctionReturnType.ts +++ b/src/services/refactors/inferFunctionReturnType.ts @@ -1,11 +1,37 @@ import { - ApplicableRefactorInfo, ArrowFunction, Diagnostics, emptyArray, factory, findAncestor, findChildOfKind, first, - FunctionDeclaration, FunctionExpression, getLocaleSpecificMessage, getTokenAtPosition, isArrowFunction, isBlock, - isInJSFile, mapDefined, MethodDeclaration, Node, NodeBuilderFlags, RefactorContext, RefactorEditInfo, SourceFile, - SyntaxKind, textChanges, Type, TypeChecker, TypeNode, + ApplicableRefactorInfo, + ArrowFunction, + Diagnostics, + FunctionDeclaration, + FunctionExpression, + MethodDeclaration, + Node, + NodeBuilderFlags, + RefactorContext, + RefactorEditInfo, + SourceFile, + SyntaxKind, + Type, + TypeChecker, + TypeNode, + emptyArray, + factory, + findAncestor, + findChildOfKind, + first, + getLocaleSpecificMessage, + getTokenAtPosition, + isArrowFunction, + isBlock, + isInJSFile, + mapDefined, + textChanges, } from "../_namespaces/ts"; import { - isRefactorErrorInfo, RefactorErrorInfo, refactorKindBeginsWith, registerRefactor, + RefactorErrorInfo, + isRefactorErrorInfo, + refactorKindBeginsWith, + registerRefactor, } from "../_namespaces/ts.refactor"; const refactorName = "Infer function return type"; diff --git a/src/services/refactors/moveToNewFile.ts b/src/services/refactors/moveToNewFile.ts index 58687f7b7cb57..20e8dceafb311 100644 --- a/src/services/refactors/moveToNewFile.ts +++ b/src/services/refactors/moveToNewFile.ts @@ -1,25 +1,131 @@ import { - AnyImportOrRequireStatement, append, ApplicableRefactorInfo, AssignmentDeclarationKind, BinaryExpression, - BindingElement, BindingName, CallExpression, canHaveDecorators, canHaveModifiers, cast, ClassDeclaration, codefix, - combinePaths, concatenate, contains, copyEntries, createTextRangeFromSpan, Debug, Declaration, DeclarationStatement, - Diagnostics, emptyArray, ensurePathIsNonModuleName, EnumDeclaration, escapeLeadingUnderscores, Expression, - ExpressionStatement, extensionFromPath, ExternalModuleReference, factory, find, FindAllReferences, findIndex, - firstDefined, flatMap, forEachEntry, FunctionDeclaration, getAssignmentDeclarationKind, getBaseFileName, - GetCanonicalFileName, getDecorators, getDirectoryPath, getLocaleSpecificMessage, getModifiers, - getPropertySymbolFromBindingElement, getQuotePreference, getRangesWhere, getRefactorContextSpan, - getRelativePathFromFile, getSymbolId, getUniqueName, hasSyntacticModifier, hostGetCanonicalFileName, Identifier, - ImportDeclaration, ImportEqualsDeclaration, insertImports, InterfaceDeclaration, InternalSymbolName, - isArrayLiteralExpression, isBinaryExpression, isBindingElement, isDeclarationName, isExpressionStatement, - isExternalModuleReference, isIdentifier, isImportDeclaration, isImportEqualsDeclaration, isNamedDeclaration, - isObjectLiteralExpression, isOmittedExpression, isPrologueDirective, isPropertyAccessExpression, - isPropertyAssignment, isRequireCall, isSourceFile, isStringLiteral, isStringLiteralLike, isVariableDeclaration, - isVariableDeclarationList, isVariableStatement, LanguageServiceHost, last, length, makeImportIfNecessary, - mapDefined, ModifierFlags, ModifierLike, ModuleDeclaration, NamedImportBindings, Node, NodeFlags, nodeSeenTracker, - normalizePath, ObjectBindingElementWithoutPropertyName, Program, PropertyAccessExpression, PropertyAssignment, - QuotePreference, rangeContainsRange, RefactorContext, RefactorEditInfo, removeFileExtension, RequireOrImportCall, - RequireVariableStatement, ScriptTarget, skipAlias, some, SourceFile, Statement, StringLiteralLike, Symbol, - SymbolFlags, symbolNameNoDefault, SyntaxKind, takeWhile, textChanges, TransformFlags, tryCast, TypeAliasDeclaration, - TypeChecker, TypeNode, UserPreferences, VariableDeclaration, VariableDeclarationList, VariableStatement, + AnyImportOrRequireStatement, + ApplicableRefactorInfo, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + BindingName, + CallExpression, + ClassDeclaration, + Debug, + Declaration, + DeclarationStatement, + Diagnostics, + EnumDeclaration, + Expression, + ExpressionStatement, + ExternalModuleReference, + FindAllReferences, + FunctionDeclaration, + GetCanonicalFileName, + Identifier, + ImportDeclaration, + ImportEqualsDeclaration, + InterfaceDeclaration, + InternalSymbolName, + LanguageServiceHost, + ModifierFlags, + ModifierLike, + ModuleDeclaration, + NamedImportBindings, + Node, + NodeFlags, + ObjectBindingElementWithoutPropertyName, + Program, + PropertyAccessExpression, + PropertyAssignment, + QuotePreference, + RefactorContext, + RefactorEditInfo, + RequireOrImportCall, + RequireVariableStatement, + ScriptTarget, + SourceFile, + Statement, + StringLiteralLike, + Symbol, + SymbolFlags, + SyntaxKind, + TransformFlags, + TypeAliasDeclaration, + TypeChecker, + TypeNode, + UserPreferences, + VariableDeclaration, + VariableDeclarationList, + VariableStatement, + append, + canHaveDecorators, + canHaveModifiers, + cast, + codefix, + combinePaths, + concatenate, + contains, + copyEntries, + createTextRangeFromSpan, + emptyArray, + ensurePathIsNonModuleName, + escapeLeadingUnderscores, + extensionFromPath, + factory, + find, + findIndex, + firstDefined, + flatMap, + forEachEntry, + getAssignmentDeclarationKind, + getBaseFileName, + getDecorators, + getDirectoryPath, + getLocaleSpecificMessage, + getModifiers, + getPropertySymbolFromBindingElement, + getQuotePreference, + getRangesWhere, + getRefactorContextSpan, + getRelativePathFromFile, + getSymbolId, + getUniqueName, + hasSyntacticModifier, + hostGetCanonicalFileName, + insertImports, + isArrayLiteralExpression, + isBinaryExpression, + isBindingElement, + isDeclarationName, + isExpressionStatement, + isExternalModuleReference, + isIdentifier, + isImportDeclaration, + isImportEqualsDeclaration, + isNamedDeclaration, + isObjectLiteralExpression, + isOmittedExpression, + isPrologueDirective, + isPropertyAccessExpression, + isPropertyAssignment, + isRequireCall, + isSourceFile, + isStringLiteral, + isStringLiteralLike, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + last, + length, + makeImportIfNecessary, + mapDefined, + nodeSeenTracker, + normalizePath, + rangeContainsRange, + removeFileExtension, + skipAlias, + some, + symbolNameNoDefault, + takeWhile, + textChanges, + tryCast, } from "../_namespaces/ts"; import { registerRefactor } from "../_namespaces/ts.refactor"; diff --git a/src/services/rename.ts b/src/services/rename.ts index 7508c150d41b4..e23873907e500 100644 --- a/src/services/rename.ts +++ b/src/services/rename.ts @@ -1,13 +1,56 @@ import { - compareStringsCaseSensitive, Comparison, createTextSpan, DiagnosticMessage, Diagnostics, endsWith, every, Extension, - fileExtensionIs, find, getAdjustedRenameLocation, getContextualTypeFromParentOrAncestorTypeNode, - getLocaleSpecificMessage, getPathComponents, getTextOfIdentifierOrLiteral, getTextOfNode, getTouchingPropertyName, - ImportSpecifier, isExternalModuleNameRelative, isIdentifier, isImportOrExportSpecifierName, isImportSpecifier, - isInsideNodeModules, isLabelName, isLiteralNameOfPropertyDeclarationOrIndexAccess, isSourceFile, - isStringLiteralLike, isStringOrNumericLiteralLike, Node, NumericLiteral, Path, Program, removeFileExtension, - RenameInfo, RenameInfoFailure, RenameInfoSuccess, ScriptElementKind, ScriptElementKindModifier, some, SourceFile, - StringLiteralLike, stripQuotes, Symbol, SymbolDisplay, SymbolFlags, SyntaxKind, tryGetImportFromModuleSpecifier, - tryRemoveSuffix, TypeChecker, TypeFlags, UnionType, UserPreferences, + Comparison, + DiagnosticMessage, + Diagnostics, + Extension, + ImportSpecifier, + Node, + NumericLiteral, + Path, + Program, + RenameInfo, + RenameInfoFailure, + RenameInfoSuccess, + ScriptElementKind, + ScriptElementKindModifier, + SourceFile, + StringLiteralLike, + Symbol, + SymbolDisplay, + SymbolFlags, + SyntaxKind, + TypeChecker, + TypeFlags, + UnionType, + UserPreferences, + compareStringsCaseSensitive, + createTextSpan, + endsWith, + every, + fileExtensionIs, + find, + getAdjustedRenameLocation, + getContextualTypeFromParentOrAncestorTypeNode, + getLocaleSpecificMessage, + getPathComponents, + getTextOfIdentifierOrLiteral, + getTextOfNode, + getTouchingPropertyName, + isExternalModuleNameRelative, + isIdentifier, + isImportOrExportSpecifierName, + isImportSpecifier, + isInsideNodeModules, + isLabelName, + isLiteralNameOfPropertyDeclarationOrIndexAccess, + isSourceFile, + isStringLiteralLike, + isStringOrNumericLiteralLike, + removeFileExtension, + some, + stripQuotes, + tryGetImportFromModuleSpecifier, + tryRemoveSuffix, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/services.ts b/src/services/services.ts index ac4c3bb15c1d5..48d2b98804cbd 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,59 +2,322 @@ import * as ts from "./_namespaces/ts"; import * as NavigateTo from "./_namespaces/ts.NavigateTo"; import * as NavigationBar from "./_namespaces/ts.NavigationBar"; import { - __String, ApplicableRefactorInfo, ApplyCodeActionCommandResult, AssignmentDeclarationKind, BaseType, - BinaryExpression, BreakpointResolver, CallHierarchy, CallHierarchyIncomingCall, CallHierarchyItem, - CallHierarchyOutgoingCall, CancellationToken, changeCompilerHostLikeToUseCache, CharacterCodes, CheckJsDirective, - Classifications, ClassifiedSpan, ClassifiedSpan2020, classifier, CodeActionCommand, codefix, CodeFixAction, - CombinedCodeActions, CombinedCodeFixScope, combinePaths, compareValues, CompilerHost, CompilerOptions, - CompletionEntryData, CompletionEntryDetails, CompletionInfo, Completions, computePositionOfLineAndCharacter, - computeSuggestionDiagnostics, createDocumentRegistry, createGetCanonicalFileName, createMultiMap, createProgram, - CreateProgramOptions, createSourceFile, CreateSourceFileOptions, createTextSpanFromBounds, createTextSpanFromNode, - createTextSpanFromRange, Debug, Declaration, deduplicate, DefinitionInfo, DefinitionInfoAndBoundSpan, Diagnostic, - DiagnosticWithLocation, directoryProbablyExists, DocCommentTemplateOptions, DocumentHighlights, DocumentRegistry, - DocumentSpan, EditorOptions, EditorSettings, ElementAccessExpression, EmitTextWriter, emptyArray, emptyOptions, - EndOfFileToken, EntityName, equateValues, ExportDeclaration, FileReference, FileTextChanges, filter, find, - FindAllReferences, findChildOfKind, findPrecedingToken, first, firstDefined, firstOrOnly, flatMap, forEach, - forEachChild, FormatCodeOptions, FormatCodeSettings, formatting, FunctionLikeDeclaration, GeneratedIdentifierFlags, - getAdjustedRenameLocation, getAllSuperTypeNodes, getAssignmentDeclarationKind, GetCompletionsAtPositionOptions, - getContainerNode, getDefaultLibFileName, getDirectoryPath, getEmitDeclarations, getEntries, - getEscapedTextOfIdentifierOrLiteral, getFileEmitOutput, getImpliedNodeFormatForFile, getJSDocTags, - getLineAndCharacterOfPosition, getLineStarts, getMappedDocumentSpan, getNameFromPropertyName, getNewLineCharacter, - getNewLineOrDefaultFromHost, getNonAssignedNameOfDeclaration, getNormalizedAbsolutePath, getObjectFlags, - getScriptKind, getSetExternalModuleIndicator, getSnapshotText, getSourceFileOfNode, getSourceMapper, - getTokenPosOfNode, getTouchingPropertyName, getTouchingToken, GoToDefinition, HasInvalidatedResolutions, - hasJSDocNodes, hasProperty, hasStaticModifier, hasSyntacticModifier, HighlightSpanKind, HostCancellationToken, - hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, Identifier, identity, idText, ImplementationLocation, - ImportDeclaration, IndexKind, IndexType, InlayHint, InlayHints, InlayHintsContext, insertSorted, InterfaceType, - IntersectionType, isArray, isBindingPattern, isComputedPropertyName, isConstTypeReference, IScriptSnapshot, - isDeclarationName, isGetAccessor, isIdentifier, isImportMeta, isInComment, isInsideJsxElement, - isInsideJsxElementOrAttribute, isInString, isInTemplateString, isIntrinsicJsxName, isJSDocCommentContainingNode, - isJsxAttributes, isJsxClosingElement, isJsxElement, isJsxFragment, isJsxOpeningElement, isJsxOpeningFragment, - isJsxText, isLabelName, isLiteralComputedPropertyDeclarationName, isNamedExports, isNamedTupleMember, - isNameOfModuleDeclaration, isNewExpression, isNodeKind, isObjectLiteralElement, isObjectLiteralExpression, - isPrivateIdentifier, isProgramUptoDate, isPropertyAccessExpression, isPropertyName, isRightSideOfPropertyAccess, - isRightSideOfQualifiedName, isSetAccessor, isStringOrNumericLiteralLike, isTagName, isTextWhiteSpaceLike, - isThisTypeParameter, JsDoc, JSDoc, JSDocContainer, JSDocTagInfo, JsonSourceFile, JsxAttributes, JsxClosingTagInfo, - JsxElement, JsxEmit, JsxFragment, LanguageService, LanguageServiceHost, LanguageServiceMode, LanguageVariant, - lastOrUndefined, length, LineAndCharacter, lineBreakPart, LiteralType, map, mapDefined, MapLike, mapOneOrMany, - maybeBind, maybeSetLocalizedDiagnosticMessages, ModeAwareCache, ModifierFlags, ModuleDeclaration, NavigateToItem, - NavigationBarItem, NavigationTree, Node, NodeArray, NodeFlags, noop, normalizePath, NumberLiteralType, - NumericLiteral, ObjectAllocator, ObjectFlags, ObjectLiteralElement, ObjectLiteralExpression, - OperationCanceledException, OrganizeImports, OrganizeImportsArgs, OrganizeImportsMode, OutliningElementsCollector, - OutliningSpan, ParseConfigFileHost, ParsedCommandLine, parseJsonSourceFileConfigFileContent, Path, - positionIsSynthesized, PossibleProgramFileInfo, PragmaMap, PrivateIdentifier, Program, PropertyName, Push, - QuickInfo, refactor, RefactorContext, RefactorEditInfo, RefactorTriggerReason, ReferencedSymbol, ReferenceEntry, - Rename, RenameInfo, RenameInfoOptions, RenameLocation, ResolvedModuleFull, ResolvedProjectReference, - ResolvedTypeReferenceDirective, returnFalse, scanner, ScriptElementKind, ScriptElementKindModifier, ScriptKind, - ScriptTarget, SelectionRange, SemanticClassificationFormat, setObjectAllocator, Signature, - SignatureDeclaration, SignatureFlags, SignatureHelp, SignatureHelpItems, SignatureHelpItemsOptions, SignatureKind, - singleElementArray, SmartSelectionRange, SortedArray, SourceFile, SourceFileLike, SourceMapSource, Statement, - stringContains, StringLiteral, StringLiteralLike, StringLiteralType, Symbol, SymbolDisplay, SymbolDisplayPart, - SymbolFlags, symbolName, SyntaxKind, SyntaxList, tagNamesAreEquivalent, TextChange, TextChangeRange, TextInsertion, - TextRange, TextSpan, textSpanEnd, timestamp, TodoComment, TodoCommentDescriptor, Token, toPath, tracing, - TransformFlags, TransientSymbol, Type, TypeChecker, TypeFlags, TypeNode, TypeParameter, TypePredicate, - TypeReference, typeToDisplayParts, UnderscoreEscapedMap, UnionOrIntersectionType, UnionType, updateSourceFile, - UserPreferences, VariableDeclaration, + ApplicableRefactorInfo, + ApplyCodeActionCommandResult, + AssignmentDeclarationKind, + BaseType, + BinaryExpression, + BreakpointResolver, + CallHierarchy, + CallHierarchyIncomingCall, + CallHierarchyItem, + CallHierarchyOutgoingCall, + CancellationToken, + CharacterCodes, + CheckJsDirective, + Classifications, + ClassifiedSpan, + ClassifiedSpan2020, + CodeActionCommand, + CodeFixAction, + CombinedCodeActions, + CombinedCodeFixScope, + CompilerHost, + CompilerOptions, + CompletionEntryData, + CompletionEntryDetails, + CompletionInfo, + Completions, + CreateProgramOptions, + CreateSourceFileOptions, + Debug, + Declaration, + DefinitionInfo, + DefinitionInfoAndBoundSpan, + Diagnostic, + DiagnosticWithLocation, + DocCommentTemplateOptions, + DocumentHighlights, + DocumentRegistry, + DocumentSpan, + EditorOptions, + EditorSettings, + ElementAccessExpression, + EmitTextWriter, + EndOfFileToken, + EntityName, + ExportDeclaration, + FileReference, + FileTextChanges, + FindAllReferences, + FormatCodeOptions, + FormatCodeSettings, + FunctionLikeDeclaration, + GeneratedIdentifierFlags, + GetCompletionsAtPositionOptions, + GoToDefinition, + HasInvalidatedResolutions, + HighlightSpanKind, + HostCancellationToken, + IScriptSnapshot, + Identifier, + ImplementationLocation, + ImportDeclaration, + IndexKind, + IndexType, + InlayHint, + InlayHints, + InlayHintsContext, + InterfaceType, + IntersectionType, + JSDoc, + JSDocContainer, + JSDocTagInfo, + JsDoc, + JsonSourceFile, + JsxAttributes, + JsxClosingTagInfo, + JsxElement, + JsxEmit, + JsxFragment, + LanguageService, + LanguageServiceHost, + LanguageServiceMode, + LanguageVariant, + LineAndCharacter, + LiteralType, + MapLike, + ModeAwareCache, + ModifierFlags, + ModuleDeclaration, + NavigateToItem, + NavigationBarItem, + NavigationTree, + Node, + NodeArray, + NodeFlags, + NumberLiteralType, + NumericLiteral, + ObjectAllocator, + ObjectFlags, + ObjectLiteralElement, + ObjectLiteralExpression, + OperationCanceledException, + OrganizeImports, + OrganizeImportsArgs, + OrganizeImportsMode, + OutliningElementsCollector, + OutliningSpan, + ParseConfigFileHost, + ParsedCommandLine, + Path, + PossibleProgramFileInfo, + PragmaMap, + PrivateIdentifier, + Program, + PropertyName, + Push, + QuickInfo, + RefactorContext, + RefactorEditInfo, + RefactorTriggerReason, + ReferenceEntry, + ReferencedSymbol, + Rename, + RenameInfo, + RenameInfoOptions, + RenameLocation, + ResolvedModuleFull, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptElementKind, + ScriptElementKindModifier, + ScriptKind, + ScriptTarget, + SelectionRange, + SemanticClassificationFormat, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureHelp, + SignatureHelpItems, + SignatureHelpItemsOptions, + SignatureKind, + SmartSelectionRange, + SortedArray, + SourceFile, + SourceFileLike, + SourceMapSource, + Statement, + StringLiteral, + StringLiteralLike, + StringLiteralType, + Symbol, + SymbolDisplay, + SymbolDisplayPart, + SymbolFlags, + SyntaxKind, + SyntaxList, + TextChange, + TextChangeRange, + TextInsertion, + TextRange, + TextSpan, + TodoComment, + TodoCommentDescriptor, + Token, + TransformFlags, + TransientSymbol, + Type, + TypeChecker, + TypeFlags, + TypeNode, + TypeParameter, + TypePredicate, + TypeReference, + UnderscoreEscapedMap, + UnionOrIntersectionType, + UnionType, + UserPreferences, + VariableDeclaration, + __String, + changeCompilerHostLikeToUseCache, + classifier, + codefix, + combinePaths, + compareValues, + computePositionOfLineAndCharacter, + computeSuggestionDiagnostics, + createDocumentRegistry, + createGetCanonicalFileName, + createMultiMap, + createProgram, + createSourceFile, + createTextSpanFromBounds, + createTextSpanFromNode, + createTextSpanFromRange, + deduplicate, + directoryProbablyExists, + emptyArray, + emptyOptions, + equateValues, + filter, + find, + findChildOfKind, + findPrecedingToken, + first, + firstDefined, + firstOrOnly, + flatMap, + forEach, + forEachChild, + formatting, + getAdjustedRenameLocation, + getAllSuperTypeNodes, + getAssignmentDeclarationKind, + getContainerNode, + getDefaultLibFileName, + getDirectoryPath, + getEmitDeclarations, + getEntries, + getEscapedTextOfIdentifierOrLiteral, + getFileEmitOutput, + getImpliedNodeFormatForFile, + getJSDocTags, + getLineAndCharacterOfPosition, + getLineStarts, + getMappedDocumentSpan, + getNameFromPropertyName, + getNewLineCharacter, + getNewLineOrDefaultFromHost, + getNonAssignedNameOfDeclaration, + getNormalizedAbsolutePath, + getObjectFlags, + getScriptKind, + getSetExternalModuleIndicator, + getSnapshotText, + getSourceFileOfNode, + getSourceMapper, + getTokenPosOfNode, + getTouchingPropertyName, + getTouchingToken, + hasJSDocNodes, + hasProperty, + hasStaticModifier, + hasSyntacticModifier, + hostGetCanonicalFileName, + hostUsesCaseSensitiveFileNames, + idText, + identity, + insertSorted, + isArray, + isBindingPattern, + isComputedPropertyName, + isConstTypeReference, + isDeclarationName, + isGetAccessor, + isIdentifier, + isImportMeta, + isInComment, + isInString, + isInTemplateString, + isInsideJsxElement, + isInsideJsxElementOrAttribute, + isIntrinsicJsxName, + isJSDocCommentContainingNode, + isJsxAttributes, + isJsxClosingElement, + isJsxElement, + isJsxFragment, + isJsxOpeningElement, + isJsxOpeningFragment, + isJsxText, + isLabelName, + isLiteralComputedPropertyDeclarationName, + isNameOfModuleDeclaration, + isNamedExports, + isNamedTupleMember, + isNewExpression, + isNodeKind, + isObjectLiteralElement, + isObjectLiteralExpression, + isPrivateIdentifier, + isProgramUptoDate, + isPropertyAccessExpression, + isPropertyName, + isRightSideOfPropertyAccess, + isRightSideOfQualifiedName, + isSetAccessor, + isStringOrNumericLiteralLike, + isTagName, + isTextWhiteSpaceLike, + isThisTypeParameter, + lastOrUndefined, + length, + lineBreakPart, + map, + mapDefined, + mapOneOrMany, + maybeBind, + maybeSetLocalizedDiagnosticMessages, + noop, + normalizePath, + parseJsonSourceFileConfigFileContent, + positionIsSynthesized, + refactor, + returnFalse, + scanner, + setObjectAllocator, + singleElementArray, + stringContains, + symbolName, + tagNamesAreEquivalent, + textSpanEnd, + timestamp, + toPath, + tracing, + typeToDisplayParts, + updateSourceFile, } from "./_namespaces/ts"; /** The version of the language service API */ diff --git a/src/services/shims.ts b/src/services/shims.ts index 50849ae0875db..ee748bcf30a8a 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -1,16 +1,70 @@ import { - Classifications, Classifier, clear, CompilerOptions, CompletionEntryData, createClassifier, createDocumentRegistry, - createGetCanonicalFileName, createLanguageService, createTextChangeRange, createTextSpan, Diagnostic, - diagnosticCategoryName, DocCommentTemplateOptions, DocumentRegistry, EditorOptions, EmitOutput, emptyOptions, - EndOfLineState, Extension, extensionFromPath, FileReference, filter, flattenDiagnosticMessageText, - FormatCodeOptions, FormatCodeSettings, getAutomaticTypeDirectiveNames, GetCompletionsAtPositionOptions, - getDefaultCompilerOptions, getDirectoryPath, getFileMatcherPatterns, getNewLineOrDefaultFromHost, getProperty, - getSnapshotText, HostCancellationToken, IScriptSnapshot, isString, JsTyping, LanguageService, LanguageServiceHost, - map, MapLike, ModuleResolutionHost, normalizeSlashes, OperationCanceledException, ParseConfigHost, - parseJsonSourceFileConfigFileContent, parseJsonText, preProcessFile, ResolvedModuleFull, - ResolvedTypeReferenceDirective, resolveModuleName, resolveTypeReferenceDirective, ScriptKind, - SemanticClassificationFormat, servicesVersion, SignatureHelpItemsOptions, TextChangeRange, TextRange, TextSpan, - ThrottledCancellationToken, timestamp, toFileNameLowerCase, toPath, TypeAcquisition, UserPreferences, + Classifications, + Classifier, + CompilerOptions, + CompletionEntryData, + Diagnostic, + DocCommentTemplateOptions, + DocumentRegistry, + EditorOptions, + EmitOutput, + EndOfLineState, + Extension, + FileReference, + FormatCodeOptions, + FormatCodeSettings, + GetCompletionsAtPositionOptions, + HostCancellationToken, + IScriptSnapshot, + JsTyping, + LanguageService, + LanguageServiceHost, + MapLike, + ModuleResolutionHost, + OperationCanceledException, + ParseConfigHost, + ResolvedModuleFull, + ResolvedTypeReferenceDirective, + ScriptKind, + SemanticClassificationFormat, + SignatureHelpItemsOptions, + TextChangeRange, + TextRange, + TextSpan, + ThrottledCancellationToken, + TypeAcquisition, + UserPreferences, + clear, + createClassifier, + createDocumentRegistry, + createGetCanonicalFileName, + createLanguageService, + createTextChangeRange, + createTextSpan, + diagnosticCategoryName, + emptyOptions, + extensionFromPath, + filter, + flattenDiagnosticMessageText, + getAutomaticTypeDirectiveNames, + getDefaultCompilerOptions, + getDirectoryPath, + getFileMatcherPatterns, + getNewLineOrDefaultFromHost, + getProperty, + getSnapshotText, + isString, + map, + normalizeSlashes, + parseJsonSourceFileConfigFileContent, + parseJsonText, + preProcessFile, + resolveModuleName, + resolveTypeReferenceDirective, + servicesVersion, + timestamp, + toFileNameLowerCase, + toPath, } from "./_namespaces/ts"; // diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index cf672d0699634..9b7ed534cd896 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -1,17 +1,85 @@ import { - ArrowFunction, BinaryExpression, CallLikeExpression, CancellationToken, CheckFlags, contains, countWhere, - createPrinter, createTextSpan, createTextSpanFromBounds, createTextSpanFromNode, Debug, EmitHint, emptyArray, - Expression, factory, findContainingList, findIndex, findPrecedingToken, findTokenOnLeftOfPosition, first, - firstDefined, flatMapToMutable, FunctionExpression, getInvokedExpression, getPossibleGenericSignatures, - getPossibleTypeArgumentsInfo, Identifier, identity, InternalSymbolName, isBinaryExpression, isBlock, - isCallOrNewExpression, isFunctionTypeNode, isIdentifier, isInComment, isInsideTemplateLiteral, isInString, - isJsxOpeningLikeElement, isMethodDeclaration, isNoSubstitutionTemplateLiteral, isPropertyAccessExpression, - isSourceFile, isSourceFileJS, isTaggedTemplateExpression, isTemplateHead, isTemplateLiteralToken, isTemplateSpan, - isTemplateTail, last, lastOrUndefined, ListFormat, map, mapToDisplayParts, Node, NodeBuilderFlags, - ParameterDeclaration, ParenthesizedExpression, Printer, Program, punctuationPart, rangeContainsRange, Signature, - SignatureHelpItem, SignatureHelpItems, SignatureHelpParameter, SignatureHelpTriggerReason, skipTrivia, SourceFile, - spacePart, Symbol, SymbolDisplayPart, symbolToDisplayParts, SyntaxKind, TaggedTemplateExpression, - TemplateExpression, TextSpan, TransientSymbol, Type, TypeChecker, TypeParameter, + ArrowFunction, + BinaryExpression, + CallLikeExpression, + CancellationToken, + CheckFlags, + Debug, + EmitHint, + Expression, + FunctionExpression, + Identifier, + InternalSymbolName, + ListFormat, + Node, + NodeBuilderFlags, + ParameterDeclaration, + ParenthesizedExpression, + Printer, + Program, + Signature, + SignatureHelpItem, + SignatureHelpItems, + SignatureHelpParameter, + SignatureHelpTriggerReason, + SourceFile, + Symbol, + SymbolDisplayPart, + SyntaxKind, + TaggedTemplateExpression, + TemplateExpression, + TextSpan, + TransientSymbol, + Type, + TypeChecker, + TypeParameter, + contains, + countWhere, + createPrinter, + createTextSpan, + createTextSpanFromBounds, + createTextSpanFromNode, + emptyArray, + factory, + findContainingList, + findIndex, + findPrecedingToken, + findTokenOnLeftOfPosition, + first, + firstDefined, + flatMapToMutable, + getInvokedExpression, + getPossibleGenericSignatures, + getPossibleTypeArgumentsInfo, + identity, + isBinaryExpression, + isBlock, + isCallOrNewExpression, + isFunctionTypeNode, + isIdentifier, + isInComment, + isInString, + isInsideTemplateLiteral, + isJsxOpeningLikeElement, + isMethodDeclaration, + isNoSubstitutionTemplateLiteral, + isPropertyAccessExpression, + isSourceFile, + isSourceFileJS, + isTaggedTemplateExpression, + isTemplateHead, + isTemplateLiteralToken, + isTemplateSpan, + isTemplateTail, + last, + lastOrUndefined, + map, + mapToDisplayParts, + punctuationPart, + rangeContainsRange, + skipTrivia, + spacePart, + symbolToDisplayParts, } from "./_namespaces/ts"; const enum InvocationKind { Call, TypeArgs, Contextual } diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index 04ffc73c4b10a..670fe269afd80 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -1,12 +1,51 @@ import { - CharacterCodes, compact, contains, createTextSpanFromBounds, Debug, findIndex, first, getTokenPosOfNode, - getTouchingPropertyName, getTrailingCommentRanges, hasJSDocNodes, isBindingElement, isBlock, isFunctionBody, - isFunctionLikeDeclaration, isImportDeclaration, isImportEqualsDeclaration, isJSDocSignature, isJSDocTypeExpression, - isJSDocTypeLiteral, isMappedTypeNode, isParameter, isPropertySignature, isSourceFile, isStringLiteral, isSyntaxList, - isTemplateHead, isTemplateLiteral, isTemplateMiddleOrTemplateTail, isTemplateSpan, isTemplateTail, - isVariableDeclaration, isVariableDeclarationList, isVariableStatement, last, Node, or, parseNodeFactory, - positionsAreOnSameLine, SelectionRange, setTextRangePosEnd, singleOrUndefined, SourceFile, SyntaxKind, SyntaxList, - textSpanIntersectsWithPosition, textSpansEqual, + CharacterCodes, + Debug, + Node, + SelectionRange, + SourceFile, + SyntaxKind, + SyntaxList, + compact, + contains, + createTextSpanFromBounds, + findIndex, + first, + getTokenPosOfNode, + getTouchingPropertyName, + getTrailingCommentRanges, + hasJSDocNodes, + isBindingElement, + isBlock, + isFunctionBody, + isFunctionLikeDeclaration, + isImportDeclaration, + isImportEqualsDeclaration, + isJSDocSignature, + isJSDocTypeExpression, + isJSDocTypeLiteral, + isMappedTypeNode, + isParameter, + isPropertySignature, + isSourceFile, + isStringLiteral, + isSyntaxList, + isTemplateHead, + isTemplateLiteral, + isTemplateMiddleOrTemplateTail, + isTemplateSpan, + isTemplateTail, + isVariableDeclaration, + isVariableDeclarationList, + isVariableStatement, + last, + or, + parseNodeFactory, + positionsAreOnSameLine, + setTextRangePosEnd, + singleOrUndefined, + textSpanIntersectsWithPosition, + textSpansEqual, } from "./_namespaces/ts"; /** @internal */ diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index ba242bed8559c..02a1cb4b27549 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -1,10 +1,30 @@ import * as ts from "./_namespaces/ts"; import { - base64decode, computeLineAndCharacterOfPosition, createDocumentPositionMapper, createGetCanonicalFileName, - DocumentPosition, DocumentPositionMapper, DocumentPositionMapperHost, Extension, - getDeclarationEmitOutputFilePathWorker, getDirectoryPath, getLineInfo, getLineStarts, getNormalizedAbsolutePath, - identitySourceMapConsumer, isDeclarationFileName, isString, LineAndCharacter, LineInfo, outFile, Program, - removeFileExtension, SourceFileLike, sys, tryGetSourceMappingURL, tryParseRawSourceMap, + DocumentPosition, + DocumentPositionMapper, + DocumentPositionMapperHost, + Extension, + LineAndCharacter, + LineInfo, + Program, + SourceFileLike, + base64decode, + computeLineAndCharacterOfPosition, + createDocumentPositionMapper, + createGetCanonicalFileName, + getDeclarationEmitOutputFilePathWorker, + getDirectoryPath, + getLineInfo, + getLineStarts, + getNormalizedAbsolutePath, + identitySourceMapConsumer, + isDeclarationFileName, + isString, + outFile, + removeFileExtension, + sys, + tryGetSourceMappingURL, + tryParseRawSourceMap, } from "./_namespaces/ts"; const base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 3dc68ff39b633..456fe19e6a324 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1,32 +1,155 @@ import { - addToSeen, altDirectorySeparator, arrayFrom, CallLikeExpression, CancellationToken, changeExtension, CharacterCodes, - combinePaths, comparePaths, comparePatternKeys, compareStringsCaseSensitive, compareValues, Comparison, - CompilerOptions, CompletionEntry, CompletionEntryDetails, CompletionInfo, contains, containsPath, ContextFlags, - createSortedArray, createTextSpan, createTextSpanFromStringLiteralLikeContent, Debug, deduplicate, - directorySeparator, ElementAccessExpression, emptyArray, endsWith, ensureTrailingDirectorySeparator, - equateStringsCaseSensitive, Extension, fileExtensionIsOneOf, filter, find, findAncestor, findPackageJson, - findPackageJsons, firstDefined, firstOrUndefined, flatMap, flatten, forEachAncestorDirectory, getBaseFileName, - getContextualTypeFromParent, getDirectoryPath, getEffectiveTypeRoots, getEmitModuleResolutionKind, - getLeadingCommentRanges, getModeForUsageLocation, getOwnKeys, getPackageJsonTypesVersionsPaths, getPathComponents, - getReplacementSpanForContextToken, getSupportedExtensions, getSupportedExtensionsWithJsonIfResolveJsonModule, - getTokenAtPosition, hasIndexSignature, hasProperty, hasTrailingDirectorySeparator, hostGetCanonicalFileName, - IndexedAccessTypeNode, isApplicableVersionedTypesKey, isArray, isCallExpression, isIdentifier, isIdentifierText, - isImportCall, isInReferenceComment, isInString, isJsxAttribute, isJsxOpeningLikeElement, isLiteralTypeNode, - isObjectLiteralExpression, isPatternMatch, isPrivateIdentifierClassElementDeclaration, isRootedDiskPath, isString, - isStringLiteral, isStringLiteralLike, isTypeReferenceNode, isUrl, JsxAttribute, LanguageServiceHost, - length, LiteralExpression, LiteralTypeNode, mapDefined, MapLike, ModuleKind, ModuleResolutionKind, - moduleSpecifiers, Node, normalizePath, normalizeSlashes, ObjectLiteralExpression, Path, Program, PropertyAssignment, - rangeContainsPosition, readJson, removeFileExtension, removePrefix, removeTrailingDirectorySeparator, ResolutionMode, resolvePath, - ScriptElementKind, ScriptElementKindModifier, ScriptTarget, Signature, signatureHasRestParameter, SignatureHelp, - singleElementArray, skipConstraint, skipParentheses, SourceFile, startsWith, stringContains, StringLiteralLike, - StringLiteralType, stripQuotes, Symbol, SyntaxKind, textPart, TextSpan, tryAndIgnoreErrors, tryDirectoryExists, - tryFileExists, tryGetDirectories, tryGetExtensionFromPath, tryParsePattern, tryReadDirectory, - tryRemoveDirectoryPrefix, tryRemovePrefix, Type, TypeChecker, TypeFlags, UnionTypeNode, unmangleScopedPackageName, - UserPreferences, walkUpParenthesizedExpressions, walkUpParenthesizedTypes, + CallLikeExpression, + CancellationToken, + CharacterCodes, + Comparison, + CompilerOptions, + CompletionEntry, + CompletionEntryDetails, + CompletionInfo, + ContextFlags, + Debug, + ElementAccessExpression, + Extension, + IndexedAccessTypeNode, + JsxAttribute, + LanguageServiceHost, + LiteralExpression, + LiteralTypeNode, + MapLike, + ModuleKind, + ModuleResolutionKind, + Node, + ObjectLiteralExpression, + Path, + Program, + PropertyAssignment, + ResolutionMode, + ScriptElementKind, + ScriptElementKindModifier, + ScriptTarget, + Signature, + SignatureHelp, + SourceFile, + StringLiteralLike, + StringLiteralType, + Symbol, + SyntaxKind, + TextSpan, + Type, + TypeChecker, + TypeFlags, + UnionTypeNode, + UserPreferences, + addToSeen, + altDirectorySeparator, + arrayFrom, + changeExtension, + combinePaths, + comparePaths, + comparePatternKeys, + compareStringsCaseSensitive, + compareValues, + contains, + containsPath, + createSortedArray, + createTextSpan, + createTextSpanFromStringLiteralLikeContent, + deduplicate, + directorySeparator, + emptyArray, + endsWith, + ensureTrailingDirectorySeparator, + equateStringsCaseSensitive, + fileExtensionIsOneOf, + filter, + find, + findAncestor, + findPackageJson, + findPackageJsons, + firstDefined, + firstOrUndefined, + flatMap, + flatten, + forEachAncestorDirectory, + getBaseFileName, + getContextualTypeFromParent, + getDirectoryPath, + getEffectiveTypeRoots, + getEmitModuleResolutionKind, + getLeadingCommentRanges, + getModeForUsageLocation, + getOwnKeys, + getPackageJsonTypesVersionsPaths, + getPathComponents, + getReplacementSpanForContextToken, + getSupportedExtensions, + getSupportedExtensionsWithJsonIfResolveJsonModule, + getTokenAtPosition, + hasIndexSignature, + hasProperty, + hasTrailingDirectorySeparator, + hostGetCanonicalFileName, + isApplicableVersionedTypesKey, + isArray, + isCallExpression, + isIdentifier, + isIdentifierText, + isImportCall, + isInReferenceComment, + isInString, + isJsxAttribute, + isJsxOpeningLikeElement, + isLiteralTypeNode, + isObjectLiteralExpression, + isPatternMatch, + isPrivateIdentifierClassElementDeclaration, + isRootedDiskPath, + isString, + isStringLiteral, + isStringLiteralLike, + isTypeReferenceNode, + isUrl, + length, + mapDefined, + moduleSpecifiers, + normalizePath, + normalizeSlashes, + rangeContainsPosition, + readJson, + removeFileExtension, + removePrefix, + removeTrailingDirectorySeparator, + resolvePath, + signatureHasRestParameter, + singleElementArray, + skipConstraint, + skipParentheses, + startsWith, + stringContains, + stripQuotes, + textPart, + tryAndIgnoreErrors, + tryDirectoryExists, + tryFileExists, + tryGetDirectories, + tryGetExtensionFromPath, + tryParsePattern, + tryReadDirectory, + tryRemoveDirectoryPrefix, + tryRemovePrefix, + unmangleScopedPackageName, + walkUpParenthesizedExpressions, + walkUpParenthesizedTypes, } from "./_namespaces/ts"; import { - CompletionKind, createCompletionDetails, createCompletionDetailsForSymbol, getCompletionEntriesFromSymbols, - getPropertiesForObjectExpression, Log, SortText, + CompletionKind, + Log, + SortText, + createCompletionDetails, + createCompletionDetailsForSymbol, + getCompletionEntriesFromSymbols, + getPropertiesForObjectExpression, } from "./_namespaces/ts.Completions"; interface NameAndKindSet { diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index 4fc0b29a9cede..e7ee92edc2a05 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -1,14 +1,63 @@ import { - addRange, AnyValidImportOrReExport, ArrowFunction, AssignmentDeclarationKind, Block, CallExpression, - CancellationToken, codefix, compilerOptionsIndicateEsModules, createDiagnosticForNode, Diagnostics, - DiagnosticWithLocation, Expression, ExpressionStatement, Extension, fileExtensionIsOneOf, forEachReturnStatement, - FunctionDeclaration, FunctionExpression, FunctionFlags, FunctionLikeDeclaration, getAllowSyntheticDefaultImports, - getAssignmentDeclarationKind, getFunctionFlags, getModeForUsageLocation, getResolvedModule, hasInitializer, - hasPropertyAccessExpressionWithName, Identifier, importFromModuleSpecifier, isAsyncFunction, isBinaryExpression, - isBlock, isCallExpression, isExportAssignment, isFunctionLike, isIdentifier, isPropertyAccessExpression, - isRequireCall, isReturnStatement, isSourceFileJS, isStringLiteral, isVariableDeclaration, isVariableStatement, - MethodDeclaration, ModuleKind, Node, NodeFlags, Program, programContainsEsModules, PropertyAccessExpression, Push, - ReturnStatement, skipAlias, some, SourceFile, SyntaxKind, TypeChecker, VariableStatement, + AnyValidImportOrReExport, + ArrowFunction, + AssignmentDeclarationKind, + Block, + CallExpression, + CancellationToken, + DiagnosticWithLocation, + Diagnostics, + Expression, + ExpressionStatement, + Extension, + FunctionDeclaration, + FunctionExpression, + FunctionFlags, + FunctionLikeDeclaration, + Identifier, + MethodDeclaration, + ModuleKind, + Node, + NodeFlags, + Program, + PropertyAccessExpression, + Push, + ReturnStatement, + SourceFile, + SyntaxKind, + TypeChecker, + VariableStatement, + addRange, + codefix, + compilerOptionsIndicateEsModules, + createDiagnosticForNode, + fileExtensionIsOneOf, + forEachReturnStatement, + getAllowSyntheticDefaultImports, + getAssignmentDeclarationKind, + getFunctionFlags, + getModeForUsageLocation, + getResolvedModule, + hasInitializer, + hasPropertyAccessExpressionWithName, + importFromModuleSpecifier, + isAsyncFunction, + isBinaryExpression, + isBlock, + isCallExpression, + isExportAssignment, + isFunctionLike, + isIdentifier, + isPropertyAccessExpression, + isRequireCall, + isReturnStatement, + isSourceFileJS, + isStringLiteral, + isVariableDeclaration, + isVariableStatement, + programContainsEsModules, + skipAlias, + some, } from "./_namespaces/ts"; const visitedNestedConvertibleFunctions = new Map(); diff --git a/src/services/symbolDisplay.ts b/src/services/symbolDisplay.ts index b31c32e592c4a..ce6be17232d6e 100644 --- a/src/services/symbolDisplay.ts +++ b/src/services/symbolDisplay.ts @@ -1,22 +1,111 @@ import { - addRange, arrayFrom, BinaryExpression, CallExpression, CheckFlags, contains, createPrinter, Debug, displayPart, - EmitHint, emptyArray, EnumMember, ExportAssignment, find, first, firstDefined, forEach, GetAccessorDeclaration, - getCombinedLocalAndExportSymbolFlags, getDeclarationOfKind, getExternalModuleImportEqualsDeclarationExpression, - getMeaningFromLocation, getNameOfDeclaration, getNodeModifiers, getObjectFlags, getParseTreeNode, - getSourceFileOfNode, getTextOfConstantValue, getTextOfIdentifierOrLiteral, getTextOfNode, hasSyntacticModifier, - idText, ImportEqualsDeclaration, isArrowFunction, isBindingElement, isCallExpression, isCallExpressionTarget, - isCallOrNewExpression, isClassExpression, isConstTypeReference, isDeprecatedDeclaration, isEnumConst, - isEnumDeclaration, isExpression, isExternalModuleImportEqualsDeclaration, isFirstDeclarationOfSymbolParameter, - isFunctionBlock, isFunctionExpression, isFunctionLike, isFunctionLikeKind, isIdentifier, isInExpressionContext, - isJsxOpeningLikeElement, isLet, isModuleWithStringLiteralName, isNameOfFunctionDeclaration, isNewExpressionTarget, - isObjectBindingPattern, isTaggedTemplateExpression, isThisInTypeQuery, isVarConst, JSDocTagInfo, - JsxOpeningLikeElement, keywordPart, length, lineBreakPart, ListFormat, mapToDisplayParts, ModifierFlags, - ModuleDeclaration, NewExpression, Node, NodeBuilderFlags, ObjectFlags, operatorPart, Printer, - PropertyAccessExpression, PropertyDeclaration, punctuationPart, ScriptElementKind, ScriptElementKindModifier, - SemanticMeaning, SetAccessorDeclaration, Signature, SignatureDeclaration, SignatureFlags, - signatureToDisplayParts, some, SourceFile, spacePart, Symbol, SymbolDisplayPart, SymbolDisplayPartKind, SymbolFlags, - SymbolFormatFlags, symbolToDisplayParts, SyntaxKind, TaggedTemplateExpression, textOrKeywordPart, textPart, - TransientSymbol, Type, TypeChecker, TypeFormatFlags, TypeParameter, typeToDisplayParts, VariableDeclaration, + BinaryExpression, + CallExpression, + CheckFlags, + Debug, + EmitHint, + EnumMember, + ExportAssignment, + GetAccessorDeclaration, + ImportEqualsDeclaration, + JSDocTagInfo, + JsxOpeningLikeElement, + ListFormat, + ModifierFlags, + ModuleDeclaration, + NewExpression, + Node, + NodeBuilderFlags, + ObjectFlags, + Printer, + PropertyAccessExpression, + PropertyDeclaration, + ScriptElementKind, + ScriptElementKindModifier, + SemanticMeaning, + SetAccessorDeclaration, + Signature, + SignatureDeclaration, + SignatureFlags, + SourceFile, + Symbol, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolFormatFlags, + SyntaxKind, + TaggedTemplateExpression, + TransientSymbol, + Type, + TypeChecker, + TypeFormatFlags, + TypeParameter, + VariableDeclaration, + addRange, + arrayFrom, + contains, + createPrinter, + displayPart, + emptyArray, + find, + first, + firstDefined, + forEach, + getCombinedLocalAndExportSymbolFlags, + getDeclarationOfKind, + getExternalModuleImportEqualsDeclarationExpression, + getMeaningFromLocation, + getNameOfDeclaration, + getNodeModifiers, + getObjectFlags, + getParseTreeNode, + getSourceFileOfNode, + getTextOfConstantValue, + getTextOfIdentifierOrLiteral, + getTextOfNode, + hasSyntacticModifier, + idText, + isArrowFunction, + isBindingElement, + isCallExpression, + isCallExpressionTarget, + isCallOrNewExpression, + isClassExpression, + isConstTypeReference, + isDeprecatedDeclaration, + isEnumConst, + isEnumDeclaration, + isExpression, + isExternalModuleImportEqualsDeclaration, + isFirstDeclarationOfSymbolParameter, + isFunctionBlock, + isFunctionExpression, + isFunctionLike, + isFunctionLikeKind, + isIdentifier, + isInExpressionContext, + isJsxOpeningLikeElement, + isLet, + isModuleWithStringLiteralName, + isNameOfFunctionDeclaration, + isNewExpressionTarget, + isObjectBindingPattern, + isTaggedTemplateExpression, + isThisInTypeQuery, + isVarConst, + keywordPart, + length, + lineBreakPart, + mapToDisplayParts, + operatorPart, + punctuationPart, + signatureToDisplayParts, + some, + spacePart, + symbolToDisplayParts, + textOrKeywordPart, + textPart, + typeToDisplayParts, } from "./_namespaces/ts"; const symbolDisplayNodeBuilderFlags = NodeBuilderFlags.OmitParameterModifiers | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope; diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index ddf9c67cd1976..acd409803c53e 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1,31 +1,172 @@ import { - addToSeen, ArrowFunction, BindingElement, CharacterCodes, ClassElement, ClassExpression, ClassLikeDeclaration, - CommentRange, concatenate, ConstructorDeclaration, contains, createNodeFactory, createPrinter, createRange, - createSourceFile, createTextChange, createTextRangeFromSpan, createTextSpan, createTextSpanFromRange, - createTextWriter, Debug, DeclarationStatement, EmitHint, EmitTextWriter, endsWith, Expression, factory, - FileTextChanges, filter, find, findChildOfKind, findLastIndex, findNextToken, findPrecedingToken, first, - firstOrUndefined, flatMap, flatMapToMutable, formatting, FunctionDeclaration, FunctionExpression, getAncestor, - getFirstNonSpaceCharacterPosition, getFormatCodeSettingsForWriting, getJSDocCommentRanges, getLeadingCommentRanges, - getLineAndCharacterOfPosition, getLineOfLocalPosition, getLineStartPositionForPosition, getNewLineKind, - getNewLineOrDefaultFromHost, getNodeId, getPrecedingNonSpaceCharacterPosition, getScriptKindFromFileName, - getShebang, getStartPositionOfLine, getTokenAtPosition, getTouchingToken, getTrailingCommentRanges, group, HasJSDoc, - hasJSDocNodes, ImportClause, ImportSpecifier, indexOfNode, InterfaceDeclaration, intersperse, isAnyImportSyntax, - isArray, isArrowFunction, isCallExpression, isClassElement, isClassOrTypeElement, isExpressionStatement, - isFunctionDeclaration, isFunctionExpression, isFunctionLike, isIdentifier, isImportClause, isImportDeclaration, - isImportSpecifier, isInComment, isInJSXText, isInString, isInTemplateString, isInterfaceDeclaration, - isJsonSourceFile, isLineBreak, isNamedImports, isObjectLiteralExpression, isParameter, isPinnedComment, - isPrologueDirective, isPropertyDeclaration, isPropertySignature, isRecognizedTripleSlashComment, isStatement, - isStatementButNotDeclaration, isString, isStringLiteral, isSuperCall, isVariableDeclaration, isWhiteSpaceLike, - isWhiteSpaceSingleLine, JSDoc, JSDocComment, JSDocParameterTag, JSDocReturnTag, JSDocTag, JSDocTypeTag, - LanguageServiceHost, last, lastOrUndefined, length, mapDefined, MethodSignature, Modifier, NamedImportBindings, - NamedImports, NamespaceImport, Node, NodeArray, NodeFactoryFlags, nodeIsSynthesized, nullTransformationContext, - ObjectLiteralElementLike, ObjectLiteralExpression, ParameterDeclaration, positionsAreOnSameLine, PrintHandlers, - PrologueDirective, PropertyAssignment, PropertyDeclaration, PropertySignature, rangeContainsPosition, - rangeContainsRangeExclusive, rangeOfNode, rangeOfTypeParameters, rangeStartPositionsAreOnSameLine, removeSuffix, - ScriptKind, ScriptTarget, setTextRangePosEnd, SignatureDeclaration, singleOrUndefined, skipTrivia, SourceFile, - SourceFileLike, stableSort, Statement, stringContainsAt, Symbol, SyntaxKind, TextChange, TextRange, textSpanEnd, - Token, tokenToString, TransformationContext, TypeLiteralNode, TypeNode, TypeParameterDeclaration, UserPreferences, - VariableDeclaration, VariableStatement, visitEachChild, visitNodes, Visitor, + ArrowFunction, + BindingElement, + CharacterCodes, + ClassElement, + ClassExpression, + ClassLikeDeclaration, + CommentRange, + ConstructorDeclaration, + Debug, + DeclarationStatement, + EmitHint, + EmitTextWriter, + Expression, + FileTextChanges, + FunctionDeclaration, + FunctionExpression, + HasJSDoc, + ImportClause, + ImportSpecifier, + InterfaceDeclaration, + JSDoc, + JSDocComment, + JSDocParameterTag, + JSDocReturnTag, + JSDocTag, + JSDocTypeTag, + LanguageServiceHost, + MethodSignature, + Modifier, + NamedImportBindings, + NamedImports, + NamespaceImport, + Node, + NodeArray, + NodeFactoryFlags, + ObjectLiteralElementLike, + ObjectLiteralExpression, + ParameterDeclaration, + PrintHandlers, + PrologueDirective, + PropertyAssignment, + PropertyDeclaration, + PropertySignature, + ScriptKind, + ScriptTarget, + SignatureDeclaration, + SourceFile, + SourceFileLike, + Statement, + Symbol, + SyntaxKind, + TextChange, + TextRange, + Token, + TransformationContext, + TypeLiteralNode, + TypeNode, + TypeParameterDeclaration, + UserPreferences, + VariableDeclaration, + VariableStatement, + Visitor, + addToSeen, + concatenate, + contains, + createNodeFactory, + createPrinter, + createRange, + createSourceFile, + createTextChange, + createTextRangeFromSpan, + createTextSpan, + createTextSpanFromRange, + createTextWriter, + endsWith, + factory, + filter, + find, + findChildOfKind, + findLastIndex, + findNextToken, + findPrecedingToken, + first, + firstOrUndefined, + flatMap, + flatMapToMutable, + formatting, + getAncestor, + getFirstNonSpaceCharacterPosition, + getFormatCodeSettingsForWriting, + getJSDocCommentRanges, + getLeadingCommentRanges, + getLineAndCharacterOfPosition, + getLineOfLocalPosition, + getLineStartPositionForPosition, + getNewLineKind, + getNewLineOrDefaultFromHost, + getNodeId, + getPrecedingNonSpaceCharacterPosition, + getScriptKindFromFileName, + getShebang, + getStartPositionOfLine, + getTokenAtPosition, + getTouchingToken, + getTrailingCommentRanges, + group, + hasJSDocNodes, + indexOfNode, + intersperse, + isAnyImportSyntax, + isArray, + isArrowFunction, + isCallExpression, + isClassElement, + isClassOrTypeElement, + isExpressionStatement, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isIdentifier, + isImportClause, + isImportDeclaration, + isImportSpecifier, + isInComment, + isInJSXText, + isInString, + isInTemplateString, + isInterfaceDeclaration, + isJsonSourceFile, + isLineBreak, + isNamedImports, + isObjectLiteralExpression, + isParameter, + isPinnedComment, + isPrologueDirective, + isPropertyDeclaration, + isPropertySignature, + isRecognizedTripleSlashComment, + isStatement, + isStatementButNotDeclaration, + isString, + isStringLiteral, + isSuperCall, + isVariableDeclaration, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, + last, + lastOrUndefined, + length, + mapDefined, + nodeIsSynthesized, + nullTransformationContext, + positionsAreOnSameLine, + rangeContainsPosition, + rangeContainsRangeExclusive, + rangeOfNode, + rangeOfTypeParameters, + rangeStartPositionsAreOnSameLine, + removeSuffix, + setTextRangePosEnd, + singleOrUndefined, + skipTrivia, + stableSort, + stringContainsAt, + textSpanEnd, + tokenToString, + visitEachChild, + visitNodes, } from "./_namespaces/ts"; /** diff --git a/src/services/transform.ts b/src/services/transform.ts index f76326ea3fd2a..91622afcae8c9 100644 --- a/src/services/transform.ts +++ b/src/services/transform.ts @@ -1,6 +1,14 @@ import { - CompilerOptions, concatenate, DiagnosticWithLocation, factory, fixupCompilerOptions, isArray, Node, - TransformationResult, TransformerFactory, transformNodes, + CompilerOptions, + DiagnosticWithLocation, + Node, + TransformationResult, + TransformerFactory, + concatenate, + factory, + fixupCompilerOptions, + isArray, + transformNodes, } from "./_namespaces/ts"; /** diff --git a/src/services/transpile.ts b/src/services/transpile.ts index b21da9696c1dc..83b0b4eb9d4da 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -1,9 +1,32 @@ import { - addRange, cloneCompilerOptions, CommandLineOptionOfCustomType, CompilerHost, CompilerOptions, - createCompilerDiagnosticForInvalidCustomType, createProgram, createSourceFile, CustomTransformers, Debug, - Diagnostic, fileExtensionIs, filter, forEachEntry, getDefaultCompilerOptions, getEmitScriptTarget, getEntries, - getImpliedNodeFormatForFile, getNewLineCharacter, getSetExternalModuleIndicator, hasProperty, isString, - MapLike, normalizePath, optionDeclarations, parseCustomTypeOption, toPath, transpileOptionValueCompilerOptions, + CommandLineOptionOfCustomType, + CompilerHost, + CompilerOptions, + CustomTransformers, + Debug, + Diagnostic, + MapLike, + addRange, + cloneCompilerOptions, + createCompilerDiagnosticForInvalidCustomType, + createProgram, + createSourceFile, + fileExtensionIs, + filter, + forEachEntry, + getDefaultCompilerOptions, + getEmitScriptTarget, + getEntries, + getImpliedNodeFormatForFile, + getNewLineCharacter, + getSetExternalModuleIndicator, + hasProperty, + isString, + normalizePath, + optionDeclarations, + parseCustomTypeOption, + toPath, + transpileOptionValueCompilerOptions, } from "./_namespaces/ts"; export interface TranspileOptions { diff --git a/src/services/types.ts b/src/services/types.ts index 22a3c4a1f76dd..93ae373681330 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1,11 +1,44 @@ import { - CancellationToken, CompilerHost, CompilerOptions, CustomTransformers, Diagnostic, DiagnosticWithLocation, - DocumentHighlights, DocumentPositionMapper, EmitOutput, ExportInfoMap, FileReference, - GetEffectiveTypeRootsHost, HasChangedAutomaticTypeDirectiveNames, HasInvalidatedResolutions, LineAndCharacter, - MinimalResolutionCacheHost, ModuleResolutionCache, ModuleResolutionInfo, ModuleSpecifierCache, - ParsedCommandLine, Path, Program, ProjectReference, ResolutionMode, ResolvedModule, ResolvedModuleWithFailedLookupLocations, - ResolvedProjectReference, ResolvedTypeReferenceDirective, ScriptKind, SourceFile, SourceFileLike, SourceMapper, - Symbol, SymlinkCache, TextChangeRange, textChanges, TextRange, TextSpan, TypeReferenceDirectiveResolutionInfo, UserPreferences, + CancellationToken, + CompilerHost, + CompilerOptions, + CustomTransformers, + Diagnostic, + DiagnosticWithLocation, + DocumentHighlights, + DocumentPositionMapper, + EmitOutput, + ExportInfoMap, + FileReference, + GetEffectiveTypeRootsHost, + HasChangedAutomaticTypeDirectiveNames, + HasInvalidatedResolutions, + LineAndCharacter, + MinimalResolutionCacheHost, + ModuleResolutionCache, + ModuleResolutionInfo, + ModuleSpecifierCache, + ParsedCommandLine, + Path, + Program, + ProjectReference, + ResolutionMode, + ResolvedModule, + ResolvedModuleWithFailedLookupLocations, + ResolvedProjectReference, + ResolvedTypeReferenceDirective, + ScriptKind, + SourceFile, + SourceFileLike, + SourceMapper, + Symbol, + SymlinkCache, + TextChangeRange, + TextRange, + TextSpan, + TypeReferenceDirectiveResolutionInfo, + UserPreferences, + textChanges, } from "./_namespaces/ts"; declare module "../compiler/types" { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index b32f090bebcda..c80e49a5a79c5 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1,63 +1,356 @@ import { - __String, addEmitFlags, addSyntheticLeadingComment, addSyntheticTrailingComment, AnyImportOrRequireStatement, - assertType, AssignmentDeclarationKind, BinaryExpression, binarySearchKey, BindingElement, BreakOrContinueStatement, - CallExpression, canHaveModifiers, CaseClause, cast, CatchClause, CharacterCodes, ClassDeclaration, ClassExpression, - clone, codefix, combinePaths, CommentKind, CommentRange, compareTextSpans, compareValues, Comparison, - CompilerOptions, ConditionalExpression, contains, createPrinter, createRange, createScanner, createTextSpan, - createTextSpanFromBounds, Debug, Declaration, Decorator, defaultMaximumTruncationLength, DeleteExpression, - Diagnostic, DiagnosticMessage, DiagnosticWithLocation, directoryProbablyExists, DisplayPartsSymbolWriter, - DocumentPosition, DocumentSpan, DoStatement, ElementAccessExpression, EmitFlags, EmitHint, emptyArray, - EndOfFileToken, ensureScriptKind, EqualityOperator, escapeString, ExportAssignment, ExportDeclaration, Expression, - ExpressionStatement, factory, FileTextChanges, filter, find, findAncestor, findConfigFile, first, firstDefined, - firstOrUndefined, forEachAncestorDirectory, forEachChild, forEachLeadingCommentRange, forEachTrailingCommentRange, - FormatCodeSettings, formatStringFromArgs, formatting, FormattingHost, ForOfStatement, FunctionDeclaration, - FunctionExpression, FunctionLikeDeclaration, getAssignmentDeclarationKind, getCombinedNodeFlagsAlwaysIncludeJSDoc, - getDirectoryPath, getEmitScriptTarget, getExternalModuleImportEqualsDeclarationExpression, getIndentString, - getJSDocEnumTag, getLastChild, getLineAndCharacterOfPosition, getLineStarts, getLocaleSpecificMessage, - getModuleInstanceState, getNameOfDeclaration, getNodeId, getPackageNameFromTypesPackageName, getPathComponents, - getRootDeclaration, getSourceFileOfNode, getSpanOfTokenAtPosition, getSymbolId, getTextOfIdentifierOrLiteral, - getTextOfNode, getTypesPackageName, hasSyntacticModifier, HeritageClause, Identifier, identifierIsThisKeyword, - identity, idText, IfStatement, ImportClause, ImportDeclaration, ImportSpecifier, ImportTypeNode, indexOfNode, - IndexSignatureDeclaration, InternalSymbolName, isAmbientModule, isAnyImportSyntax, isArray, isArrayBindingPattern, - isArrayTypeNode, isAsExpression, isAwaitExpression, isBinaryExpression, isBindingElement, - isBreakOrContinueStatement, isCallExpression, isCallOrNewExpression, isClassDeclaration, isClassExpression, - isClassStaticBlockDeclaration, isConditionalTypeNode, IScriptSnapshot, isDeclaration, isDeclarationName, - isDecorator, isDeleteExpression, isElementAccessExpression, isEntityName, isEnumDeclaration, isExportAssignment, - isExportDeclaration, isExportSpecifier, isExpression, isExpressionNode, isExternalModule, - isExternalModuleImportEqualsDeclaration, isExternalModuleReference, isFileLevelUniqueName, isForInStatement, - isForOfStatement, isFunctionBlock, isFunctionDeclaration, isFunctionExpression, isFunctionLike, - isGetAccessorDeclaration, isGlobalScopeAugmentation, isHeritageClause, isIdentifier, isImportCall, isImportClause, - isImportDeclaration, isImportEqualsDeclaration, isImportOrExportSpecifier, isImportSpecifier, isInferTypeNode, - isInJSFile, isInterfaceDeclaration, isInternalModuleImportEqualsDeclaration, isJSDoc, isJSDocCommentContainingNode, - isJSDocLink, isJSDocLinkCode, isJSDocLinkLike, isJSDocMemberName, isJSDocNameReference, isJSDocTag, - isJSDocTemplateTag, isJSDocTypeAlias, isJsxElement, isJsxExpression, isJsxOpeningLikeElement, isJsxText, isKeyword, - isLabeledStatement, isLet, isLiteralTypeNode, isMappedTypeNode, isModifier, isModuleBlock, isModuleDeclaration, - isNamedDeclaration, isNamedExports, isNamedImports, isNamespaceExport, isNamespaceImport, isNewExpression, - isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isOptionalChain, isOptionalChainRoot, - isParameter, isPartOfTypeNode, isPrivateIdentifier, isPropertyAccessExpression, isPropertyNameLiteral, - isQualifiedName, isRequireCall, isRequireVariableStatement, isRightSideOfQualifiedNameOrPropertyAccess, - isRootedDiskPath, isSetAccessorDeclaration, isSourceFile, isSourceFileJS, isStringDoubleQuoted, isStringLiteral, - isStringLiteralLike, isStringOrNumericLiteralLike, isStringTextContainingNode, isSyntaxList, - isTaggedTemplateExpression, isTemplateLiteralKind, isToken, isTypeAliasDeclaration, isTypeElement, isTypeNode, - isTypeOfExpression, isTypeOperatorNode, isTypeParameterDeclaration, isTypeReferenceNode, isVarConst, - isVariableDeclarationList, isVoidExpression, isWhiteSpaceLike, isWhiteSpaceSingleLine, isYieldExpression, - IterationStatement, JSDocLink, JSDocLinkCode, JSDocLinkDisplayPart, JSDocLinkPlain, JSDocTypedefTag, JsTyping, - JsxEmit, JsxOpeningLikeElement, LabeledStatement, LanguageServiceHost, last, lastOrUndefined, LiteralExpression, - map, maybeBind, Modifier, ModifierFlags, ModuleDeclaration, ModuleInstanceState, ModuleResolutionKind, - ModuleSpecifierResolutionHost, moduleSpecifiers, Mutable, NewExpression, NewLineKind, Node, NodeArray, - NodeBuilderFlags, NodeFlags, nodeIsMissing, nodeIsPresent, nodeIsSynthesized, noop, normalizePath, - NoSubstitutionTemplateLiteral, notImplemented, nullTransformationContext, NumericLiteral, or, OrganizeImports, - PackageJsonDependencyGroup, pathIsRelative, PrefixUnaryExpression, Program, ProjectPackageJsonInfo, - PropertyAccessExpression, PropertyAssignment, PropertyName, QualifiedName, RefactorContext, Scanner, - ScriptElementKind, ScriptElementKindModifier, ScriptKind, ScriptTarget, SemicolonPreference, setConfigFileInOptions, - setOriginalNode, setTextRange, Signature, SignatureDeclaration, singleOrUndefined, skipAlias, skipOuterExpressions, - some, SourceFile, SourceFileLike, SourceMapper, SpreadElement, stableSort, startsWith, stringContains, - StringLiteral, StringLiteralLike, stringToToken, stripQuotes, Symbol, SymbolAccessibility, SymbolDisplayPart, - SymbolDisplayPartKind, SymbolFlags, SymbolFormatFlags, SymbolTracker, SyntaxKind, SyntaxList, - TaggedTemplateExpression, TemplateExpression, TemplateLiteralToken, TemplateSpan, TextChange, textChanges, - TextRange, TextSpan, textSpanContainsPosition, textSpanContainsTextSpan, textSpanEnd, Token, tokenToString, - TransientSymbol, tryCast, Type, TypeChecker, TypeFormatFlags, TypeNode, TypeOfExpression, TypeQueryNode, - unescapeLeadingUnderscores, UserPreferences, VariableDeclaration, visitEachChild, VoidExpression, YieldExpression, + AnyImportOrRequireStatement, + AssignmentDeclarationKind, + BinaryExpression, + BindingElement, + BreakOrContinueStatement, + CallExpression, + CaseClause, + CatchClause, + CharacterCodes, + ClassDeclaration, + ClassExpression, + CommentKind, + CommentRange, + Comparison, + CompilerOptions, + ConditionalExpression, + Debug, + Declaration, + Decorator, + DeleteExpression, + Diagnostic, + DiagnosticMessage, + DiagnosticWithLocation, + DisplayPartsSymbolWriter, + DoStatement, + DocumentPosition, + DocumentSpan, + ElementAccessExpression, + EmitFlags, + EmitHint, + EndOfFileToken, + EqualityOperator, + ExportAssignment, + ExportDeclaration, + Expression, + ExpressionStatement, + FileTextChanges, + ForOfStatement, + FormatCodeSettings, + FormattingHost, + FunctionDeclaration, + FunctionExpression, + FunctionLikeDeclaration, + HeritageClause, + IScriptSnapshot, + Identifier, + IfStatement, + ImportClause, + ImportDeclaration, + ImportSpecifier, + ImportTypeNode, + IndexSignatureDeclaration, + InternalSymbolName, + IterationStatement, + JSDocLink, + JSDocLinkCode, + JSDocLinkDisplayPart, + JSDocLinkPlain, + JSDocTypedefTag, + JsTyping, + JsxEmit, + JsxOpeningLikeElement, + LabeledStatement, + LanguageServiceHost, + LiteralExpression, + Modifier, + ModifierFlags, + ModuleDeclaration, + ModuleInstanceState, + ModuleResolutionKind, + ModuleSpecifierResolutionHost, + Mutable, + NewExpression, + NewLineKind, + NoSubstitutionTemplateLiteral, + Node, + NodeArray, + NodeBuilderFlags, + NodeFlags, + NumericLiteral, + OrganizeImports, + PackageJsonDependencyGroup, + PrefixUnaryExpression, + Program, + ProjectPackageJsonInfo, + PropertyAccessExpression, + PropertyAssignment, + PropertyName, + QualifiedName, + RefactorContext, + Scanner, + ScriptElementKind, + ScriptElementKindModifier, + ScriptKind, + ScriptTarget, + SemicolonPreference, + Signature, + SignatureDeclaration, + SourceFile, + SourceFileLike, + SourceMapper, + SpreadElement, + StringLiteral, + StringLiteralLike, + Symbol, + SymbolAccessibility, + SymbolDisplayPart, + SymbolDisplayPartKind, + SymbolFlags, + SymbolFormatFlags, + SymbolTracker, + SyntaxKind, + SyntaxList, + TaggedTemplateExpression, + TemplateExpression, + TemplateLiteralToken, + TemplateSpan, + TextChange, + TextRange, + TextSpan, + Token, + TransientSymbol, + Type, + TypeChecker, + TypeFormatFlags, + TypeNode, + TypeOfExpression, + TypeQueryNode, + UserPreferences, + VariableDeclaration, + VoidExpression, + YieldExpression, + __String, + addEmitFlags, + addSyntheticLeadingComment, + addSyntheticTrailingComment, + assertType, + binarySearchKey, + canHaveModifiers, + cast, + clone, + codefix, + combinePaths, + compareTextSpans, + compareValues, + contains, + createPrinter, + createRange, + createScanner, + createTextSpan, + createTextSpanFromBounds, + defaultMaximumTruncationLength, + directoryProbablyExists, + emptyArray, + ensureScriptKind, + escapeString, + factory, + filter, + find, + findAncestor, + findConfigFile, + first, + firstDefined, + firstOrUndefined, + forEachAncestorDirectory, + forEachChild, + forEachLeadingCommentRange, + forEachTrailingCommentRange, + formatStringFromArgs, + formatting, + getAssignmentDeclarationKind, + getCombinedNodeFlagsAlwaysIncludeJSDoc, + getDirectoryPath, + getEmitScriptTarget, + getExternalModuleImportEqualsDeclarationExpression, + getIndentString, + getJSDocEnumTag, + getLastChild, + getLineAndCharacterOfPosition, + getLineStarts, + getLocaleSpecificMessage, + getModuleInstanceState, + getNameOfDeclaration, + getNodeId, + getPackageNameFromTypesPackageName, + getPathComponents, + getRootDeclaration, + getSourceFileOfNode, + getSpanOfTokenAtPosition, + getSymbolId, + getTextOfIdentifierOrLiteral, + getTextOfNode, + getTypesPackageName, + hasSyntacticModifier, + idText, + identifierIsThisKeyword, + identity, + indexOfNode, + isAmbientModule, + isAnyImportSyntax, + isArray, + isArrayBindingPattern, + isArrayTypeNode, + isAsExpression, + isAwaitExpression, + isBinaryExpression, + isBindingElement, + isBreakOrContinueStatement, + isCallExpression, + isCallOrNewExpression, + isClassDeclaration, + isClassExpression, + isClassStaticBlockDeclaration, + isConditionalTypeNode, + isDeclaration, + isDeclarationName, + isDecorator, + isDeleteExpression, + isElementAccessExpression, + isEntityName, + isEnumDeclaration, + isExportAssignment, + isExportDeclaration, + isExportSpecifier, + isExpression, + isExpressionNode, + isExternalModule, + isExternalModuleImportEqualsDeclaration, + isExternalModuleReference, + isFileLevelUniqueName, + isForInStatement, + isForOfStatement, + isFunctionBlock, + isFunctionDeclaration, + isFunctionExpression, + isFunctionLike, + isGetAccessorDeclaration, + isGlobalScopeAugmentation, + isHeritageClause, + isIdentifier, + isImportCall, + isImportClause, + isImportDeclaration, + isImportEqualsDeclaration, + isImportOrExportSpecifier, + isImportSpecifier, + isInJSFile, + isInferTypeNode, + isInterfaceDeclaration, + isInternalModuleImportEqualsDeclaration, + isJSDoc, + isJSDocCommentContainingNode, + isJSDocLink, + isJSDocLinkCode, + isJSDocLinkLike, + isJSDocMemberName, + isJSDocNameReference, + isJSDocTag, + isJSDocTemplateTag, + isJSDocTypeAlias, + isJsxElement, + isJsxExpression, + isJsxOpeningLikeElement, + isJsxText, + isKeyword, + isLabeledStatement, + isLet, + isLiteralTypeNode, + isMappedTypeNode, + isModifier, + isModuleBlock, + isModuleDeclaration, + isNamedDeclaration, + isNamedExports, + isNamedImports, + isNamespaceExport, + isNamespaceImport, + isNewExpression, + isNumericLiteral, + isObjectBindingPattern, + isObjectLiteralExpression, + isOptionalChain, + isOptionalChainRoot, + isParameter, + isPartOfTypeNode, + isPrivateIdentifier, + isPropertyAccessExpression, + isPropertyNameLiteral, + isQualifiedName, + isRequireCall, + isRequireVariableStatement, + isRightSideOfQualifiedNameOrPropertyAccess, + isRootedDiskPath, + isSetAccessorDeclaration, + isSourceFile, + isSourceFileJS, + isStringDoubleQuoted, + isStringLiteral, + isStringLiteralLike, + isStringOrNumericLiteralLike, + isStringTextContainingNode, + isSyntaxList, + isTaggedTemplateExpression, + isTemplateLiteralKind, + isToken, + isTypeAliasDeclaration, + isTypeElement, + isTypeNode, + isTypeOfExpression, + isTypeOperatorNode, + isTypeParameterDeclaration, + isTypeReferenceNode, + isVarConst, + isVariableDeclarationList, + isVoidExpression, + isWhiteSpaceLike, + isWhiteSpaceSingleLine, + isYieldExpression, + last, + lastOrUndefined, + map, + maybeBind, + moduleSpecifiers, + nodeIsMissing, + nodeIsPresent, + nodeIsSynthesized, + noop, + normalizePath, + notImplemented, + nullTransformationContext, + or, + pathIsRelative, + setConfigFileInOptions, + setOriginalNode, + setTextRange, + singleOrUndefined, + skipAlias, + skipOuterExpressions, + some, + stableSort, + startsWith, + stringContains, + stringToToken, + stripQuotes, + textChanges, + textSpanContainsPosition, + textSpanContainsTextSpan, + textSpanEnd, + tokenToString, + tryCast, + unescapeLeadingUnderscores, + visitEachChild, } from "./_namespaces/ts"; // These utilities are common to multiple language service features. diff --git a/src/testRunner/_namespaces/ts.ts b/src/testRunner/_namespaces/ts.ts index 427c6e4e0719e..14184486f6fca 100644 --- a/src/testRunner/_namespaces/ts.ts +++ b/src/testRunner/_namespaces/ts.ts @@ -11,4 +11,4 @@ export * from "../../deprecatedCompat/_namespaces/ts"; export * from "../../harness/_namespaces/ts"; export * from "../../loggedIO/_namespaces/ts"; import * as server from "./ts.server"; -export { server }; \ No newline at end of file +export { server }; diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index 2133aad726734..7fd649070dec6 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -3,8 +3,16 @@ import * as ts from "./_namespaces/ts"; import * as compiler from "./_namespaces/compiler"; import * as Utils from "./_namespaces/Utils"; import { - Baseline, Compiler, FileBasedTest, FileBasedTestConfiguration, getFileBasedTestConfigurationDescription, - getFileBasedTestConfigurations, IO, RunnerBase, TestCaseParser, TestRunnerKind, + Baseline, + Compiler, + FileBasedTest, + FileBasedTestConfiguration, + IO, + RunnerBase, + TestCaseParser, + TestRunnerKind, + getFileBasedTestConfigurationDescription, + getFileBasedTestConfigurations, } from "./_namespaces/Harness"; export const enum CompilerTestType { diff --git a/src/testRunner/externalCompileRunner.ts b/src/testRunner/externalCompileRunner.ts index 766b939ab4b0d..b7baa33cfea42 100644 --- a/src/testRunner/externalCompileRunner.ts +++ b/src/testRunner/externalCompileRunner.ts @@ -3,7 +3,13 @@ import * as fs from "fs"; import * as path from "path"; import * as ts from "./_namespaces/ts"; -import { Baseline, IO, isWorker, RunnerBase, TestRunnerKind } from "./_namespaces/Harness"; +import { + Baseline, + IO, + RunnerBase, + TestRunnerKind, + isWorker, +} from "./_namespaces/Harness"; interface ExecResult { stdout: Buffer; diff --git a/src/testRunner/fourslashRunner.ts b/src/testRunner/fourslashRunner.ts index 31312e37c6a20..3c9712c4324a2 100644 --- a/src/testRunner/fourslashRunner.ts +++ b/src/testRunner/fourslashRunner.ts @@ -1,6 +1,10 @@ import * as FourSlash from "./_namespaces/FourSlash"; import * as ts from "./_namespaces/ts"; -import { IO, RunnerBase, TestRunnerKind } from "./_namespaces/Harness"; +import { + IO, + RunnerBase, + TestRunnerKind, +} from "./_namespaces/Harness"; export class FourSlashRunner extends RunnerBase { protected basePath: string; diff --git a/src/testRunner/parallel/host.ts b/src/testRunner/parallel/host.ts index de5a909360a3d..9643d642cc7ac 100644 --- a/src/testRunner/parallel/host.ts +++ b/src/testRunner/parallel/host.ts @@ -1,11 +1,28 @@ import * as Utils from "../_namespaces/Utils"; import * as ts from "../_namespaces/ts"; import { - configOption, globalTimeout, IO, keepFailed, lightMode, noColors, runners, runUnitTests, stackTraceLimit, - taskConfigsFolder, TestConfig, TestRunnerKind, workerCount, + IO, + TestConfig, + TestRunnerKind, + configOption, + globalTimeout, + keepFailed, + lightMode, + noColors, + runUnitTests, + runners, + stackTraceLimit, + taskConfigsFolder, + workerCount, } from "../_namespaces/Harness"; import { - ErrorInfo, ParallelClientMessage, ParallelHostMessage, shimNoopTestInterface, Task, TaskTimeout, TestInfo, + ErrorInfo, + ParallelClientMessage, + ParallelHostMessage, + Task, + TaskTimeout, + TestInfo, + shimNoopTestInterface, } from "../_namespaces/Harness.Parallel"; export function start() { diff --git a/src/testRunner/parallel/worker.ts b/src/testRunner/parallel/worker.ts index cf08354f77edc..d4c490ddf8e95 100644 --- a/src/testRunner/parallel/worker.ts +++ b/src/testRunner/parallel/worker.ts @@ -1,8 +1,20 @@ import { - ErrorInfo, ParallelClientMessage, ParallelHostMessage, RunnerTask, shimNoopTestInterface, Task, TaskResult, - TestInfo, UnitTestTask, + ErrorInfo, + ParallelClientMessage, + ParallelHostMessage, + RunnerTask, + Task, + TaskResult, + TestInfo, + UnitTestTask, + shimNoopTestInterface, } from "../_namespaces/Harness.Parallel"; -import { createRunner, globalTimeout, RunnerBase, runUnitTests } from "../_namespaces/Harness"; +import { + RunnerBase, + createRunner, + globalTimeout, + runUnitTests, +} from "../_namespaces/Harness"; export function start() { function hookUncaughtExceptions() { diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index f84e6df70b7ac..60511d4f100cf 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -4,9 +4,21 @@ import * as FourSlash from "./_namespaces/FourSlash"; import * as project from "./_namespaces/project"; import * as RWC from "./_namespaces/RWC"; import { - CompilerBaselineRunner, CompilerTestType, DefinitelyTypedRunner, DockerfileRunner, FourSlashRunner, - GeneratedFourslashRunner, IO, Parallel, RunnerBase, setLightMode, setShardId, setShards, Test262BaselineRunner, - TestRunnerKind, UserCodeRunner, + CompilerBaselineRunner, + CompilerTestType, + DefinitelyTypedRunner, + DockerfileRunner, + FourSlashRunner, + GeneratedFourslashRunner, + IO, + Parallel, + RunnerBase, + Test262BaselineRunner, + TestRunnerKind, + UserCodeRunner, + setLightMode, + setShardId, + setShards, } from "./_namespaces/Harness"; /* eslint-disable prefer-const */ diff --git a/src/testRunner/test262Runner.ts b/src/testRunner/test262Runner.ts index 87aee2bf57401..7393e0bd79b1f 100644 --- a/src/testRunner/test262Runner.ts +++ b/src/testRunner/test262Runner.ts @@ -1,7 +1,14 @@ import * as ts from "./_namespaces/ts"; import * as compiler from "./_namespaces/compiler"; import * as Utils from "./_namespaces/Utils"; -import { Baseline, Compiler, IO, RunnerBase, TestCaseParser, TestRunnerKind } from "./_namespaces/Harness"; +import { + Baseline, + Compiler, + IO, + RunnerBase, + TestCaseParser, + TestRunnerKind, +} from "./_namespaces/Harness"; // In harness baselines, null is different than undefined. See `generateActual` in `harness.ts`. export class Test262BaselineRunner extends RunnerBase { diff --git a/src/testRunner/unittests/builder.ts b/src/testRunner/unittests/builder.ts index 8ac912824f334..5bdac7a0e22a2 100644 --- a/src/testRunner/unittests/builder.ts +++ b/src/testRunner/unittests/builder.ts @@ -1,5 +1,12 @@ import * as ts from "../_namespaces/ts"; -import { NamedSourceText, newProgram, ProgramWithSourceTexts, SourceText, updateProgram, updateProgramText } from "./helpers"; +import { + NamedSourceText, + ProgramWithSourceTexts, + SourceText, + newProgram, + updateProgram, + updateProgramText, +} from "./helpers"; describe("unittests:: builder", () => { it("emits dependent files", () => { diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 2954f181f7043..43d2beed1493c 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -1,6 +1,10 @@ import * as ts from "../_namespaces/ts"; import * as Harness from "../_namespaces/Harness"; -import { checkResolvedModule, checkResolvedModuleWithFailedLookupLocations, createResolvedModule } from "./helpers"; +import { + checkResolvedModule, + checkResolvedModuleWithFailedLookupLocations, + createResolvedModule, +} from "./helpers"; interface File { name: string; diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index 6394394560114..705d6f70861aa 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -1,7 +1,23 @@ import * as ts from "../_namespaces/ts"; - -import { checkResolvedModulesCache, checkResolvedTypeDirectivesCache, createResolvedModule, createTestCompilerHost, NamedSourceText, newLine, newProgram, ProgramWithSourceTexts, SourceText, TestCompilerHost, updateProgram, updateProgramText } from "./helpers"; -import { createWatchedSystem, File, libFile } from "./virtualFileSystemWithWatch"; +import { + NamedSourceText, + ProgramWithSourceTexts, + SourceText, + TestCompilerHost, + checkResolvedModulesCache, + checkResolvedTypeDirectivesCache, + createResolvedModule, + createTestCompilerHost, + newLine, + newProgram, + updateProgram, + updateProgramText, +} from "./helpers"; +import { + File, + createWatchedSystem, + libFile, +} from "./virtualFileSystemWithWatch"; describe("unittests:: Reuse program structure:: General", () => { const target = ts.ScriptTarget.Latest; diff --git a/src/testRunner/unittests/services/convertToAsyncFunction.ts b/src/testRunner/unittests/services/convertToAsyncFunction.ts index dd5543cbac2cb..848b17f3db94c 100644 --- a/src/testRunner/unittests/services/convertToAsyncFunction.ts +++ b/src/testRunner/unittests/services/convertToAsyncFunction.ts @@ -1,8 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; import { createProjectService } from "../tsserver/helpers"; -import { extractTest, newLineCharacter, notImplementedHost } from "./extract/helpers"; +import { + extractTest, + newLineCharacter, + notImplementedHost, +} from "./extract/helpers"; const libFile: File = { path: "/a/lib/lib.d.ts", diff --git a/src/testRunner/unittests/services/extract/constants.ts b/src/testRunner/unittests/services/extract/constants.ts index b99760b97a29e..24b44e689deb0 100644 --- a/src/testRunner/unittests/services/extract/constants.ts +++ b/src/testRunner/unittests/services/extract/constants.ts @@ -1,5 +1,8 @@ import * as ts from "../../../_namespaces/ts"; -import { testExtractSymbol, testExtractSymbolFailed } from "./helpers"; +import { + testExtractSymbol, + testExtractSymbolFailed, +} from "./helpers"; describe("unittests:: services:: extract:: extractConstants", () => { testExtractConstant("extractConstant_TopLevel", diff --git a/src/testRunner/unittests/services/extract/helpers.ts b/src/testRunner/unittests/services/extract/helpers.ts index 91afea867bfbc..170ac60d0df94 100644 --- a/src/testRunner/unittests/services/extract/helpers.ts +++ b/src/testRunner/unittests/services/extract/helpers.ts @@ -1,6 +1,9 @@ import * as ts from "../../../_namespaces/ts"; import * as Harness from "../../../_namespaces/Harness"; -import { createServerHost, libFile } from "../../virtualFileSystemWithWatch"; +import { + createServerHost, + libFile, +} from "../../virtualFileSystemWithWatch"; import { createProjectService } from "../../tsserver/helpers"; interface Range { diff --git a/src/testRunner/unittests/services/languageService.ts b/src/testRunner/unittests/services/languageService.ts index a93147bc2b870..94efcaba3c818 100644 --- a/src/testRunner/unittests/services/languageService.ts +++ b/src/testRunner/unittests/services/languageService.ts @@ -1,7 +1,11 @@ import { expect } from "chai"; import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; describe("unittests:: services:: languageService", () => { const files: {[index: string]: string} = { diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index 59f1d9a9cae09..332d69675dea9 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -1,6 +1,9 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; import { createProjectService } from "../tsserver/helpers"; import { newLineCharacter } from "./extract/helpers"; diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index a835b87109d09..111506e197414 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; -import { addRest, addShebang, addSpread, addTestPrologue, addTripleSlashRef, appendText, enableStrict, loadProjectFromDisk, removeRest, replaceText, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + addRest, + addShebang, + addSpread, + addTestPrologue, + addTripleSlashRef, + appendText, + enableStrict, + loadProjectFromDisk, + removeRest, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: outFile:: on amd modules with --out", () => { let outFileFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/clean.ts b/src/testRunner/unittests/tsbuild/clean.ts index 48fc319eabdcf..0778e4ef60fdf 100644 --- a/src/testRunner/unittests/tsbuild/clean.ts +++ b/src/testRunner/unittests/tsbuild/clean.ts @@ -1,4 +1,8 @@ -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; + describe("unittests:: tsbuild - clean", () => { verifyTsc({ scenario: "clean", diff --git a/src/testRunner/unittests/tsbuild/commandLine.ts b/src/testRunner/unittests/tsbuild/commandLine.ts index dfd703445eed5..fc009e2cbc2a4 100644 --- a/src/testRunner/unittests/tsbuild/commandLine.ts +++ b/src/testRunner/unittests/tsbuild/commandLine.ts @@ -1,5 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { appendText, compilerOptionsToConfigJson, loadProjectFromFiles, noChangeRun, noChangeWithExportsDiscrepancyRun, replaceText, TestTscEdit, verifyTscWithEdits } from "../tsc/helpers"; +import { + TestTscEdit, + appendText, + compilerOptionsToConfigJson, + loadProjectFromFiles, + noChangeRun, + noChangeWithExportsDiscrepancyRun, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: commandLine::", () => { describe("different options::", () => { diff --git a/src/testRunner/unittests/tsbuild/configFileErrors.ts b/src/testRunner/unittests/tsbuild/configFileErrors.ts index f1d047c37c5d0..d88780fa6cf4e 100644 --- a/src/testRunner/unittests/tsbuild/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuild/configFileErrors.ts @@ -1,4 +1,12 @@ -import { appendText, loadProjectFromDisk, loadProjectFromFiles, noChangeRun, replaceText, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + loadProjectFromDisk, + loadProjectFromFiles, + noChangeRun, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; import { dedent } from "../../_namespaces/Utils"; describe("unittests:: tsbuild:: configFileErrors:: when tsconfig extends the missing file", () => { diff --git a/src/testRunner/unittests/tsbuild/configFileExtends.ts b/src/testRunner/unittests/tsbuild/configFileExtends.ts index c319b10f86e45..3fcd12acf0c02 100644 --- a/src/testRunner/unittests/tsbuild/configFileExtends.ts +++ b/src/testRunner/unittests/tsbuild/configFileExtends.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: configFileExtends:: when tsconfig extends another config", () => { function getConfigExtendsWithIncludeFs() { diff --git a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts index ed0a50da8a03c..71001af364655 100644 --- a/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts +++ b/src/testRunner/unittests/tsbuild/containerOnlyReferenced.ts @@ -1,4 +1,10 @@ -import { loadProjectFromDisk, loadProjectFromFiles, noChangeOnlyRuns, replaceText, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + loadProjectFromFiles, + noChangeOnlyRuns, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: when containerOnly project is referenced", () => { verifyTscWithEdits({ diff --git a/src/testRunner/unittests/tsbuild/declarationEmit.ts b/src/testRunner/unittests/tsbuild/declarationEmit.ts index f819b1f55c998..06cf8a24d4d59 100644 --- a/src/testRunner/unittests/tsbuild/declarationEmit.ts +++ b/src/testRunner/unittests/tsbuild/declarationEmit.ts @@ -1,6 +1,9 @@ import * as vfs from "../../_namespaces/vfs"; import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: declarationEmit", () => { function getFiles(): vfs.FileSet { diff --git a/src/testRunner/unittests/tsbuild/demo.ts b/src/testRunner/unittests/tsbuild/demo.ts index 371cae4b63fc3..dfc7868fe54e4 100644 --- a/src/testRunner/unittests/tsbuild/demo.ts +++ b/src/testRunner/unittests/tsbuild/demo.ts @@ -1,5 +1,10 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, prependText, replaceText, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + prependText, + replaceText, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: on demo project", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts index 2c35740fa39d4..c9deb5e89d446 100644 --- a/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts +++ b/src/testRunner/unittests/tsbuild/emitDeclarationOnly.ts @@ -1,5 +1,9 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, replaceText, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: on project with emitDeclarationOnly set to true", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/emptyFiles.ts b/src/testRunner/unittests/tsbuild/emptyFiles.ts index 7243034678195..b86584263bb53 100644 --- a/src/testRunner/unittests/tsbuild/emptyFiles.ts +++ b/src/testRunner/unittests/tsbuild/emptyFiles.ts @@ -1,5 +1,8 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild - empty files option in tsconfig", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts index 6e8aff6c2af14..19459648351a2 100644 --- a/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts +++ b/src/testRunner/unittests/tsbuild/exitCodeOnBogusFile.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "../tsc/helpers"; // https://github.com/microsoft/TypeScript/issues/33849 describe("unittests:: tsbuild:: exitCodeOnBogusFile:: test exit code", () => { diff --git a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts index 1933a979dcf22..6b2f7d749b3b4 100644 --- a/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts +++ b/src/testRunner/unittests/tsbuild/inferredTypeFromTransitiveModule.ts @@ -1,5 +1,10 @@ import * as vfs from "../../_namespaces/vfs"; -import { appendText, loadProjectFromDisk, replaceText, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + loadProjectFromDisk, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: inferredTypeFromTransitiveModule::", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts b/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts index 744cc88faa6b6..6f58a0eeab45c 100644 --- a/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts +++ b/src/testRunner/unittests/tsbuild/javascriptProjectEmit.ts @@ -1,5 +1,11 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, replaceText, symbolLibContent, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromFiles, + replaceText, + symbolLibContent, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: javascriptProjectEmit::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts index 161a6063a8651..45ccd5c76b0a3 100644 --- a/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts +++ b/src/testRunner/unittests/tsbuild/lateBoundSymbol.ts @@ -1,4 +1,9 @@ -import { replaceText, appendText, loadProjectFromDisk, verifyTscWithEdits } from "../tsc/helpers"; +import { + appendText, + loadProjectFromDisk, + replaceText, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: lateBoundSymbol:: interface is merged and contains late bound member", () => { verifyTscWithEdits({ diff --git a/src/testRunner/unittests/tsbuild/moduleResolution.ts b/src/testRunner/unittests/tsbuild/moduleResolution.ts index cb095a477d875..682d4f3f02461 100644 --- a/src/testRunner/unittests/tsbuild/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuild/moduleResolution.ts @@ -1,7 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, libFile } from "../virtualFileSystemWithWatch"; -import { loadProjectFromFiles, noChangeOnlyRuns, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + loadProjectFromFiles, + noChangeOnlyRuns, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; describe("unittests:: tsbuild:: moduleResolution:: handles the modules and options from referenced project correctly", () => { diff --git a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts index d8023f071b13f..b79d53fd180a2 100644 --- a/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts +++ b/src/testRunner/unittests/tsbuild/moduleSpecifiers.ts @@ -1,6 +1,10 @@ import { libFile } from "../virtualFileSystemWithWatch"; import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, symbolLibContent, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromFiles, + symbolLibContent, + verifyTsc, +} from "../tsc/helpers"; // https://github.com/microsoft/TypeScript/issues/31696 describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers to referenced projects resolve correctly", () => { diff --git a/src/testRunner/unittests/tsbuild/noEmit.ts b/src/testRunner/unittests/tsbuild/noEmit.ts index 0782691f47c2c..5ca66a285d3f2 100644 --- a/src/testRunner/unittests/tsbuild/noEmit.ts +++ b/src/testRunner/unittests/tsbuild/noEmit.ts @@ -1,4 +1,8 @@ -import { loadProjectFromFiles, noChangeRun, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromFiles, + noChangeRun, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: noEmit", () => { function verifyNoEmitWorker(subScenario: string, aTsContent: string, commandLineArgs: readonly string[]) { diff --git a/src/testRunner/unittests/tsbuild/noEmitOnError.ts b/src/testRunner/unittests/tsbuild/noEmitOnError.ts index a5bdfc3b5c7e8..0f814b7643c59 100644 --- a/src/testRunner/unittests/tsbuild/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuild/noEmitOnError.ts @@ -1,4 +1,9 @@ -import { loadProjectFromDisk, noChangeRun, noChangeWithExportsDiscrepancyRun, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + noChangeRun, + noChangeWithExportsDiscrepancyRun, + verifyTscWithEdits, +} from "../tsc/helpers"; import * as vfs from "../../_namespaces/vfs"; describe("unittests:: tsbuild - with noEmitOnError", () => { diff --git a/src/testRunner/unittests/tsbuild/outFile.ts b/src/testRunner/unittests/tsbuild/outFile.ts index e0a9ac5bad978..fa5710d334b47 100644 --- a/src/testRunner/unittests/tsbuild/outFile.ts +++ b/src/testRunner/unittests/tsbuild/outFile.ts @@ -1,7 +1,30 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; -import { addRest, addShebang, addSpread, addStubFoo, addTestPrologue, addTripleSlashRef, appendText, changeStubToRest, createSolutionBuilderHostForBaseline, enableStrict, loadProjectFromDisk, noChangeOnlyRuns, prependText, removeRest, replaceText, testTscCompileLike, TestTscEdit, TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits, VerifyTscWithEditsInput } from "../tsc/helpers"; +import { + TestTscEdit, + TscCompileSystem, + VerifyTscWithEditsInput, + addRest, + addShebang, + addSpread, + addStubFoo, + addTestPrologue, + addTripleSlashRef, + appendText, + changeStubToRest, + createSolutionBuilderHostForBaseline, + enableStrict, + loadProjectFromDisk, + noChangeOnlyRuns, + prependText, + removeRest, + replaceText, + testTscCompileLike, + verifyTsc, + verifyTscCompileLike, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: outFile::", () => { let outFileFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index a58f3d4380868..ef4a563f542be 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; import * as fakes from "../../_namespaces/fakes"; -import { loadProjectFromFiles, noChangeRun, TestTscEdit, TscCompileSystem, verifyTscWithEdits, VerifyTscWithEditsInput } from "../tsc/helpers"; +import { + TestTscEdit, + TscCompileSystem, + VerifyTscWithEditsInput, + loadProjectFromFiles, + noChangeRun, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild - output file paths", () => { const noChangeProject: TestTscEdit = { diff --git a/src/testRunner/unittests/tsbuild/publicApi.ts b/src/testRunner/unittests/tsbuild/publicApi.ts index 880beea1ef7a5..bb236257c76a5 100644 --- a/src/testRunner/unittests/tsbuild/publicApi.ts +++ b/src/testRunner/unittests/tsbuild/publicApi.ts @@ -1,7 +1,14 @@ import * as ts from "../../_namespaces/ts"; import * as fakes from "../../_namespaces/fakes"; import * as vfs from "../../_namespaces/vfs"; -import { baselinePrograms, commandLineCallbacks, loadProjectFromFiles, toPathWithSystem, TscCompileSystem, verifyTscBaseline } from "../tsc/helpers"; +import { + TscCompileSystem, + baselinePrograms, + commandLineCallbacks, + loadProjectFromFiles, + toPathWithSystem, + verifyTscBaseline, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: Public API with custom transformers when passed to build", () => { let sys: TscCompileSystem; diff --git a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts index 4349e906559ce..5ceaa6ac3ea37 100644 --- a/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts +++ b/src/testRunner/unittests/tsbuild/referencesWithRootDirInParent.ts @@ -1,5 +1,9 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, replaceText, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + replaceText, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: with rootDir of project reference in parentDirectory", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts index 27ef64a886fe1..5eaa7ecc40a90 100644 --- a/src/testRunner/unittests/tsbuild/resolveJsonModule.ts +++ b/src/testRunner/unittests/tsbuild/resolveJsonModule.ts @@ -1,5 +1,11 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, noChangeOnlyRuns, replaceText, verifyTsc, verifyTscWithEdits } from "../tsc/helpers"; +import { + loadProjectFromDisk, + noChangeOnlyRuns, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: with resolveJsonModule option on project resolveJsonModuleAndComposite", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 2fb4d2eee3211..336c1a0f36439 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -2,8 +2,31 @@ import * as ts from "../../_namespaces/ts"; import * as vfs from "../../_namespaces/vfs"; import * as fakes from "../../_namespaces/fakes"; import * as Harness from "../../_namespaces/Harness"; -import { changeToHostTrackingWrittenFiles, createWatchedSystem, File, getTsBuildProjectFilePath, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { appendText, createSolutionBuilderHostForBaseline, libContent, loadProjectFromDisk, loadProjectFromFiles, noChangeOnlyRuns, noChangeRun, prependText, replaceText, testTscCompileLike, TestTscEdit, TscCompileSystem, verifyTsc, verifyTscCompileLike, verifyTscWithEdits } from "../tsc/helpers"; +import { + File, + TestServerHost, + changeToHostTrackingWrittenFiles, + createWatchedSystem, + getTsBuildProjectFilePath, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestTscEdit, + TscCompileSystem, + appendText, + createSolutionBuilderHostForBaseline, + libContent, + loadProjectFromDisk, + loadProjectFromFiles, + noChangeOnlyRuns, + noChangeRun, + prependText, + replaceText, + testTscCompileLike, + verifyTsc, + verifyTscCompileLike, + verifyTscWithEdits, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: on 'sample1' project", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index b48a9c9c6911f..a49d83c21a12d 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -1,5 +1,8 @@ import * as vfs from "../../_namespaces/vfs"; -import { loadProjectFromDisk, verifyTsc } from "../tsc/helpers"; +import { + loadProjectFromDisk, + verifyTsc, +} from "../tsc/helpers"; describe("unittests:: tsbuild:: when project reference is referenced transitively", () => { let projFs: vfs.FileSystem; diff --git a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts index cf4eda9a904fa..7d66eaa425f25 100644 --- a/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts +++ b/src/testRunner/unittests/tsbuildWatch/configFileErrors.ts @@ -1,4 +1,8 @@ -import { createWatchedSystem, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; +import { + TestServerHost, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "../tscWatch/helpers"; import { dedent } from "../../_namespaces/Utils"; diff --git a/src/testRunner/unittests/tsbuildWatch/demo.ts b/src/testRunner/unittests/tsbuildWatch/demo.ts index 54aa361a76ce9..0bcfdf92cf379 100644 --- a/src/testRunner/unittests/tsbuildWatch/demo.ts +++ b/src/testRunner/unittests/tsbuildWatch/demo.ts @@ -1,4 +1,9 @@ -import { createWatchedSystem, File, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts b/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts index 05889e33048e0..e76f19e16d5b0 100644 --- a/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tsbuildWatch/moduleResolution.ts @@ -1,4 +1,7 @@ -import { createWatchedSystem, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "../tscWatch/helpers"; import { dedent } from "../../_namespaces/Utils"; diff --git a/src/testRunner/unittests/tsbuildWatch/noEmit.ts b/src/testRunner/unittests/tsbuildWatch/noEmit.ts index b6d77b0cf8d92..f00789f8684d0 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmit.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmit.ts @@ -1,4 +1,7 @@ -import { createWatchedSystem, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts index f9dfe11eba12c..d818df804f28f 100644 --- a/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts +++ b/src/testRunner/unittests/tsbuildWatch/noEmitOnError.ts @@ -1,6 +1,13 @@ -import { createWatchedSystem, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; -import { TscWatchCompileChange, verifyTscWatch } from "../tscWatch/helpers"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "../tscWatch/helpers"; describe("unittests:: tsbuildWatch:: watchMode:: with noEmitOnError", () => { function change(caption: string, content: string): TscWatchCompileChange { diff --git a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts index f4147f4870d4a..310846c2651c4 100644 --- a/src/testRunner/unittests/tsbuildWatch/programUpdates.ts +++ b/src/testRunner/unittests/tsbuildWatch/programUpdates.ts @@ -1,6 +1,23 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, createBaseline, createSolutionBuilderWithWatchHostForBaseline, noopChange, runWatchBaseline, TscWatchCompileChange, verifyTscWatch } from "../tscWatch/helpers"; +import { + File, + TestServerHost, + createWatchedSystem, + getTsBuildProjectFile, + getTsBuildProjectFilePath, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + commonFile1, + commonFile2, + createBaseline, + createSolutionBuilderWithWatchHostForBaseline, + noopChange, + runWatchBaseline, + verifyTscWatch, +} from "../tscWatch/helpers"; + describe("unittests:: tsbuildWatch:: watchMode:: program updates", () => { const enum SubProject { core = "core", diff --git a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts index f95f91590afe6..076f56752f086 100644 --- a/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts +++ b/src/testRunner/unittests/tsbuildWatch/projectsBuilding.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { noopChange, TscWatchCompileChange, verifyTscWatch } from "../tscWatch/helpers"; +import { + File, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + noopChange, + verifyTscWatch, +} from "../tscWatch/helpers"; describe("unittests:: tsbuildWatch:: watchMode:: projectsBuilding", () => { function pkgs(cb: (index: number) => T, count: number, startIndex?: number): T[] { diff --git a/src/testRunner/unittests/tsbuildWatch/publicApi.ts b/src/testRunner/unittests/tsbuildWatch/publicApi.ts index 54f00c2fed815..6606990897a59 100644 --- a/src/testRunner/unittests/tsbuildWatch/publicApi.ts +++ b/src/testRunner/unittests/tsbuildWatch/publicApi.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { createBaseline, createSolutionBuilderWithWatchHostForBaseline, runWatchBaseline } from "../tscWatch/helpers"; +import { + File, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createSolutionBuilderWithWatchHostForBaseline, + runWatchBaseline, +} from "../tscWatch/helpers"; it("unittests:: tsbuildWatch:: watchMode:: Public API with custom transformers", () => { const solution: File = { diff --git a/src/testRunner/unittests/tsbuildWatch/reexport.ts b/src/testRunner/unittests/tsbuildWatch/reexport.ts index 849403d63dd7d..67d29dea604d6 100644 --- a/src/testRunner/unittests/tsbuildWatch/reexport.ts +++ b/src/testRunner/unittests/tsbuildWatch/reexport.ts @@ -1,4 +1,8 @@ -import { createWatchedSystem, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; import { verifyTscWatch } from "../tscWatch/helpers"; diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index e04ddf12f190e..d42f37ee5541a 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -1,6 +1,15 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createBaseline, createSolutionBuilderWithWatchHostForBaseline, runWatchBaseline } from "../tscWatch/helpers"; +import { + File, + TestServerHost, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createSolutionBuilderWithWatchHostForBaseline, + runWatchBaseline, +} from "../tscWatch/helpers"; describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: with different watch environments", () => { it("watchFile on same file multiple times because file is part of multiple projects", () => { diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index 0ea048025bb9f..df418d16e02ad 100644 --- a/src/testRunner/unittests/tsc/cancellationToken.ts +++ b/src/testRunner/unittests/tsc/cancellationToken.ts @@ -1,9 +1,20 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { baselineBuildInfo, CommandLineProgram } from "../tsc/helpers"; -import { applyChange, createBaseline, watchBaseline } from "../tscWatch/helpers"; +import { + File, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + CommandLineProgram, + baselineBuildInfo, +} from "../tsc/helpers"; +import { + applyChange, + createBaseline, + watchBaseline, +} from "../tscWatch/helpers"; describe("unittests:: tsc:: builder cancellationToken", () => { verifyCancellation(/*useBuildInfo*/ true, "when emitting buildInfo"); diff --git a/src/testRunner/unittests/tsc/composite.ts b/src/testRunner/unittests/tsc/composite.ts index f5f274d3a4200..06bcfb478da89 100644 --- a/src/testRunner/unittests/tsc/composite.ts +++ b/src/testRunner/unittests/tsc/composite.ts @@ -1,5 +1,10 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, replaceText, verifyTsc, verifyTscWithEdits } from "./helpers"; +import { + loadProjectFromFiles, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "./helpers"; describe("unittests:: tsc:: composite::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/declarationEmit.ts b/src/testRunner/unittests/tsc/declarationEmit.ts index 09b8912166323..15ac493ec9910 100644 --- a/src/testRunner/unittests/tsc/declarationEmit.ts +++ b/src/testRunner/unittests/tsc/declarationEmit.ts @@ -1,6 +1,11 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, FileOrFolderOrSymLink, isSymLink, libFile } from "../virtualFileSystemWithWatch"; +import { + FileOrFolderOrSymLink, + createWatchedSystem, + isSymLink, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "../tscWatch/helpers"; describe("unittests:: tsc:: declarationEmit::", () => { diff --git a/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts index becde8318e9c6..70c79ac8b44a3 100644 --- a/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsc/forceConsistentCasingInFileNames.ts @@ -1,5 +1,8 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: forceConsistentCasingInFileNames::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/helpers.ts b/src/testRunner/unittests/tsc/helpers.ts index 129da093cb139..fc3cdda127755 100644 --- a/src/testRunner/unittests/tsc/helpers.ts +++ b/src/testRunner/unittests/tsc/helpers.ts @@ -3,7 +3,10 @@ import * as fakes from "../../_namespaces/fakes"; import * as vfs from "../../_namespaces/vfs"; import * as vpath from "../../_namespaces/vpath"; import * as Harness from "../../_namespaces/Harness"; -import { libFile, TestServerHost } from "../virtualFileSystemWithWatch"; +import { + TestServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; export type TscCompileSystem = fakes.System & { writtenFiles: Set; diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 5bfe1a27c53e1..96ddac44558a2 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -1,7 +1,21 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; import * as vfs from "../../_namespaces/vfs"; -import { appendText, compilerOptionsToConfigJson, libContent, loadProjectFromDisk, loadProjectFromFiles, noChangeOnlyRuns, noChangeRun, noChangeWithExportsDiscrepancyRun, prependText, replaceText, TestTscEdit, verifyTsc, verifyTscWithEdits } from "./helpers"; +import { + TestTscEdit, + appendText, + compilerOptionsToConfigJson, + libContent, + loadProjectFromDisk, + loadProjectFromFiles, + noChangeOnlyRuns, + noChangeRun, + noChangeWithExportsDiscrepancyRun, + prependText, + replaceText, + verifyTsc, + verifyTscWithEdits, +} from "./helpers"; describe("unittests:: tsc:: incremental::", () => { verifyTscWithEdits({ diff --git a/src/testRunner/unittests/tsc/listFilesOnly.ts b/src/testRunner/unittests/tsc/listFilesOnly.ts index 258b0609f9455..206373e21267f 100644 --- a/src/testRunner/unittests/tsc/listFilesOnly.ts +++ b/src/testRunner/unittests/tsc/listFilesOnly.ts @@ -1,5 +1,10 @@ import * as Utils from "../../_namespaces/Utils"; -import { loadProjectFromFiles, noChangeRun, verifyTsc, verifyTscWithEdits } from "./helpers"; +import { + loadProjectFromFiles, + noChangeRun, + verifyTsc, + verifyTscWithEdits, +} from "./helpers"; describe("unittests:: tsc:: listFilesOnly::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/projectReferences.ts b/src/testRunner/unittests/tsc/projectReferences.ts index 98e6c6ad14f84..070d2b338920a 100644 --- a/src/testRunner/unittests/tsc/projectReferences.ts +++ b/src/testRunner/unittests/tsc/projectReferences.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: projectReferences::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/redirect.ts b/src/testRunner/unittests/tsc/redirect.ts index 10925a26181e1..086fa782130ee 100644 --- a/src/testRunner/unittests/tsc/redirect.ts +++ b/src/testRunner/unittests/tsc/redirect.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: redirect::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tsc/runWithoutArgs.ts b/src/testRunner/unittests/tsc/runWithoutArgs.ts index fa8fe674e9c50..cf5ea49cbc099 100644 --- a/src/testRunner/unittests/tsc/runWithoutArgs.ts +++ b/src/testRunner/unittests/tsc/runWithoutArgs.ts @@ -1,4 +1,7 @@ -import { loadProjectFromFiles, verifyTsc } from "./helpers"; +import { + loadProjectFromFiles, + verifyTsc, +} from "./helpers"; describe("unittests:: tsc:: runWithoutArgs::", () => { verifyTsc({ diff --git a/src/testRunner/unittests/tscWatch/consoleClearing.ts b/src/testRunner/unittests/tscWatch/consoleClearing.ts index 856fc8fb36898..b1c86fcd57135 100644 --- a/src/testRunner/unittests/tscWatch/consoleClearing.ts +++ b/src/testRunner/unittests/tscWatch/consoleClearing.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; -import { createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + File, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + createBaseline, + createWatchCompilerHostOfConfigFileForBaseline, + runWatchBaseline, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: console clearing", () => { const scenario = "consoleClearing"; diff --git a/src/testRunner/unittests/tscWatch/emit.ts b/src/testRunner/unittests/tscWatch/emit.ts index d061b0085c168..4f037949d8b1d 100644 --- a/src/testRunner/unittests/tscWatch/emit.ts +++ b/src/testRunner/unittests/tscWatch/emit.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + File, + TestServerHost, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; const scenario = "emit"; describe("unittests:: tsc-watch:: emit with outFile or out setting", () => { diff --git a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts index 992c2bbb0de09..197f5e2f2f6dd 100644 --- a/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts +++ b/src/testRunner/unittests/tscWatch/emitAndErrorUpdates.ts @@ -1,6 +1,14 @@ -import { createWatchedSystem, File, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; -import { TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: Emit times and Error updates in builder after program changes", () => { const config: File = { diff --git a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts index 59bb5fb48cf05..67fa32f75c81a 100644 --- a/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tscWatch/forceConsistentCasingInFileNames.ts @@ -1,7 +1,15 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile, SymLink } from "../virtualFileSystemWithWatch"; -import { TscWatchCompileChange, verifyTscWatch } from "./helpers"; +import { + File, + SymLink, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: forceConsistentCasingInFileNames", () => { const loggerFile: File = { diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 03c82333c1e27..a8051822d0c17 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -1,8 +1,24 @@ import * as ts from "../../_namespaces/ts"; import { patchHostForBuildInfoReadWrite } from "../../_namespaces/fakes"; import { Baseline } from "../../_namespaces/Harness"; -import { changeToHostTrackingWrittenFiles, createWatchedSystem, File, FileOrFolderOrSymLink, FileOrFolderOrSymLinkMap, TestServerHost, TestServerHostCreationParameters, TestServerHostTrackingWrittenFiles } from "../virtualFileSystemWithWatch"; -import { baselinePrograms, commandLineCallbacks, CommandLineCallbacks, CommandLineProgram, createSolutionBuilderHostForBaseline, generateSourceMapBaselineFiles } from "../tsc/helpers"; +import { + File, + FileOrFolderOrSymLink, + FileOrFolderOrSymLinkMap, + TestServerHost, + TestServerHostCreationParameters, + TestServerHostTrackingWrittenFiles, + changeToHostTrackingWrittenFiles, + createWatchedSystem, +} from "../virtualFileSystemWithWatch"; +import { + CommandLineCallbacks, + CommandLineProgram, + baselinePrograms, + commandLineCallbacks, + createSolutionBuilderHostForBaseline, + generateSourceMapBaselineFiles, +} from "../tsc/helpers"; export const commonFile1: File = { path: "/a/b/commonFile1.ts", diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index fbf7305bd79b8..49db873e21f8b 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -1,8 +1,22 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { CommandLineProgram, libContent } from "../tsc/helpers"; -import { applyChange, createBaseline, SystemSnap, verifyTscWatch, watchBaseline } from "./helpers"; +import { + File, + TestServerHost, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + CommandLineProgram, + libContent, +} from "../tsc/helpers"; +import { + SystemSnap, + applyChange, + createBaseline, + verifyTscWatch, + watchBaseline, +} from "./helpers"; describe("unittests:: tsc-watch:: emit file --incremental", () => { const project = "/users/username/projects/project"; diff --git a/src/testRunner/unittests/tscWatch/moduleResolution.ts b/src/testRunner/unittests/tscWatch/moduleResolution.ts index 4631e1bc39e60..77b5384fe3f67 100644 --- a/src/testRunner/unittests/tscWatch/moduleResolution.ts +++ b/src/testRunner/unittests/tscWatch/moduleResolution.ts @@ -1,6 +1,10 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; describe("unittests:: tsc-watch:: moduleResolution", () => { diff --git a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts index e1eb489fe06ae..a0c7926045010 100644 --- a/src/testRunner/unittests/tscWatch/nodeNextWatch.ts +++ b/src/testRunner/unittests/tscWatch/nodeNextWatch.ts @@ -1,5 +1,9 @@ import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; import { verifyTscWatch } from "./helpers"; describe("unittests:: tsc-watch:: nodeNextWatch:: emit when module emit is specified as nodenext", () => { diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 6eb0365275c88..db5e2408ca24e 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -1,8 +1,27 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, createBaseline, createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, noopChange, runWatchBaseline, TscWatchCompileChange, verifyTscWatch, watchBaseline } from "./helpers"; -import { commandLineCallbacks, compilerOptionsToConfigJson } from "../tsc/helpers"; +import { + File, + SymLink, + TestServerHost, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TscWatchCompileChange, + commonFile1, + commonFile2, + createBaseline, + createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, + noopChange, + runWatchBaseline, + verifyTscWatch, + watchBaseline, +} from "./helpers"; +import { + commandLineCallbacks, + compilerOptionsToConfigJson, +} from "../tsc/helpers"; describe("unittests:: tsc-watch:: program updates", () => { const scenario = "programUpdates"; diff --git a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts index 37ca522138694..dc3dea59d1943 100644 --- a/src/testRunner/unittests/tscWatch/projectsWithReferences.ts +++ b/src/testRunner/unittests/tscWatch/projectsWithReferences.ts @@ -1,6 +1,15 @@ import * as ts from "../../_namespaces/ts"; -import { getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createSolutionBuilder, createSystemWithSolutionBuild, verifyTscWatch } from "./helpers"; +import { + TestServerHost, + getTsBuildProjectFile, + getTsBuildProjectFilePath, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createSolutionBuilder, + createSystemWithSolutionBuild, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: projects with references: invoking when references are already built", () => { verifyTscWatch({ diff --git a/src/testRunner/unittests/tscWatch/resolutionCache.ts b/src/testRunner/unittests/tscWatch/resolutionCache.ts index 48cb73fc18592..f6aba5b8537f7 100644 --- a/src/testRunner/unittests/tscWatch/resolutionCache.ts +++ b/src/testRunner/unittests/tscWatch/resolutionCache.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createWatchedSystem, File, libFile, SymLink } from "../virtualFileSystemWithWatch"; -import { createBaseline, createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, runWatchBaseline, verifyTscWatch } from "./helpers"; +import { + File, + SymLink, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createBaseline, + createWatchCompilerHostOfFilesAndCompilerOptionsForBaseline, + runWatchBaseline, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution caching", () => { const scenario = "resolutionCache"; diff --git a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts index 23589d5a52f71..21a4dbecb5e8c 100644 --- a/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts +++ b/src/testRunner/unittests/tscWatch/sourceOfProjectReferenceRedirect.ts @@ -1,7 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, FileOrFolderOrSymLink, getTsBuildProjectFile, libFile, SymLink } from "../virtualFileSystemWithWatch"; +import { + File, + FileOrFolderOrSymLink, + SymLink, + createWatchedSystem, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; import { libContent } from "../tsc/helpers"; -import { createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, solutionBuildWithBaseline } from "./helpers"; +import { + createBaseline, + createWatchCompilerHostOfConfigFileForBaseline, + runWatchBaseline, + solutionBuildWithBaseline, +} from "./helpers"; describe("unittests:: tsc-watch:: watchAPI:: with sourceOfProjectReferenceRedirect", () => { interface VerifyWatchInput { diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index bd3b40da83ab9..40de351fbd63b 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -1,7 +1,18 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createWatchedSystem, File, libFile, TestServerHostTrackingWrittenFiles } from "../virtualFileSystemWithWatch"; -import { applyChange, createBaseline, createWatchCompilerHostOfConfigFileForBaseline, runWatchBaseline, watchBaseline } from "./helpers"; +import { + File, + TestServerHostTrackingWrittenFiles, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + applyChange, + createBaseline, + createWatchCompilerHostOfConfigFileForBaseline, + runWatchBaseline, + watchBaseline, +} from "./helpers"; import { commandLineCallbacks } from "../tsc/helpers"; describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolution", () => { diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index e6b82706e2709..abacbeb6cb4e3 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createWatchedSystem, File, libFile, SymLink, TestServerHost, Tsc_WatchDirectory, Tsc_WatchFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, noopChange, verifyTscWatch } from "./helpers"; +import { + File, + SymLink, + TestServerHost, + Tsc_WatchDirectory, + Tsc_WatchFile, + createWatchedSystem, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, + noopChange, + verifyTscWatch, +} from "./helpers"; describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => { const scenario = "watchEnvironment"; diff --git a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts index 1eefb848ce30f..b11d28f640e8b 100644 --- a/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts +++ b/src/testRunner/unittests/tsserver/applyChangesToOpenFiles.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { TestSession, createSession } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + TestSession, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: applyChangesToOpenFiles", () => { const configFile: File = { diff --git a/src/testRunner/unittests/tsserver/autoImportProvider.ts b/src/testRunner/unittests/tsserver/autoImportProvider.ts index ba3442ad9e643..5eaa1ffedb750 100644 --- a/src/testRunner/unittests/tsserver/autoImportProvider.ts +++ b/src/testRunner/unittests/tsserver/autoImportProvider.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { openFilesForSession, checkNumberOfInferredProjects, checkNumberOfConfiguredProjects, createSession } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + createSession, + openFilesForSession, +} from "./helpers"; const angularFormsDts: File = { path: "/node_modules/@angular/forms/forms.d.ts", diff --git a/src/testRunner/unittests/tsserver/auxiliaryProject.ts b/src/testRunner/unittests/tsserver/auxiliaryProject.ts index 0538634c6825f..b55f0f72fbeab 100644 --- a/src/testRunner/unittests/tsserver/auxiliaryProject.ts +++ b/src/testRunner/unittests/tsserver/auxiliaryProject.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, checkNumberOfInferredProjects } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfInferredProjects, + createSession, + openFilesForSession, +} from "./helpers"; const aTs: File = { path: "/a.ts", diff --git a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts index 16e82192623f5..fa999ffdd46eb 100644 --- a/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts +++ b/src/testRunner/unittests/tsserver/cachingFileSystemInformation.ts @@ -1,6 +1,22 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { Logger, createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs, createSession, openFilesForSession, makeSessionRequest, checkProjectActualFiles, checkNumberOfProjects } from "./helpers"; +import { + File, + SymLink, + TestServerHost, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + Logger, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + makeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectSystem CachingFileSystemInformation", () => { enum CalledMapsWithSingleArg { diff --git a/src/testRunner/unittests/tsserver/cancellationToken.ts b/src/testRunner/unittests/tsserver/cancellationToken.ts index 84c1b914e411c..72be15301416e 100644 --- a/src/testRunner/unittests/tsserver/cancellationToken.ts +++ b/src/testRunner/unittests/tsserver/cancellationToken.ts @@ -1,6 +1,9 @@ import * as ts from "../../_namespaces/ts"; import { createServerHost } from "../virtualFileSystemWithWatch"; -import { createSession, TestServerCancellationToken } from "./helpers"; +import { + TestServerCancellationToken, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: cancellationToken", () => { // Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test diff --git a/src/testRunner/unittests/tsserver/compileOnSave.ts b/src/testRunner/unittests/tsserver/compileOnSave.ts index 39ba6857b0715..a5d3948a4e8a3 100644 --- a/src/testRunner/unittests/tsserver/compileOnSave.ts +++ b/src/testRunner/unittests/tsserver/compileOnSave.ts @@ -1,6 +1,22 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { TestTypingsInstaller, makeSessionRequest, createSession, openFilesForSession, checkNumberOfProjects, checkProjectRootFiles, createLoggerWithInMemoryLogs, baselineTsserverLogs, toExternalFiles, protocolTextSpanFromSubstring, TestSession } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestSession, + TestTypingsInstaller, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectRootFiles, + createLoggerWithInMemoryLogs, + createSession, + makeSessionRequest, + openFilesForSession, + protocolTextSpanFromSubstring, + toExternalFiles, +} from "./helpers"; function createTestTypingsInstaller(host: ts.server.ServerHost) { return new TestTypingsInstaller("/a/data/", /*throttleLimit*/5, host); diff --git a/src/testRunner/unittests/tsserver/completions.ts b/src/testRunner/unittests/tsserver/completions.ts index 59852f1fdb857..6a6d5386159e6 100644 --- a/src/testRunner/unittests/tsserver/completions.ts +++ b/src/testRunner/unittests/tsserver/completions.ts @@ -1,6 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest, TestTypingsInstaller, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestTypingsInstaller, + checkNumberOfProjects, + checkProjectActualFiles, + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: completions", () => { it("works", () => { diff --git a/src/testRunner/unittests/tsserver/completionsIncomplete.ts b/src/testRunner/unittests/tsserver/completionsIncomplete.ts index 2088ed57d0a09..8055317a56629 100644 --- a/src/testRunner/unittests/tsserver/completionsIncomplete.ts +++ b/src/testRunner/unittests/tsserver/completionsIncomplete.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { openFilesForSession, createSession } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + openFilesForSession, +} from "./helpers"; function createExportingModuleFile(path: string, exportPrefix: string, exportCount: number): File { return { diff --git a/src/testRunner/unittests/tsserver/configFileSearch.ts b/src/testRunner/unittests/tsserver/configFileSearch.ts index d264aba5619b9..739c07e2ade3e 100644 --- a/src/testRunner/unittests/tsserver/configFileSearch.ts +++ b/src/testRunner/unittests/tsserver/configFileSearch.ts @@ -1,5 +1,16 @@ -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, createLoggerWithInMemoryLogs, checkNumberOfProjects, baselineTsserverLogs } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + createLoggerWithInMemoryLogs, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: searching for config file", () => { it("should stop at projectRootPath if given", () => { diff --git a/src/testRunner/unittests/tsserver/configuredProjects.ts b/src/testRunner/unittests/tsserver/configuredProjects.ts index a8c107f48cebc..c176c061e0d41 100644 --- a/src/testRunner/unittests/tsserver/configuredProjects.ts +++ b/src/testRunner/unittests/tsserver/configuredProjects.ts @@ -1,7 +1,30 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, SymLink } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2, ensureErrorFreeBuild } from "../tscWatch/helpers"; -import { createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkNumberOfConfiguredProjects, configuredProjectAt, checkProjectRootFiles, checkNumberOfInferredProjects, checkNumberOfProjects, checkProjectActualFiles, createSessionWithEventTracking, createSession, openFilesForSession, verifyGetErrRequest } from "./helpers"; +import { + File, + SymLink, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, + ensureErrorFreeBuild, +} from "../tscWatch/helpers"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + createSessionWithEventTracking, + openFilesForSession, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: ConfiguredProjects", () => { it("create configured project without file list", () => { diff --git a/src/testRunner/unittests/tsserver/declarationFileMaps.ts b/src/testRunner/unittests/tsserver/declarationFileMaps.ts index 5f98d88ecdd5a..2007276677059 100644 --- a/src/testRunner/unittests/tsserver/declarationFileMaps.ts +++ b/src/testRunner/unittests/tsserver/declarationFileMaps.ts @@ -1,6 +1,26 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { DocumentSpanFromSubstring, textSpanFromSubstring, TestSession, openFilesForSession, closeFilesForSession, createSession, checkNumberOfProjects, checkProjectActualFiles, executeSessionRequest, protocolFileLocationFromSubstring, protocolFileSpanWithContextFromSubstring, protocolTextSpanFromSubstring, protocolFileSpanFromSubstring, makeReferenceItem, protocolLocationFromSubstring, protocolRenameSpanFromSubstring } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + DocumentSpanFromSubstring, + TestSession, + checkNumberOfProjects, + checkProjectActualFiles, + closeFilesForSession, + createSession, + executeSessionRequest, + makeReferenceItem, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolFileSpanFromSubstring, + protocolFileSpanWithContextFromSubstring, + protocolLocationFromSubstring, + protocolRenameSpanFromSubstring, + protocolTextSpanFromSubstring, + textSpanFromSubstring, +} from "./helpers"; function documentSpanFromSubstring({ file, text, contextText, options, contextOptions }: DocumentSpanFromSubstring): ts.DocumentSpan { const contextSpan = contextText !== undefined ? documentSpanFromSubstring({ file, text: contextText, options: contextOptions }) : undefined; diff --git a/src/testRunner/unittests/tsserver/documentRegistry.ts b/src/testRunner/unittests/tsserver/documentRegistry.ts index 304e0b78f5af0..c93b84a67a114 100644 --- a/src/testRunner/unittests/tsserver/documentRegistry.ts +++ b/src/testRunner/unittests/tsserver/documentRegistry.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { TestProjectService, checkProjectActualFiles, createProjectService } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestProjectService, + checkProjectActualFiles, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: document registry in project service", () => { const importModuleContent = `import {a} from "./module1"`; diff --git a/src/testRunner/unittests/tsserver/duplicatePackages.ts b/src/testRunner/unittests/tsserver/duplicatePackages.ts index 41b7565b51fc5..7af85c3f9d611 100644 --- a/src/testRunner/unittests/tsserver/duplicatePackages.ts +++ b/src/testRunner/unittests/tsserver/duplicatePackages.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: duplicate packages", () => { // Tests that 'moduleSpecifiers.ts' will import from the redirecting file, and not from the file it redirects to, if that can provide a global module specifier. diff --git a/src/testRunner/unittests/tsserver/dynamicFiles.ts b/src/testRunner/unittests/tsserver/dynamicFiles.ts index 007ba4d02d6c5..6551422911f83 100644 --- a/src/testRunner/unittests/tsserver/dynamicFiles.ts +++ b/src/testRunner/unittests/tsserver/dynamicFiles.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { checkNumberOfProjects, checkProjectActualFiles, checkProjectRootFiles, createProjectService, createSession, executeSessionRequest, executeSessionRequestNoResponse, openFilesForSession, verifyDynamic } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + createProjectService, + createSession, + executeSessionRequest, + executeSessionRequestNoResponse, + openFilesForSession, + verifyDynamic, +} from "./helpers"; function verifyPathRecognizedAsDynamic(path: string) { const file: File = { diff --git a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts index 61c60887ea6e3..c775e8a104e51 100644 --- a/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts +++ b/src/testRunner/unittests/tsserver/events/largeFileReferenced.ts @@ -1,6 +1,15 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../../virtualFileSystemWithWatch"; -import { createSessionWithEventTracking, checkProjectActualFiles, openFilesForSession, checkNumberOfProjects } from "../helpers"; +import { + File, + createServerHost, + libFile, +} from "../../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createSessionWithEventTracking, + openFilesForSession, +} from "../helpers"; describe("unittests:: tsserver:: events:: LargeFileReferencedEvent with large file", () => { diff --git a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts index ac95c7d01a546..67f56833399b6 100644 --- a/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts +++ b/src/testRunner/unittests/tsserver/events/projectLanguageServiceState.ts @@ -1,6 +1,17 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../../virtualFileSystemWithWatch"; -import { createSessionWithEventTracking, checkNumberOfProjects, configuredProjectAt, createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs } from "../helpers"; +import { + File, + createServerHost, + libFile, +} from "../../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSessionWithEventTracking, +} from "../helpers"; describe("unittests:: tsserver:: events:: ProjectLanguageServiceStateEvent", () => { it("language service disabled events are triggered", () => { diff --git a/src/testRunner/unittests/tsserver/events/projectLoading.ts b/src/testRunner/unittests/tsserver/events/projectLoading.ts index 34bf3d736fd81..92f7e47b7fc01 100644 --- a/src/testRunner/unittests/tsserver/events/projectLoading.ts +++ b/src/testRunner/unittests/tsserver/events/projectLoading.ts @@ -1,6 +1,19 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../../virtualFileSystemWithWatch"; -import { TestSession, openFilesForSession, checkNumberOfProjects, protocolLocationFromSubstring, toExternalFiles, createSessionWithEventTracking, createSessionWithDefaultEventHandler } from "../helpers"; +import { + File, + TestServerHost, + createServerHost, + libFile, +} from "../../virtualFileSystemWithWatch"; +import { + TestSession, + checkNumberOfProjects, + createSessionWithDefaultEventHandler, + createSessionWithEventTracking, + openFilesForSession, + protocolLocationFromSubstring, + toExternalFiles, +} from "../helpers"; describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoadingFinish events", () => { const aTs: File = { diff --git a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts index 857858cf7fc5b..48457ff976dc7 100644 --- a/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts +++ b/src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts @@ -1,6 +1,19 @@ import * as ts from "../../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../../virtualFileSystemWithWatch"; -import { TestSession, Logger, createLoggerWithInMemoryLogs, baselineTsserverLogs, createSessionWithEventTracking, createSessionWithDefaultEventHandler, createHasErrorMessageLogger } from "../helpers"; +import { + File, + TestServerHost, + createServerHost, + libFile, +} from "../../virtualFileSystemWithWatch"; +import { + Logger, + TestSession, + baselineTsserverLogs, + createHasErrorMessageLogger, + createLoggerWithInMemoryLogs, + createSessionWithDefaultEventHandler, + createSessionWithEventTracking, +} from "../helpers"; describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => { function verifyFiles(caption: string, actual: readonly string[], expected: readonly string[]) { diff --git a/src/testRunner/unittests/tsserver/exportMapCache.ts b/src/testRunner/unittests/tsserver/exportMapCache.ts index 6e195e47724c3..7d75decb752ec 100644 --- a/src/testRunner/unittests/tsserver/exportMapCache.ts +++ b/src/testRunner/unittests/tsserver/exportMapCache.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, configuredProjectAt, executeSessionRequest } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + configuredProjectAt, + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; const packageJson: File = { path: "/package.json", diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index b6cd6ecdb96f7..c9e948efbeb5d 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -1,7 +1,23 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, toExternalFiles, checkProjectActualFiles, toExternalFile, createSession, checkNumberOfProjects, checkNumberOfExternalProjects, checkNumberOfInferredProjects, verifyDynamic, checkProjectRootFiles, configuredProjectAt } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfExternalProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + configuredProjectAt, + createProjectService, + createSession, + toExternalFile, + toExternalFiles, + verifyDynamic, +} from "./helpers"; describe("unittests:: tsserver:: ExternalProjects", () => { describe("can handle tsconfig file name with difference casing", () => { diff --git a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts index c2dc254e961cc..1c0411cb425c1 100644 --- a/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts +++ b/src/testRunner/unittests/tsserver/forceConsistentCasingInFileNames.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, checkNumberOfProjects, configuredProjectAt, createLoggerWithInMemoryLogs, verifyGetErrRequest, closeFilesForSession, protocolTextSpanFromSubstring, baselineTsserverLogs } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + closeFilesForSession, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolTextSpanFromSubstring, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => { it("works when extends is specified with a case insensitive file system", () => { diff --git a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts index 43004a13f8c25..c87e565b36347 100644 --- a/src/testRunner/unittests/tsserver/getApplicableRefactors.ts +++ b/src/testRunner/unittests/tsserver/getApplicableRefactors.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: getApplicableRefactors", () => { it("works when taking position", () => { diff --git a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts index 9b28cc90512dc..8f2baf82484ad 100644 --- a/src/testRunner/unittests/tsserver/getEditsForFileRename.ts +++ b/src/testRunner/unittests/tsserver/getEditsForFileRename.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createProjectService, textSpanFromSubstring, createSession, openFilesForSession, executeSessionRequest, protocolTextSpanFromSubstring } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createProjectService, + createSession, + executeSessionRequest, + openFilesForSession, + protocolTextSpanFromSubstring, + textSpanFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: getEditsForFileRename", () => { it("works for host implementing 'resolveModuleNames' and 'getResolvedModuleWithFailedLookupLocationsFromCache'", () => { diff --git a/src/testRunner/unittests/tsserver/getExportReferences.ts b/src/testRunner/unittests/tsserver/getExportReferences.ts index 7b8152631580a..8d9051824d582 100644 --- a/src/testRunner/unittests/tsserver/getExportReferences.ts +++ b/src/testRunner/unittests/tsserver/getExportReferences.ts @@ -1,6 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, makeReferenceItem, MakeReferenceItem, executeSessionRequest, protocolFileLocationFromSubstring, protocolLocationFromSubstring } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + MakeReferenceItem, + createSession, + executeSessionRequest, + makeReferenceItem, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolLocationFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: getExportReferences", () => { const exportVariable = "export const value = 0;"; diff --git a/src/testRunner/unittests/tsserver/getFileReferences.ts b/src/testRunner/unittests/tsserver/getFileReferences.ts index 37e0381d04c88..40cd8a791fa3a 100644 --- a/src/testRunner/unittests/tsserver/getFileReferences.ts +++ b/src/testRunner/unittests/tsserver/getFileReferences.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest, makeReferenceItem } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + makeReferenceItem, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: getFileReferences", () => { const importA = `import "./a";`; diff --git a/src/testRunner/unittests/tsserver/helpers.ts b/src/testRunner/unittests/tsserver/helpers.ts index 6fb580890d5c7..603fe35174d27 100644 --- a/src/testRunner/unittests/tsserver/helpers.ts +++ b/src/testRunner/unittests/tsserver/helpers.ts @@ -1,7 +1,16 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; -import { changeToHostTrackingWrittenFiles, checkArray, createServerHost, File, FileOrFolderOrSymLink, libFile, TestServerHost, TestServerHostTrackingWrittenFiles } from "../virtualFileSystemWithWatch"; +import { + File, + FileOrFolderOrSymLink, + TestServerHost, + TestServerHostTrackingWrittenFiles, + changeToHostTrackingWrittenFiles, + checkArray, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; const outputEventRegex = /Content\-Length: [\d]+\r\n\r\n/; diff --git a/src/testRunner/unittests/tsserver/importHelpers.ts b/src/testRunner/unittests/tsserver/importHelpers.ts index f9f51ecf5dcc5..34bb711b5ab4f 100644 --- a/src/testRunner/unittests/tsserver/importHelpers.ts +++ b/src/testRunner/unittests/tsserver/importHelpers.ts @@ -1,5 +1,8 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; -import { createProjectService, toExternalFile } from "./helpers"; +import { + createProjectService, + toExternalFile, +} from "./helpers"; describe("unittests:: tsserver:: import helpers", () => { it("should not crash in tsserver", () => { diff --git a/src/testRunner/unittests/tsserver/inferredProjects.ts b/src/testRunner/unittests/tsserver/inferredProjects.ts index c68750cf513c1..5a69bc6e9f1c1 100644 --- a/src/testRunner/unittests/tsserver/inferredProjects.ts +++ b/src/testRunner/unittests/tsserver/inferredProjects.ts @@ -1,7 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; import { commonFile1 } from "../tscWatch/helpers"; -import { createProjectService, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, checkProjectActualFiles, checkNumberOfProjects, createSession } from "./helpers"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: Inferred projects", () => { it("create inferred project", () => { diff --git a/src/testRunner/unittests/tsserver/inlayHints.ts b/src/testRunner/unittests/tsserver/inlayHints.ts index 3e658a06990c8..8fb572967541f 100644 --- a/src/testRunner/unittests/tsserver/inlayHints.ts +++ b/src/testRunner/unittests/tsserver/inlayHints.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { createSession, TestSession } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + TestSession, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: inlayHints", () => { const configFile: File = { diff --git a/src/testRunner/unittests/tsserver/jsdocTag.ts b/src/testRunner/unittests/tsserver/jsdocTag.ts index 568475465a536..050d3cc933667 100644 --- a/src/testRunner/unittests/tsserver/jsdocTag.ts +++ b/src/testRunner/unittests/tsserver/jsdocTag.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: jsdoc @link ", () => { const config: File = { diff --git a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts index b3588e9bd446e..f65581a725523 100644 --- a/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts +++ b/src/testRunner/unittests/tsserver/maxNodeModuleJsDepth.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, checkNumberOfInferredProjects } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfInferredProjects, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: maxNodeModuleJsDepth for inferred projects", () => { it("should be set to 2 if the project has js root files", () => { diff --git a/src/testRunner/unittests/tsserver/metadataInResponse.ts b/src/testRunner/unittests/tsserver/metadataInResponse.ts index 81fb935298f1a..e79227946d26e 100644 --- a/src/testRunner/unittests/tsserver/metadataInResponse.ts +++ b/src/testRunner/unittests/tsserver/metadataInResponse.ts @@ -1,7 +1,16 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File, TestServerHost } from "../virtualFileSystemWithWatch"; -import { mapOutputToJson, TestSession, createSession, openFilesForSession } from "./helpers"; +import { + File, + TestServerHost, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + TestSession, + createSession, + mapOutputToJson, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: with metadata in response", () => { const metadata = "Extra Info"; diff --git a/src/testRunner/unittests/tsserver/moduleResolution.ts b/src/testRunner/unittests/tsserver/moduleResolution.ts index 2c75549113521..73d712ff87d62 100644 --- a/src/testRunner/unittests/tsserver/moduleResolution.ts +++ b/src/testRunner/unittests/tsserver/moduleResolution.ts @@ -1,6 +1,16 @@ import * as Utils from "../../_namespaces/Utils"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, verifyGetErrRequest, baselineTsserverLogs } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: moduleResolution", () => { describe("package json file is edited", () => { diff --git a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts index 4151e78e7a82b..b149c7bd6ffe8 100644 --- a/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts +++ b/src/testRunner/unittests/tsserver/moduleSpecifierCache.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createLoggerWithInMemoryLogs, baselineTsserverLogs, executeSessionRequest, Logger, createSession, openFilesForSession, configuredProjectAt } from "./helpers"; +import { + File, + SymLink, + TestServerHost, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + Logger, + baselineTsserverLogs, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; const packageJson: File = { path: "/package.json", diff --git a/src/testRunner/unittests/tsserver/navTo.ts b/src/testRunner/unittests/tsserver/navTo.ts index 9c6acda8fd1a1..951287c0df7e2 100644 --- a/src/testRunner/unittests/tsserver/navTo.ts +++ b/src/testRunner/unittests/tsserver/navTo.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, makeSessionRequest, createLoggerWithInMemoryLogs, baselineTsserverLogs } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + makeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: navigate-to for javascript project", () => { function findNavToItem(items: ts.server.protocol.NavtoItem[], itemName: string, itemKind: string) { diff --git a/src/testRunner/unittests/tsserver/occurences.ts b/src/testRunner/unittests/tsserver/occurences.ts index 4d5481e065388..7e6c9daeb36b9 100644 --- a/src/testRunner/unittests/tsserver/occurences.ts +++ b/src/testRunner/unittests/tsserver/occurences.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, makeSessionRequest } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + makeSessionRequest, +} from "./helpers"; describe("unittests:: tsserver:: occurrence highlight on string", () => { it("should be marked if only on string values", () => { diff --git a/src/testRunner/unittests/tsserver/openFile.ts b/src/testRunner/unittests/tsserver/openFile.ts index 998c68cfa505a..190cddc49f295 100644 --- a/src/testRunner/unittests/tsserver/openFile.ts +++ b/src/testRunner/unittests/tsserver/openFile.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, toExternalFile, checkProjectActualFiles, createSession, createLoggerWithInMemoryLogs, openFilesForSession, verifyGetErrRequest, protocolTextSpanFromSubstring, baselineTsserverLogs } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkProjectActualFiles, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + openFilesForSession, + protocolTextSpanFromSubstring, + toExternalFile, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: Open-file", () => { it("can be reloaded with empty content", () => { diff --git a/src/testRunner/unittests/tsserver/packageJsonInfo.ts b/src/testRunner/unittests/tsserver/packageJsonInfo.ts index 02de3b01ebcd5..393c5a24ba02f 100644 --- a/src/testRunner/unittests/tsserver/packageJsonInfo.ts +++ b/src/testRunner/unittests/tsserver/packageJsonInfo.ts @@ -1,6 +1,12 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, configuredProjectAt } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + configuredProjectAt, + createSession, +} from "./helpers"; const tsConfig: File = { path: "/tsconfig.json", diff --git a/src/testRunner/unittests/tsserver/partialSemanticServer.ts b/src/testRunner/unittests/tsserver/partialSemanticServer.ts index 416ce5c2cec98..bc09ece98fc4c 100644 --- a/src/testRunner/unittests/tsserver/partialSemanticServer.ts +++ b/src/testRunner/unittests/tsserver/partialSemanticServer.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, checkNumberOfProjects, checkProjectActualFiles, baselineTsserverLogs, protocolFileLocationFromSubstring, verifyGetErrRequest, closeFilesForSession } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + closeFilesForSession, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolFileLocationFromSubstring, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: Semantic operations on partialSemanticServer", () => { function setup() { diff --git a/src/testRunner/unittests/tsserver/plugins.ts b/src/testRunner/unittests/tsserver/plugins.ts index de4650ffc64a3..ae4c598b4b640 100644 --- a/src/testRunner/unittests/tsserver/plugins.ts +++ b/src/testRunner/unittests/tsserver/plugins.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, createSession, createLoggerWithInMemoryLogs, openFilesForSession, baselineTsserverLogs } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: plugins loading", () => { const testProtocolCommand = "testProtocolCommand"; diff --git a/src/testRunner/unittests/tsserver/projectErrors.ts b/src/testRunner/unittests/tsserver/projectErrors.ts index 95fd7af6d89c6..7cc11e9bb1123 100644 --- a/src/testRunner/unittests/tsserver/projectErrors.ts +++ b/src/testRunner/unittests/tsserver/projectErrors.ts @@ -1,6 +1,26 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, Folder, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, toExternalFiles, checkNumberOfProjects, openFilesForSession, configuredProjectAt, createProjectService, checkProjectRootFiles, createLoggerWithInMemoryLogs, appendAllScriptInfos, verifyGetErrRequest, baselineTsserverLogs, closeFilesForSession, verifyGetErrScenario, executeSessionRequest } from "./helpers"; +import { + File, + Folder, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + appendAllScriptInfos, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectRootFiles, + closeFilesForSession, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + executeSessionRequest, + openFilesForSession, + toExternalFiles, + verifyGetErrRequest, + verifyGetErrScenario, +} from "./helpers"; describe("unittests:: tsserver:: Project Errors", () => { function checkProjectErrors(projectFiles: ts.server.ProjectFilesWithTSDiagnostics, expectedErrors: readonly string[]): void { diff --git a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts index 1daceed20d992..c1dafa9ad79b8 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceCompileOnSave.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; import { ensureErrorFreeBuild } from "../tscWatch/helpers"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, baselineTsserverLogs, protocolToLocation } from "./helpers"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolToLocation, +} from "./helpers"; describe("unittests:: tsserver:: with project references and compile on save", () => { const dependecyLocation = `/user/username/projects/myproject/dependency`; diff --git a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts index 7d25ffdfb4011..a590f7906ea3c 100644 --- a/src/testRunner/unittests/tsserver/projectReferenceErrors.ts +++ b/src/testRunner/unittests/tsserver/projectReferenceErrors.ts @@ -1,5 +1,8 @@ import { File } from "../virtualFileSystemWithWatch"; -import { GetErrForProjectDiagnostics, verifyGetErrScenario } from "./helpers"; +import { + GetErrForProjectDiagnostics, + verifyGetErrScenario, +} from "./helpers"; describe("unittests:: tsserver:: with project references and error reporting", () => { const dependecyLocation = `/user/username/projects/myproject/dependency`; diff --git a/src/testRunner/unittests/tsserver/projectReferences.ts b/src/testRunner/unittests/tsserver/projectReferences.ts index 8fa087a7a7cde..4846ca154307d 100644 --- a/src/testRunner/unittests/tsserver/projectReferences.ts +++ b/src/testRunner/unittests/tsserver/projectReferences.ts @@ -1,6 +1,25 @@ import * as ts from "../../_namespaces/ts"; -import { baselineTsserverLogs, checkProjectActualFiles, createHostWithSolutionBuild, createLoggerWithInMemoryLogs, createProjectService, createSession, makeReferenceItem, openFilesForSession, protocolFileLocationFromSubstring, protocolLocationFromSubstring, verifyGetErrRequest } from "./helpers"; -import { createServerHost, File, getTsBuildProjectFile, getTsBuildProjectFilePath, libFile, SymLink } from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkProjectActualFiles, + createHostWithSolutionBuild, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + makeReferenceItem, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolLocationFromSubstring, + verifyGetErrRequest, +} from "./helpers"; +import { + File, + SymLink, + createServerHost, + getTsBuildProjectFile, + getTsBuildProjectFilePath, + libFile, +} from "../virtualFileSystemWithWatch"; import { solutionBuildWithBaseline } from "../tscWatch/helpers"; describe("unittests:: tsserver:: with project references and tsbuild", () => { diff --git a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts index e8149dae66471..650527ea95a91 100644 --- a/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts +++ b/src/testRunner/unittests/tsserver/projectReferencesSourcemap.ts @@ -1,6 +1,19 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TestSession, closeFilesForSession, openFilesForSession, createHostWithSolutionBuild, createSession, createLoggerWithInMemoryLogs, baselineTsserverLogs } from "./helpers"; +import { + File, + TestServerHost, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestSession, + baselineTsserverLogs, + closeFilesForSession, + createHostWithSolutionBuild, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: with project references and tsbuild source map", () => { const dependecyLocation = `/user/username/projects/myproject/dependency`; diff --git a/src/testRunner/unittests/tsserver/projects.ts b/src/testRunner/unittests/tsserver/projects.ts index 35984a6707845..681c79331580a 100644 --- a/src/testRunner/unittests/tsserver/projects.ts +++ b/src/testRunner/unittests/tsserver/projects.ts @@ -1,7 +1,33 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, makeSessionRequest, baselineTsserverLogs, createProjectService, configuredProjectAt, checkProjectRootFiles, checkNumberOfConfiguredProjects, checkNumberOfInferredProjects, toExternalFiles, checkNumberOfProjects, checkProjectActualFiles, customTypesMap, toExternalFile, closeFilesForSession, verifyGetErrRequest, protocolFileLocationFromSubstring } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + baselineTsserverLogs, + checkNumberOfConfiguredProjects, + checkNumberOfInferredProjects, + checkNumberOfProjects, + checkProjectActualFiles, + checkProjectRootFiles, + closeFilesForSession, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + customTypesMap, + makeSessionRequest, + openFilesForSession, + protocolFileLocationFromSubstring, + toExternalFile, + toExternalFiles, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: Projects", () => { it("handles the missing files - that were added to program because they were added with /// { diff --git a/src/testRunner/unittests/tsserver/projectsWithReferences.ts b/src/testRunner/unittests/tsserver/projectsWithReferences.ts index d797ac31b01eb..ada75410a174e 100644 --- a/src/testRunner/unittests/tsserver/projectsWithReferences.ts +++ b/src/testRunner/unittests/tsserver/projectsWithReferences.ts @@ -1,5 +1,15 @@ -import { createServerHost, File, getTsBuildProjectFile, libFile } from "../virtualFileSystemWithWatch"; -import { createLoggerWithInMemoryLogs, createProjectService, baselineTsserverLogs, checkNumberOfProjects } from "./helpers"; +import { + File, + createServerHost, + getTsBuildProjectFile, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + checkNumberOfProjects, + createLoggerWithInMemoryLogs, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: projects with references: invoking when references are already built", () => { it("on sample project", () => { diff --git a/src/testRunner/unittests/tsserver/refactors.ts b/src/testRunner/unittests/tsserver/refactors.ts index 2753c6dee5bf8..b10d7c178afd6 100644 --- a/src/testRunner/unittests/tsserver/refactors.ts +++ b/src/testRunner/unittests/tsserver/refactors.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: refactors", () => { it("use formatting options", () => { diff --git a/src/testRunner/unittests/tsserver/reload.ts b/src/testRunner/unittests/tsserver/reload.ts index b6e5db0cc6d4b..4bd0ac29c2994 100644 --- a/src/testRunner/unittests/tsserver/reload.ts +++ b/src/testRunner/unittests/tsserver/reload.ts @@ -1,6 +1,12 @@ -import { createServerHost, libFile } from "../virtualFileSystemWithWatch"; +import { + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; -import { createSession, checkNumberOfProjects } from "./helpers"; +import { + checkNumberOfProjects, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: reload", () => { it("should work with temp file", () => { diff --git a/src/testRunner/unittests/tsserver/reloadProjects.ts b/src/testRunner/unittests/tsserver/reloadProjects.ts index 687b3c465e7a9..d22928bcc80ce 100644 --- a/src/testRunner/unittests/tsserver/reloadProjects.ts +++ b/src/testRunner/unittests/tsserver/reloadProjects.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TestProjectService, createProjectService, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + File, + TestServerHost, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestProjectService, + checkNumberOfProjects, + checkProjectActualFiles, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: reloadProjects", () => { const configFile: File = { diff --git a/src/testRunner/unittests/tsserver/rename.ts b/src/testRunner/unittests/tsserver/rename.ts index 19cf8ba6c6006..05e2dade62e81 100644 --- a/src/testRunner/unittests/tsserver/rename.ts +++ b/src/testRunner/unittests/tsserver/rename.ts @@ -1,6 +1,16 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest, protocolFileLocationFromSubstring, protocolTextSpanFromSubstring, protocolRenameSpanFromSubstring } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, + protocolFileLocationFromSubstring, + protocolRenameSpanFromSubstring, + protocolTextSpanFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: rename", () => { it("works with fileToRename", () => { diff --git a/src/testRunner/unittests/tsserver/resolutionCache.ts b/src/testRunner/unittests/tsserver/resolutionCache.ts index eb2636a9491a0..7a53291ddf888 100644 --- a/src/testRunner/unittests/tsserver/resolutionCache.ts +++ b/src/testRunner/unittests/tsserver/resolutionCache.ts @@ -1,6 +1,24 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createProjectService, TestTypingsInstaller, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkProjectActualFiles, configuredProjectAt, createSession, openFilesForSession, makeSessionRequest, verifyGetErrRequest, toExternalFiles, checkNumberOfProjects } from "./helpers"; +import { + File, + TestServerHost, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestTypingsInstaller, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + makeSessionRequest, + openFilesForSession, + toExternalFiles, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem extra resolution pass in server host", () => { it("can load typings that are proper modules", () => { diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 000076f78e772..d50ed165dde2d 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -3,7 +3,10 @@ import { expect } from "chai"; import * as ts from "../../_namespaces/ts"; import * as Harness from "../../_namespaces/Harness"; import * as Utils from "../../_namespaces/Utils"; -import { nullLogger, createHasErrorMessageLogger } from "./helpers"; +import { + createHasErrorMessageLogger, + nullLogger, +} from "./helpers"; let lastWrittenToHost: string; const noopFileWatcher: ts.FileWatcher = { close: ts.noop }; diff --git a/src/testRunner/unittests/tsserver/skipLibCheck.ts b/src/testRunner/unittests/tsserver/skipLibCheck.ts index 7be07cb172f6a..add3fb8c30a24 100644 --- a/src/testRunner/unittests/tsserver/skipLibCheck.ts +++ b/src/testRunner/unittests/tsserver/skipLibCheck.ts @@ -1,6 +1,11 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; -import { createSession, openFilesForSession, makeSessionRequest, toExternalFiles } from "./helpers"; +import { + createSession, + makeSessionRequest, + openFilesForSession, + toExternalFiles, +} from "./helpers"; describe("unittests:: tsserver:: with skipLibCheck", () => { it("should be turned on for js-only inferred projects", () => { diff --git a/src/testRunner/unittests/tsserver/smartSelection.ts b/src/testRunner/unittests/tsserver/smartSelection.ts index 257d009d42b3b..07210c6da3e80 100644 --- a/src/testRunner/unittests/tsserver/smartSelection.ts +++ b/src/testRunner/unittests/tsserver/smartSelection.ts @@ -1,6 +1,14 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, executeSessionRequest } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + executeSessionRequest, + openFilesForSession, +} from "./helpers"; function setup(fileName: string, content: string) { const file: File = { path: fileName, content }; diff --git a/src/testRunner/unittests/tsserver/symLinks.ts b/src/testRunner/unittests/tsserver/symLinks.ts index afcfb9731db31..121399ac4fc99 100644 --- a/src/testRunner/unittests/tsserver/symLinks.ts +++ b/src/testRunner/unittests/tsserver/symLinks.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, SymLink, TestServerHost } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, executeSessionRequest, protocolLocationFromSubstring, baselineTsserverLogs, verifyGetErrRequest } from "./helpers"; +import { + File, + SymLink, + TestServerHost, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createSession, + executeSessionRequest, + openFilesForSession, + protocolLocationFromSubstring, + verifyGetErrRequest, +} from "./helpers"; describe("unittests:: tsserver:: symLinks", () => { it("rename in common file renames all project", () => { diff --git a/src/testRunner/unittests/tsserver/symlinkCache.ts b/src/testRunner/unittests/tsserver/symlinkCache.ts index 31dfa9879ec64..7bc56c7e5a291 100644 --- a/src/testRunner/unittests/tsserver/symlinkCache.ts +++ b/src/testRunner/unittests/tsserver/symlinkCache.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, SymLink } from "../virtualFileSystemWithWatch"; -import { openFilesForSession, createSession } from "./helpers"; +import { + File, + SymLink, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + openFilesForSession, +} from "./helpers"; const appTsconfigJson: File = { path: "/packages/app/tsconfig.json", diff --git a/src/testRunner/unittests/tsserver/syntacticServer.ts b/src/testRunner/unittests/tsserver/syntacticServer.ts index 546ac68c5683a..620f40130d715 100644 --- a/src/testRunner/unittests/tsserver/syntacticServer.ts +++ b/src/testRunner/unittests/tsserver/syntacticServer.ts @@ -1,6 +1,20 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createSession, createLoggerWithInMemoryLogs, TestSession, openFilesForSession, closeFilesForSession, baselineTsserverLogs, protocolFileLocationFromSubstring, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestSession, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + closeFilesForSession, + createLoggerWithInMemoryLogs, + createSession, + openFilesForSession, + protocolFileLocationFromSubstring, +} from "./helpers"; describe("unittests:: tsserver:: Semantic operations on Syntax server", () => { function setup() { diff --git a/src/testRunner/unittests/tsserver/syntaxOperations.ts b/src/testRunner/unittests/tsserver/syntaxOperations.ts index 0432f18ca0965..450f8f04d9815 100644 --- a/src/testRunner/unittests/tsserver/syntaxOperations.ts +++ b/src/testRunner/unittests/tsserver/syntaxOperations.ts @@ -1,6 +1,15 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { TestSession, createSession, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestSession, + checkNumberOfProjects, + checkProjectActualFiles, + createSession, +} from "./helpers"; describe("unittests:: tsserver:: syntax operations", () => { function navBarFull(session: TestSession, file: File) { diff --git a/src/testRunner/unittests/tsserver/telemetry.ts b/src/testRunner/unittests/tsserver/telemetry.ts index 28a6767a1c1f8..3efc9bdd2136a 100644 --- a/src/testRunner/unittests/tsserver/telemetry.ts +++ b/src/testRunner/unittests/tsserver/telemetry.ts @@ -1,6 +1,11 @@ import * as ts from "../../_namespaces/ts"; import { File } from "../virtualFileSystemWithWatch"; -import { TestServerEventManager, checkNumberOfProjects, fileStats, toExternalFiles } from "./helpers"; +import { + TestServerEventManager, + checkNumberOfProjects, + fileStats, + toExternalFiles, +} from "./helpers"; describe("unittests:: tsserver:: project telemetry", () => { it("does nothing for inferred project", () => { diff --git a/src/testRunner/unittests/tsserver/typeAquisition.ts b/src/testRunner/unittests/tsserver/typeAquisition.ts index 3209f3388afa0..ec5ffbcafd825 100644 --- a/src/testRunner/unittests/tsserver/typeAquisition.ts +++ b/src/testRunner/unittests/tsserver/typeAquisition.ts @@ -1,6 +1,12 @@ import { createServerHost } from "../virtualFileSystemWithWatch"; import * as ts from "../../_namespaces/ts"; -import { createProjectService, toExternalFile, TestTypingsInstaller, checkProjectActualFiles, configuredProjectAt } from "./helpers"; +import { + TestTypingsInstaller, + checkProjectActualFiles, + configuredProjectAt, + createProjectService, + toExternalFile, +} from "./helpers"; describe("unittests:: tsserver:: autoDiscovery", () => { it("does not depend on extension", () => { diff --git a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts index 42c5426b2e55d..abc1fb87c1d80 100644 --- a/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts +++ b/src/testRunner/unittests/tsserver/typeOnlyImportChains.ts @@ -1,6 +1,13 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File } from "../virtualFileSystemWithWatch"; -import { createSession, openFilesForSession, makeSessionRequest } from "./helpers"; +import { + File, + createServerHost, +} from "../virtualFileSystemWithWatch"; +import { + createSession, + makeSessionRequest, + openFilesForSession, +} from "./helpers"; describe("unittests:: tsserver:: typeOnlyImportChains", () => { it("named export -> type-only namespace import -> named export -> named import", () => { diff --git a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts index 6a86032438680..84f259ba94427 100644 --- a/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts +++ b/src/testRunner/unittests/tsserver/typeReferenceDirectives.ts @@ -1,5 +1,13 @@ -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { createProjectService, checkNumberOfProjects, checkProjectActualFiles } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + createProjectService, +} from "./helpers"; describe("unittests:: tsserver:: typeReferenceDirectives", () => { it("when typeReferenceDirective contains UpperCasePackage", () => { diff --git a/src/testRunner/unittests/tsserver/typingsInstaller.ts b/src/testRunner/unittests/tsserver/typingsInstaller.ts index 267791ff75394..231ebfe7b8002 100644 --- a/src/testRunner/unittests/tsserver/typingsInstaller.ts +++ b/src/testRunner/unittests/tsserver/typingsInstaller.ts @@ -1,6 +1,23 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, TestServerHost } from "../virtualFileSystemWithWatch"; -import { TestTypingsInstaller, createTypesRegistry, createProjectService, checkProjectActualFiles, configuredProjectAt, createLoggerWithInMemoryLogs, baselineTsserverLogs, checkNumberOfProjects, toExternalFile, customTypesMap, createSession } from "./helpers"; +import { + File, + TestServerHost, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + TestTypingsInstaller, + baselineTsserverLogs, + checkNumberOfProjects, + checkProjectActualFiles, + configuredProjectAt, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + createTypesRegistry, + customTypesMap, + toExternalFile, +} from "./helpers"; import validatePackageName = ts.JsTyping.validatePackageName; import NameValidationResult = ts.JsTyping.NameValidationResult; diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 28c7bc8169cf2..19f694370092a 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -1,7 +1,25 @@ import * as ts from "../../_namespaces/ts"; -import { createServerHost, File, libFile, Tsc_WatchDirectory } from "../virtualFileSystemWithWatch"; -import { commonFile1, commonFile2 } from "../tscWatch/helpers"; -import { createSession, createLoggerWithInMemoryLogs, openFilesForSession, protocolFileLocationFromSubstring, baselineTsserverLogs, Logger, TestSession, toExternalFiles, createProjectService } from "./helpers"; +import { + File, + Tsc_WatchDirectory, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + commonFile1, + commonFile2, +} from "../tscWatch/helpers"; +import { + Logger, + TestSession, + baselineTsserverLogs, + createLoggerWithInMemoryLogs, + createProjectService, + createSession, + openFilesForSession, + protocolFileLocationFromSubstring, + toExternalFiles, +} from "./helpers"; describe("unittests:: tsserver:: watchEnvironment:: tsserverProjectSystem watchDirectories implementation", () => { function verifyCompletionListWithNewFileInSubFolder(scenario: string, tscWatchDirectory: Tsc_WatchDirectory) { diff --git a/src/testRunner/unittests/tsserver/webServer.ts b/src/testRunner/unittests/tsserver/webServer.ts index 2b6b118232302..9b4d8b77cd919 100644 --- a/src/testRunner/unittests/tsserver/webServer.ts +++ b/src/testRunner/unittests/tsserver/webServer.ts @@ -1,7 +1,17 @@ import * as ts from "../../_namespaces/ts"; import * as Utils from "../../_namespaces/Utils"; -import { createServerHost, File, libFile } from "../virtualFileSystemWithWatch"; -import { nullLogger, checkNumberOfProjects, checkProjectActualFiles, protocolFileLocationFromSubstring, protocolTextSpanWithContextFromSubstring } from "./helpers"; +import { + File, + createServerHost, + libFile, +} from "../virtualFileSystemWithWatch"; +import { + checkNumberOfProjects, + checkProjectActualFiles, + nullLogger, + protocolFileLocationFromSubstring, + protocolTextSpanWithContextFromSubstring, +} from "./helpers"; /* eslint-disable local/boolean-trivia */ describe("unittests:: tsserver:: webServer", () => { diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 6481f0fe2be69..7b09c8740fdc6 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -1,12 +1,51 @@ import * as Harness from "../_namespaces/Harness"; import { - arrayFrom, arrayToMap, clear, clone, combinePaths, compareStringsCaseSensitive, createGetCanonicalFileName, - createMultiMap, createSystemWatchFunctions, Debug, directorySeparator, FileSystemEntryKind, FileWatcher, - FileWatcherCallback, FileWatcherEventKind, filterMutate, forEach, FormatDiagnosticsHost, FsWatchCallback, - FsWatchWorkerWatcher, generateDjb2Hash, getBaseFileName, getDirectoryPath, getNormalizedAbsolutePath, - getRelativePathToDirectoryOrUrl, hasProperty, HostWatchDirectory, HostWatchFile, identity, insertSorted, isArray, - isNumber, isString, mapDefined, matchFiles, ModuleResolutionHost, MultiMap, noop, - patchWriteFileEnsuringDirectory, Path, PollingInterval, RequireResult, server, SortedArray, sys, toPath, + Debug, + FileSystemEntryKind, + FileWatcher, + FileWatcherCallback, + FileWatcherEventKind, + FormatDiagnosticsHost, + FsWatchCallback, + FsWatchWorkerWatcher, + HostWatchDirectory, + HostWatchFile, + ModuleResolutionHost, + MultiMap, + Path, + PollingInterval, + RequireResult, + SortedArray, + arrayFrom, + arrayToMap, + clear, + clone, + combinePaths, + compareStringsCaseSensitive, + createGetCanonicalFileName, + createMultiMap, + createSystemWatchFunctions, + directorySeparator, + filterMutate, + forEach, + generateDjb2Hash, + getBaseFileName, + getDirectoryPath, + getNormalizedAbsolutePath, + getRelativePathToDirectoryOrUrl, + hasProperty, + identity, + insertSorted, + isArray, + isNumber, + isString, + mapDefined, + matchFiles, + noop, + patchWriteFileEnsuringDirectory, + server, + sys, + toPath, } from "../_namespaces/ts"; import { timeIncrements } from "../_namespaces/vfs"; diff --git a/src/tsserver/common.ts b/src/tsserver/common.ts index e2d3ad716e4b7..c272252d63fc3 100644 --- a/src/tsserver/common.ts +++ b/src/tsserver/common.ts @@ -1,5 +1,8 @@ import { - Logger, LogLevel, ServerCancellationToken, StartSessionOptions, + LogLevel, + Logger, + ServerCancellationToken, + StartSessionOptions, } from "./_namespaces/ts.server"; import { LanguageServiceMode } from "./_namespaces/ts"; diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index 20800b86cd3fb..c80669e1136b3 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -1,21 +1,81 @@ import * as ts from "./_namespaces/ts"; import * as server from "./_namespaces/ts.server"; import { - ActionInvalidate, ActionPackageInstalled, ActionSet, Arguments, BaseLogger, BeginInstallTypes, - createInstallTypingsRequest, EndInstallTypes, EventBeginInstallTypes, EventEndInstallTypes, - EventInitializationFailed, EventTypesRegistry, findArgument, formatMessage, getLogLevel, hasArgument, indent, - InitializationFailedResponse, InstallPackageOptionsWithProject, InstallPackageRequest, InvalidateCachedTypings, - ITypingsInstaller, Logger, LogLevel, ModuleImportResult, Msg, nullCancellationToken, nullTypingsInstaller, - PackageInstalledResponse, Project, ProjectService, protocol, ServerCancellationToken, ServerHost, Session, - SetTypings, StartInput, StartSessionOptions, stringifyIndented, toEvent, TypesRegistryResponse, + ActionInvalidate, + ActionPackageInstalled, + ActionSet, + Arguments, + BaseLogger, + BeginInstallTypes, + EndInstallTypes, + EventBeginInstallTypes, + EventEndInstallTypes, + EventInitializationFailed, + EventTypesRegistry, + ITypingsInstaller, + InitializationFailedResponse, + InstallPackageOptionsWithProject, + InstallPackageRequest, + InvalidateCachedTypings, + LogLevel, + Logger, + ModuleImportResult, + Msg, + PackageInstalledResponse, + Project, + ProjectService, + ServerCancellationToken, + ServerHost, + Session, + SetTypings, + StartInput, + StartSessionOptions, + TypesRegistryResponse, TypingInstallerRequestUnion, + createInstallTypingsRequest, + findArgument, + formatMessage, + getLogLevel, + hasArgument, + indent, + nullCancellationToken, + nullTypingsInstaller, + protocol, + stringifyIndented, + toEvent, } from "./_namespaces/ts.server"; import { - ApplyCodeActionCommandResult, assertType, CharacterCodes, combinePaths, createQueue, Debug, directorySeparator, - DirectoryWatcherCallback, FileWatcher, getDirectoryPath, getEntries, getNodeMajorVersion, getRootLength, - JsTyping, LanguageServiceMode, MapLike, noop, noopFileWatcher, normalizePath, normalizeSlashes, resolveJSModule, - SortedReadonlyArray, startTracing, stripQuotes, sys, toFileNameLowerCase, tracing, TypeAcquisition, - validateLocaleAndSetLanguage, versionMajorMinor, WatchOptions, + ApplyCodeActionCommandResult, + CharacterCodes, + Debug, + DirectoryWatcherCallback, + FileWatcher, + JsTyping, + LanguageServiceMode, + MapLike, + SortedReadonlyArray, + TypeAcquisition, + WatchOptions, + assertType, + combinePaths, + createQueue, + directorySeparator, + getDirectoryPath, + getEntries, + getNodeMajorVersion, + getRootLength, + noop, + noopFileWatcher, + normalizePath, + normalizeSlashes, + resolveJSModule, + startTracing, + stripQuotes, + sys, + toFileNameLowerCase, + tracing, + validateLocaleAndSetLanguage, + versionMajorMinor, } from "./_namespaces/ts"; interface LogOptions { diff --git a/src/tsserver/server.ts b/src/tsserver/server.ts index f88fcb3bff204..3757134382448 100644 --- a/src/tsserver/server.ts +++ b/src/tsserver/server.ts @@ -1,8 +1,20 @@ import { - emptyArray, findArgument, hasArgument, initializeNodeSystem, initializeWebSystem, Msg, + Msg, StartInput, + emptyArray, + findArgument, + hasArgument, + initializeNodeSystem, + initializeWebSystem, } from "./_namespaces/ts.server"; -import { Debug, getNodeMajorVersion, setStackTraceLimit, sys, version } from "./_namespaces/ts"; +import { + Debug, + getNodeMajorVersion, + setStackTraceLimit, + sys, + version, +} from "./_namespaces/ts"; + export * from "./_namespaces/ts"; declare const addEventListener: any; diff --git a/src/tsserver/webServer.ts b/src/tsserver/webServer.ts index 712baecea0a58..bc9d36195ac8f 100644 --- a/src/tsserver/webServer.ts +++ b/src/tsserver/webServer.ts @@ -3,14 +3,30 @@ import * as ts from "./_namespaces/ts"; import * as server from "./_namespaces/ts.server"; import { - findArgument, getLogLevel, Logger, MainProcessLogger, Msg, nullCancellationToken, ServerCancellationToken, - ServerHost, StartInput, StartSessionOptions, WebHost, + Logger, + MainProcessLogger, + Msg, + ServerCancellationToken, + ServerHost, + StartInput, + StartSessionOptions, + WebHost, + findArgument, + getLogLevel, + nullCancellationToken, } from "./_namespaces/ts.server"; import { - Debug, LanguageServiceMode, LogLevel, noop, returnFalse, returnUndefined, setSys, sys, validateLocaleAndSetLanguage, + Debug, + LanguageServiceMode, + LogLevel, + noop, + returnFalse, + returnUndefined, + setSys, + sys, + validateLocaleAndSetLanguage, } from "./_namespaces/ts"; - const nullLogger: Logger = { close: noop, hasLevel: returnFalse, diff --git a/src/tsserverlibrary/tsserverlibrary.ts b/src/tsserverlibrary/tsserverlibrary.ts index 6d2ea4f2b682b..6651ea687d4d7 100644 --- a/src/tsserverlibrary/tsserverlibrary.ts +++ b/src/tsserverlibrary/tsserverlibrary.ts @@ -1,2 +1,3 @@ import * as ts from "./_namespaces/ts"; + export = ts; diff --git a/src/typescript/typescript.ts b/src/typescript/typescript.ts index 2b6f76c71d418..9f1934f652a2c 100644 --- a/src/typescript/typescript.ts +++ b/src/typescript/typescript.ts @@ -1,4 +1,8 @@ -import { Debug, LogLevel } from "./_namespaces/ts"; +import { + Debug, + LogLevel, +} from "./_namespaces/ts"; +import * as ts from "./_namespaces/ts"; // enable deprecation logging declare const console: any; @@ -15,5 +19,4 @@ if (typeof console !== "undefined") { }; } -import * as ts from "./_namespaces/ts"; export = ts; diff --git a/src/typingsInstaller/nodeTypingsInstaller.ts b/src/typingsInstaller/nodeTypingsInstaller.ts index 6b996af1fdafd..68774b3c5f4d7 100644 --- a/src/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/typingsInstaller/nodeTypingsInstaller.ts @@ -2,16 +2,39 @@ import * as fs from "fs"; import * as path from "path"; import { - installNpmPackages, Log, RequestCompletedAction, TypingsInstaller, + Log, + RequestCompletedAction, + TypingsInstaller, + installNpmPackages, } from "./_namespaces/ts.server.typingsInstaller"; import { - ActionPackageInstalled, Arguments, EventTypesRegistry, findArgument, hasArgument, InitializationFailedResponse, - InstallTypingHost, nowString, PackageInstalledResponse, TypesRegistryResponse, TypingInstallerRequestUnion, + ActionPackageInstalled, + Arguments, + EventTypesRegistry, + InitializationFailedResponse, + InstallTypingHost, + PackageInstalledResponse, + TypesRegistryResponse, + TypingInstallerRequestUnion, TypingInstallerResponseUnion, + findArgument, + hasArgument, + nowString, } from "./_namespaces/ts.server"; import { - combinePaths, createGetCanonicalFileName, Debug, forEachAncestorDirectory, getDirectoryPath, getEntries, - MapLike, normalizePath, normalizeSlashes, stringContains, sys, toPath, version, + Debug, + MapLike, + combinePaths, + createGetCanonicalFileName, + forEachAncestorDirectory, + getDirectoryPath, + getEntries, + normalizePath, + normalizeSlashes, + stringContains, + sys, + toPath, + version, } from "./_namespaces/ts"; class FileLog implements Log { diff --git a/src/typingsInstallerCore/typingsInstaller.ts b/src/typingsInstallerCore/typingsInstaller.ts index 3f3ab40d3d940..d0e249d996068 100644 --- a/src/typingsInstallerCore/typingsInstaller.ts +++ b/src/typingsInstallerCore/typingsInstaller.ts @@ -1,14 +1,52 @@ import { - clearMap, closeFileWatcher, combinePaths, compareStringsCaseInsensitive, Comparison, containsPath, copyEntries, - createGetCanonicalFileName, directorySeparator, Extension, fileExtensionIs, FileWatcher, getBaseFileName, - GetCanonicalFileName, getDirectoryPath, getProperty, getWatchFactory, hasProperty, JsTyping, - mangleScopedPackageName, mapDefined, MapLike, ModuleResolutionKind, noop, Path, PollingInterval, - resolveModuleName, version, Version, versionMajorMinor, WatchDirectoryFlags, WatchFactory, WatchFactoryHost, - WatchLogLevel, WatchOptions, + Comparison, + Extension, + FileWatcher, + GetCanonicalFileName, + JsTyping, + MapLike, + ModuleResolutionKind, + Path, + PollingInterval, + Version, + WatchDirectoryFlags, + WatchFactory, + WatchFactoryHost, + WatchLogLevel, + WatchOptions, + clearMap, + closeFileWatcher, + combinePaths, + compareStringsCaseInsensitive, + containsPath, + copyEntries, + createGetCanonicalFileName, + directorySeparator, + fileExtensionIs, + getBaseFileName, + getDirectoryPath, + getProperty, + getWatchFactory, + hasProperty, + mangleScopedPackageName, + mapDefined, + noop, + resolveModuleName, + version, + versionMajorMinor, } from "./_namespaces/ts"; import { - ActionInvalidate, ActionSet, BeginInstallTypes, CloseProject, DiscoverTypings, EndInstallTypes, - EventBeginInstallTypes, EventEndInstallTypes, InstallTypingHost, InvalidateCachedTypings, SetTypings, + ActionInvalidate, + ActionSet, + BeginInstallTypes, + CloseProject, + DiscoverTypings, + EndInstallTypes, + EventBeginInstallTypes, + EventEndInstallTypes, + InstallTypingHost, + InvalidateCachedTypings, + SetTypings, } from "./_namespaces/ts.server"; interface NpmConfig { diff --git a/src/webServer/webServer.ts b/src/webServer/webServer.ts index 07280259807dc..ca3be411e44d7 100644 --- a/src/webServer/webServer.ts +++ b/src/webServer/webServer.ts @@ -2,12 +2,32 @@ /// import { - indent, Logger, LogLevel, ModuleImportResult, Msg, nowString, nullTypingsInstaller, protocol, - ServerCancellationToken, ServerHost, Session, SessionOptions, + LogLevel, + Logger, + ModuleImportResult, + Msg, + ServerCancellationToken, + ServerHost, + Session, + SessionOptions, + indent, + nowString, + nullTypingsInstaller, + protocol, } from "./_namespaces/ts.server"; import { - combinePaths, Debug, directorySeparator, ensureTrailingDirectorySeparator, getDirectoryPath, identity, memoize, - notImplemented, perfLogger, returnFalse, returnNoopFileWatcher, startsWith, + Debug, + combinePaths, + directorySeparator, + ensureTrailingDirectorySeparator, + getDirectoryPath, + identity, + memoize, + notImplemented, + perfLogger, + returnFalse, + returnNoopFileWatcher, + startsWith, } from "./_namespaces/ts"; /** @internal */