diff --git a/Jakefile.js b/Jakefile.js index d570a7cfc3d..bda270b0b4c 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -87,93 +87,10 @@ var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typing var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json")); var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json")); var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json")); +var harnessSources = filesFromConfig("./src/harness/tsconfig.json"); var typesMapOutputPath = path.join(builtLocalDirectory, 'typesMap.json'); -var harnessCoreSources = [ - "harness.ts", - "virtualFileSystem.ts", - "virtualFileSystemWithWatch.ts", - "sourceMapRecorder.ts", - "harnessLanguageService.ts", - "fourslash.ts", - "runnerbase.ts", - "compilerRunner.ts", - "typeWriter.ts", - "fourslashRunner.ts", - "projectsRunner.ts", - "loggedIO.ts", - "rwcRunner.ts", - "externalCompileRunner.ts", - "test262Runner.ts", - "./parallel/shared.ts", - "./parallel/host.ts", - "./parallel/worker.ts", - "runner.ts" -].map(function (f) { - return path.join(harnessDirectory, f); -}); - -var harnessSources = harnessCoreSources.concat([ - "base64.ts", - "incrementalParser.ts", - "jsDocParsing.ts", - "services/colorization.ts", - "services/documentRegistry.ts", - "services/preProcessFile.ts", - "services/patternMatcher.ts", - "session.ts", - "versionCache.ts", - "convertToBase64.ts", - "transpile.ts", - "reuseProgramStructure.ts", - "textStorage.ts", - "moduleResolution.ts", - "tsconfigParsing.ts", - "asserts.ts", - "builder.ts", - "commandLineParsing.ts", - "configurationExtension.ts", - "convertCompilerOptionsFromJson.ts", - "convertTypeAcquisitionFromJson.ts", - "tsserverProjectSystem.ts", - "tscWatchMode.ts", - "compileOnSave.ts", - "typingsInstaller.ts", - "projectErrors.ts", - "matchFiles.ts", - "organizeImports.ts", - "initializeTSConfig.ts", - "extractConstants.ts", - "extractFunctions.ts", - "extractRanges.ts", - "extractTestHelpers.ts", - "printer.ts", - "textChanges.ts", - "telemetry.ts", - "transform.ts", - "customTransforms.ts", - "programMissingFiles.ts", - "programNoParseFalsyFileNames.ts", - "symbolWalker.ts", - "languageService.ts", - "publicApi.ts", - "hostNewLineSupport.ts", -].map(function (f) { - return path.join(unittestsDirectory, f); -})).concat([ - "protocol.ts", - "utilities.ts", - "scriptVersionCache.ts", - "scriptInfo.ts", - "project.ts", - "typingsCache.ts", - "editorServices.ts", - "session.ts", -].map(function (f) { - return path.join(serverDirectory, f); -})); - var es2015LibrarySources = [ "es2015.core.d.ts", "es2015.collection.d.ts", @@ -451,6 +368,8 @@ task("lib", libraryTargets); // Generate diagnostics var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnosticMessages.js"); var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts"); +var processDiagnosticMessagesSources = filesFromConfig("./scripts/processDiagnosticMessages.tsconfig.json"); + var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json"); var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts"); var generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json"); @@ -460,8 +379,8 @@ file(processDiagnosticMessagesTs); // processDiagnosticMessages script compileFile(processDiagnosticMessagesJs, - [processDiagnosticMessagesTs], - [processDiagnosticMessagesTs], + processDiagnosticMessagesSources, + processDiagnosticMessagesSources, [], /*useBuiltCompiler*/ false); diff --git a/scripts/processDiagnosticMessages.ts b/scripts/processDiagnosticMessages.ts index 5b45fdeaae8..848a60cfb4f 100644 --- a/scripts/processDiagnosticMessages.ts +++ b/scripts/processDiagnosticMessages.ts @@ -1,6 +1,3 @@ -/// -/// - interface DiagnosticDetails { category: string; code: number; @@ -57,7 +54,6 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, inputFil let result = "// \r\n" + "// generated from '" + inputFilePathRel + "' by '" + thisFilePathRel + "'\r\n" + - "/// \r\n" + "/* @internal */\r\n" + "namespace ts {\r\n" + " function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}): DiagnosticMessage {\r\n" + diff --git a/scripts/processDiagnosticMessages.tsconfig.json b/scripts/processDiagnosticMessages.tsconfig.json new file mode 100644 index 00000000000..81599954625 --- /dev/null +++ b/scripts/processDiagnosticMessages.tsconfig.json @@ -0,0 +1,56 @@ +{ + "compilerOptions": { + "removeComments": false, + "outFile": "processDiagnosticMessages.js", + "target": "es5", + "declaration": false, + "lib": [ + "es6", + "scripthost" + ] + }, + "files": [ + "../src/compiler/types.ts", + "../src/compiler/performance.ts", + "../src/compiler/core.ts", + "../src/compiler/sys.ts", + "../src/compiler/diagnosticInformationMap.generated.ts", + "../src/compiler/scanner.ts", + "../src/compiler/utilities.ts", + "../src/compiler/parser.ts", + "../src/compiler/binder.ts", + "../src/compiler/symbolWalker.ts", + "../src/compiler/moduleNameResolver.ts", + "../src/compiler/checker.ts", + "../src/compiler/factory.ts", + "../src/compiler/visitor.ts", + "../src/compiler/transformers/utilities.ts", + "../src/compiler/transformers/destructuring.ts", + "../src/compiler/transformers/ts.ts", + "../src/compiler/transformers/es2017.ts", + "../src/compiler/transformers/esnext.ts", + "../src/compiler/transformers/jsx.ts", + "../src/compiler/transformers/es2016.ts", + "../src/compiler/transformers/es2015.ts", + "../src/compiler/transformers/es5.ts", + "../src/compiler/transformers/generators.ts", + "../src/compiler/transformers/module/module.ts", + "../src/compiler/transformers/module/system.ts", + "../src/compiler/transformers/module/es2015.ts", + "../src/compiler/transformers/declarations/diagnostics.ts", + "../src/compiler/transformers/declarations.ts", + "../src/compiler/transformer.ts", + "../src/compiler/sourcemap.ts", + "../src/compiler/comments.ts", + "../src/compiler/emitter.ts", + "../src/compiler/watchUtilities.ts", + "../src/compiler/program.ts", + "../src/compiler/builderState.ts", + "../src/compiler/builder.ts", + "../src/compiler/resolutionCache.ts", + "../src/compiler/watch.ts", + "../src/compiler/commandLineParser.ts", + + "processDiagnosticMessages.ts" + ] +} diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 9281719b860..e6e3364840d 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -1,6 +1,3 @@ -/// -/// - /* @internal */ namespace ts { export const enum ModuleInstanceState { diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index cc506852252..92e651061ed 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -1,5 +1,3 @@ -/// - /*@internal*/ namespace ts { /** diff --git a/src/compiler/builderState.ts b/src/compiler/builderState.ts index 581aa05f12c..ac9f36b1258 100644 --- a/src/compiler/builderState.ts +++ b/src/compiler/builderState.ts @@ -1,4 +1,3 @@ -/// namespace ts { export interface EmitOutput { outputFiles: OutputFile[]; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cc51e1b7265..d009a956c43 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /* @internal */ namespace ts { const ambientModuleSymbolRegex = /^".+"$/; diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index f386c701dd7..470bd111492 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1,9 +1,3 @@ -/// -/// -/// -/// -/// - namespace ts { /* @internal */ export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" }; diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index f26a66701e4..de629cccfe1 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { export interface CommentWriter { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index a14e92c3e5b..cdf68cb2dfa 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4bd055b1618..289f332cd33 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - namespace ts { const brackets = createBracketsMap(); diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 82e4782f848..765c3c9cb4a 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { function createSynthesizedNode(kind: SyntaxKind): Node { const node = createNode(kind, -1, -1); diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index d66ab5eb524..0027687c643 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { /* @internal */ export function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void; diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ef15c57f1d8..74d54ed28fb 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { const enum SignatureFlags { None = 0, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6467dd2afc8..514397debc1 100755 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1,7 +1,3 @@ -/// -/// -/// - namespace ts { const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 0946948f43d..c2b96649cf2 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { /** This is the cache of module/typedirectives resolution that can be retained across program */ diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 43320b453c4..f2a01d22c24 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts { export type ErrorCallback = (message: DiagnosticMessage, length: number) => void; diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index 2e81da35cfd..6251f1963fa 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { export interface SourceMapWriter { diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 8c2612155e4..c37315a2e56 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,5 +1,3 @@ -/// - declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any; declare function clearTimeout(handle: any): void; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index c187176d069..8cadba453d8 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -1,18 +1,3 @@ -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - /* @internal */ namespace ts { function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory { diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 7b6b5847753..67e4fa31cb2 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, file: SourceFile | undefined): Diagnostic[] { diff --git a/src/compiler/transformers/destructuring.ts b/src/compiler/transformers/destructuring.ts index bafe43b0b15..35101d3be7f 100644 --- a/src/compiler/transformers/destructuring.ts +++ b/src/compiler/transformers/destructuring.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { interface FlattenContext { diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 72068688f9d..0a607494bb5 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { const enum ES2015SubstitutionFlags { diff --git a/src/compiler/transformers/es2016.ts b/src/compiler/transformers/es2016.ts index a9468991776..22b2f11b612 100644 --- a/src/compiler/transformers/es2016.ts +++ b/src/compiler/transformers/es2016.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { export function transformES2016(context: TransformationContext) { diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index f2a5aeb35d2..6689f83ed5b 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration; diff --git a/src/compiler/transformers/es5.ts b/src/compiler/transformers/es5.ts index bc6ee13520f..92ecce6a15c 100644 --- a/src/compiler/transformers/es5.ts +++ b/src/compiler/transformers/es5.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { /** diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index 97fe93e508b..68861a5bb43 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { const enum ESNextSubstitutionFlags { diff --git a/src/compiler/transformers/generators.ts b/src/compiler/transformers/generators.ts index 82d8bc513f0..15f0d2d0f81 100644 --- a/src/compiler/transformers/generators.ts +++ b/src/compiler/transformers/generators.ts @@ -1,6 +1,3 @@ -/// -/// - // Transforms generator functions into a compatible ES5 representation with similar runtime // semantics. This is accomplished by first transforming the body of each generator // function into an intermediate representation that is the compiled into a JavaScript diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 07dc8f74db4..4acdf63b275 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function transformJsx(context: TransformationContext) { diff --git a/src/compiler/transformers/module/es2015.ts b/src/compiler/transformers/module/es2015.ts index 4f218e4fdcf..a3315852632 100644 --- a/src/compiler/transformers/module/es2015.ts +++ b/src/compiler/transformers/module/es2015.ts @@ -1,6 +1,3 @@ -/// -/// - /*@internal*/ namespace ts { export function transformES2015Module(context: TransformationContext) { diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 45d13357123..f9fb47f6a27 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function transformModule(context: TransformationContext) { diff --git a/src/compiler/transformers/module/system.ts b/src/compiler/transformers/module/system.ts index ca55cb3a9d1..5cde69e2ef6 100644 --- a/src/compiler/transformers/module/system.ts +++ b/src/compiler/transformers/module/system.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { export function transformSystemModule(context: TransformationContext) { diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index f22d8f02870..6cb4be16c74 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { /** diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 77f4d7c6e1f..f16ca98c93d 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -1,7 +1,3 @@ -/// -/// -/// - namespace ts { interface Statistic { name: string; diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 58626f2cdc1..46e5384434a 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -6,36 +6,38 @@ "declaration": true }, "files": [ - "core.ts", - "performance.ts", - "sys.ts", "types.ts", + "performance.ts", + "core.ts", + "sys.ts", + "diagnosticInformationMap.generated.ts", "scanner.ts", - "parser.ts", "utilities.ts", + "parser.ts", "binder.ts", "symbolWalker.ts", + "moduleNameResolver.ts", "checker.ts", "factory.ts", "visitor.ts", "transformers/utilities.ts", + "transformers/destructuring.ts", "transformers/ts.ts", - "transformers/jsx.ts", - "transformers/esnext.ts", "transformers/es2017.ts", + "transformers/esnext.ts", + "transformers/jsx.ts", "transformers/es2016.ts", "transformers/es2015.ts", "transformers/es5.ts", "transformers/generators.ts", - "transformers/destructuring.ts", "transformers/module/module.ts", "transformers/module/system.ts", "transformers/module/es2015.ts", "transformers/declarations/diagnostics.ts", "transformers/declarations.ts", "transformer.ts", - "comments.ts", "sourcemap.ts", + "comments.ts", "emitter.ts", "watchUtilities.ts", "program.ts", @@ -44,7 +46,6 @@ "resolutionCache.ts", "watch.ts", "commandLineParser.ts", - "tsc.ts", - "diagnosticInformationMap.generated.ts" + "tsc.ts" ] } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 850d26f8473..61c24ee12ec 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { export const resolvingEmptyArray: never[] = [] as never[]; diff --git a/src/compiler/visitor.ts b/src/compiler/visitor.ts index 8d8e47a8f4c..7a70eb02e8e 100644 --- a/src/compiler/visitor.ts +++ b/src/compiler/visitor.ts @@ -1,7 +1,3 @@ -/// -/// -/// - namespace ts { const isTypeNodeOrTypeParameterDeclaration = or(isTypeNode, isTypeParameterDeclaration); diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index f53f01e3eb2..7f3d078b790 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts { const sysFormatDiagnosticsHost: FormatDiagnosticsHost = sys ? { diff --git a/src/compiler/watchUtilities.ts b/src/compiler/watchUtilities.ts index 12ed9f855df..4fa9b28e162 100644 --- a/src/compiler/watchUtilities.ts +++ b/src/compiler/watchUtilities.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts { /** diff --git a/src/harness/tsconfig.json b/src/harness/tsconfig.json index fe4b066c5e7..e3d09c50b6c 100644 --- a/src/harness/tsconfig.json +++ b/src/harness/tsconfig.json @@ -13,132 +13,147 @@ ] }, "files": [ - "../compiler/core.ts", - "../compiler/performance.ts", - "../compiler/sys.ts", "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", "../compiler/scanner.ts", - "../compiler/parser.ts", "../compiler/utilities.ts", + "../compiler/parser.ts", "../compiler/binder.ts", "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", "../compiler/checker.ts", "../compiler/factory.ts", "../compiler/visitor.ts", "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", "../compiler/transformers/ts.ts", - "../compiler/transformers/jsx.ts", - "../compiler/transformers/esnext.ts", "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", "../compiler/transformers/es2016.ts", "../compiler/transformers/es2015.ts", "../compiler/transformers/es5.ts", "../compiler/transformers/generators.ts", - "../compiler/transformers/es5.ts", - "../compiler/transformers/destructuring.ts", "../compiler/transformers/module/module.ts", "../compiler/transformers/module/system.ts", "../compiler/transformers/module/es2015.ts", "../compiler/transformers/declarations/diagnostics.ts", "../compiler/transformers/declarations.ts", "../compiler/transformer.ts", - "../compiler/comments.ts", "../compiler/sourcemap.ts", + "../compiler/comments.ts", "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", "../compiler/program.ts", + "../compiler/builderState.ts", "../compiler/builder.ts", + "../compiler/resolutionCache.ts", + "../compiler/watch.ts", "../compiler/commandLineParser.ts", - "../compiler/diagnosticInformationMap.generated.ts", - "../services/breakpoints.ts", - "../services/navigateTo.ts", - "../services/navigationBar.ts", - "../services/outliningElementsCollector.ts", - "../services/patternMatcher.ts", + + "../services/types.ts", + "../services/utilities.ts", + "../services/classifier.ts", "../services/pathCompletions.ts", "../services/completions.ts", - "../services/services.ts", - "../services/shims.ts", - "../services/signatureHelp.ts", - "../services/utilities.ts", + "../services/documentHighlights.ts", + "../services/documentRegistry.ts", + "../services/importTracker.ts", + "../services/findAllReferences.ts", + "../services/goToDefinition.ts", + "../services/jsDoc.ts", + "../services/semver.ts", "../services/jsTyping.ts", - "../services/formatting/formatting.ts", + "../services/navigateTo.ts", + "../services/navigationBar.ts", + "../services/organizeImports.ts", + "../services/outliningElementsCollector.ts", + "../services/patternMatcher.ts", + "../services/preProcess.ts", + "../services/rename.ts", + "../services/signatureHelp.ts", + "../services/suggestionDiagnostics.ts", + "../services/symbolDisplay.ts", + "../services/transpile.ts", "../services/formatting/formattingContext.ts", "../services/formatting/formattingScanner.ts", "../services/formatting/rule.ts", "../services/formatting/rules.ts", "../services/formatting/rulesMap.ts", + "../services/formatting/formatting.ts", "../services/formatting/smartIndenter.ts", + "../services/textChanges.ts", "../services/codeFixProvider.ts", - "../services/codefixes/fixes.ts", - "../services/codefixes/helpers.ts", + "../services/refactorProvider.ts", + "../services/codefixes/addMissingInvocationForDecorator.ts", + "../services/codefixes/annotateWithTypeFromJSDoc.ts", + "../services/codefixes/convertFunctionToEs6Class.ts", + "../services/codefixes/convertToEs6Module.ts", + "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", "../services/codefixes/importFixes.ts", + "../services/codefixes/fixSpelling.ts", + "../services/codefixes/fixAddMissingMember.ts", + "../services/codefixes/fixCannotFindModule.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixForgottenThisPropertyAccess.ts", "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixJSDocTypes.ts", + "../services/codefixes/fixAwaitInSyncFunction.ts", "../services/codefixes/disableJsDiagnostics.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/inferFromUsage.ts", + "../services/codefixes/fixInvalidImportSyntax.ts", + "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/useDefaultImport.ts", + "../services/codefixes/fixes.ts", + "../services/refactors/extractSymbol.ts", + "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/refactors/refactors.ts", + "../services/sourcemaps.ts", + "../services/services.ts", + "../services/breakpoints.ts", + "../services/transform.ts", + "../services/shims.ts", + + "../server/typingsinstaller/typingsinstaller.ts", + + "../server/types.ts", + "../server/shared.ts", + "../server/utilities.ts", + "../server/protocol.ts", + "../server/scriptInfo.ts", + "../server/typingsCache.ts", + "../server/project.ts", + "../server/editorServices.ts", + "../server/session.ts", + "../server/scriptVersionCache.ts", - "harness.ts", "sourceMapRecorder.ts", - "harnessLanguageService.ts", - "fourslash.ts", "runnerbase.ts", - "compilerRunner.ts", - "typeWriter.ts", + "virtualFileSystem.ts", + "harness.ts", + "virtualFileSystemWithWatch.ts", + "harnessLanguageService.ts", "fourslashRunner.ts", + "fourslash.ts", + "typeWriter.ts", + "compilerRunner.ts", "projectsRunner.ts", "loggedIO.ts", "rwcRunner.ts", "externalCompileRunner.ts", "test262Runner.ts", - "./parallel/shared.ts", - "./parallel/host.ts", - "./parallel/worker.ts", - "runner.ts", - "virtualFileSystemWithWatch.ts", - "../server/protocol.ts", - "../server/session.ts", - "../server/client.ts", - "../server/editorServices.ts", - "./unittests/base64.ts", - "./unittests/incrementalParser.ts", - "./unittests/jsDocParsing.ts", - "./unittests/services/colorization.ts", - "./unittests/services/documentRegistry.ts", - "./unittests/services/preProcessFile.ts", - "./unittests/services/patternMatcher.ts", - "./unittests/session.ts", - "./unittests/symbolWalker.ts", - "./unittests/versionCache.ts", - "./unittests/convertToBase64.ts", - "./unittests/transpile.ts", - "./unittests/reuseProgramStructure.ts", - "./unittests/moduleResolution.ts", - "./unittests/tsconfigParsing.ts", - "./unittests/asserts.ts", - "./unittests/builder.ts", - "./unittests/commandLineParsing.ts", - "./unittests/configurationExtension.ts", - "./unittests/convertCompilerOptionsFromJson.ts", - "./unittests/convertTypeAcquisitionFromJson.ts", - "./unittests/tsserverProjectSystem.ts", - "./unittests/tscWatchMode.ts", - "./unittests/matchFiles.ts", - "./unittests/organizeImports.ts", - "./unittests/initializeTSConfig.ts", - "./unittests/compileOnSave.ts", - "./unittests/typingsInstaller.ts", - "./unittests/projectErrors.ts", - "./unittests/printer.ts", - "./unittests/transform.ts", - "./unittests/customTransforms.ts", - "./unittests/extractConstants.ts", - "./unittests/extractFunctions.ts", - "./unittests/extractRanges.ts", - "./unittests/extractTestHelpers.ts", - "./unittests/textChanges.ts", - "./unittests/telemetry.ts", - "./unittests/languageService.ts", - "./unittests/programMissingFiles.ts", - "./unittests/programNoParseFalsyFileNames.ts", - "./unittests/publicApi.ts", - "./unittests/hostNewLineSupport.ts" - ] + "parallel/host.ts", + "parallel/worker.ts", + "parallel/shared.ts", + "runner.ts" + ], + "include": ["unittests/**.ts"] } diff --git a/src/server/client.ts b/src/server/client.ts index 095d58d825d..2238734e90c 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { export interface SessionClientHost extends LanguageServiceHost { writeMessage(message: string): void; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 987621a2865..1f8f9d3b21b 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1,11 +1,3 @@ -/// -/// -/// -/// -/// -/// -/// - namespace ts.server { export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024; diff --git a/src/server/project.ts b/src/server/project.ts index 442c7e3f5ad..1502d107dee 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1,10 +1,3 @@ -/// -/// -/// -/// -/// -/// - namespace ts.server { export enum ProjectKind { diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index 11c721344f6..db56973d796 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { /* @internal */ diff --git a/src/server/scriptVersionCache.ts b/src/server/scriptVersionCache.ts index 8a3f43a5434..d57f296e7a7 100644 --- a/src/server/scriptVersionCache.ts +++ b/src/server/scriptVersionCache.ts @@ -1,7 +1,3 @@ -/// -/// -/// - /*@internal*/ namespace ts.server { const lineCollectionCapacity = 4; diff --git a/src/server/server.ts b/src/server/server.ts index 44cb3b7aa1e..6eff3256349 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts.server { const childProcess: { fork(modulePath: string, args: string[], options?: { execArgv: string[], env?: MapLike }): NodeChildProcess; diff --git a/src/server/session.ts b/src/server/session.ts index c838d20e15a..1076d17e11f 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - namespace ts.server { interface StackTraceError extends Error { stack?: string; diff --git a/src/server/shared.ts b/src/server/shared.ts index b46a385106e..a5528b7ba63 100644 --- a/src/server/shared.ts +++ b/src/server/shared.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { // tslint:disable variable-name export const ActionSet: ActionSet = "action::set"; diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index c838a7209d9..fe19cd418bd 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -9,17 +9,125 @@ ] }, "files": [ - "../services/shims.ts", + "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", + "../compiler/scanner.ts", + "../compiler/utilities.ts", + "../compiler/parser.ts", + "../compiler/binder.ts", + "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", + "../compiler/checker.ts", + "../compiler/factory.ts", + "../compiler/visitor.ts", + "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", + "../compiler/transformers/ts.ts", + "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", + "../compiler/transformers/es2016.ts", + "../compiler/transformers/es2015.ts", + "../compiler/transformers/es5.ts", + "../compiler/transformers/generators.ts", + "../compiler/transformers/module/module.ts", + "../compiler/transformers/module/system.ts", + "../compiler/transformers/module/es2015.ts", + "../compiler/transformers/declarations/diagnostics.ts", + "../compiler/transformers/declarations.ts", + "../compiler/transformer.ts", + "../compiler/sourcemap.ts", + "../compiler/comments.ts", + "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", + "../compiler/program.ts", + "../compiler/builderState.ts", + "../compiler/builder.ts", + "../compiler/resolutionCache.ts", + "../compiler/watch.ts", + "../compiler/commandLineParser.ts", + + "../services/types.ts", "../services/utilities.ts", + "../services/classifier.ts", + "../services/pathCompletions.ts", + "../services/completions.ts", + "../services/documentHighlights.ts", + "../services/documentRegistry.ts", + "../services/importTracker.ts", + "../services/findAllReferences.ts", + "../services/goToDefinition.ts", + "../services/jsDoc.ts", + "../services/semver.ts", + "../services/jsTyping.ts", + "../services/navigateTo.ts", + "../services/navigationBar.ts", + "../services/organizeImports.ts", + "../services/outliningElementsCollector.ts", + "../services/patternMatcher.ts", + "../services/preProcess.ts", + "../services/rename.ts", + "../services/signatureHelp.ts", + "../services/suggestionDiagnostics.ts", + "../services/symbolDisplay.ts", + "../services/transpile.ts", + "../services/formatting/formattingContext.ts", + "../services/formatting/formattingScanner.ts", + "../services/formatting/rule.ts", + "../services/formatting/rules.ts", + "../services/formatting/rulesMap.ts", + "../services/formatting/formatting.ts", + "../services/formatting/smartIndenter.ts", + "../services/textChanges.ts", + "../services/codeFixProvider.ts", + "../services/refactorProvider.ts", + "../services/codefixes/addMissingInvocationForDecorator.ts", + "../services/codefixes/annotateWithTypeFromJSDoc.ts", + "../services/codefixes/convertFunctionToEs6Class.ts", + "../services/codefixes/convertToEs6Module.ts", + "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", + "../services/codefixes/importFixes.ts", + "../services/codefixes/fixSpelling.ts", + "../services/codefixes/fixAddMissingMember.ts", + "../services/codefixes/fixCannotFindModule.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixForgottenThisPropertyAccess.ts", + "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixJSDocTypes.ts", + "../services/codefixes/fixAwaitInSyncFunction.ts", + "../services/codefixes/disableJsDiagnostics.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/inferFromUsage.ts", + "../services/codefixes/fixInvalidImportSyntax.ts", + "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/useDefaultImport.ts", + "../services/codefixes/fixes.ts", + "../services/refactors/extractSymbol.ts", + "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/refactors/refactors.ts", + "../services/sourcemaps.ts", + "../services/services.ts", + "../services/breakpoints.ts", + "../services/transform.ts", + "../services/shims.ts", + + "types.ts", "shared.ts", "utilities.ts", - "scriptVersionCache.ts", + "protocol.ts", "scriptInfo.ts", "typingsCache.ts", "project.ts", "editorServices.ts", - "protocol.ts", "session.ts", + "scriptVersionCache.ts", "server.ts" ] } diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index aa3148d58a1..54353daf5c6 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -15,17 +15,124 @@ "types": [] }, "files": [ - "editorServices.ts", - "project.ts", + "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", + "../compiler/scanner.ts", + "../compiler/utilities.ts", + "../compiler/parser.ts", + "../compiler/binder.ts", + "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", + "../compiler/checker.ts", + "../compiler/factory.ts", + "../compiler/visitor.ts", + "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", + "../compiler/transformers/ts.ts", + "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", + "../compiler/transformers/es2016.ts", + "../compiler/transformers/es2015.ts", + "../compiler/transformers/es5.ts", + "../compiler/transformers/generators.ts", + "../compiler/transformers/module/module.ts", + "../compiler/transformers/module/system.ts", + "../compiler/transformers/module/es2015.ts", + "../compiler/transformers/declarations/diagnostics.ts", + "../compiler/transformers/declarations.ts", + "../compiler/transformer.ts", + "../compiler/sourcemap.ts", + "../compiler/comments.ts", + "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", + "../compiler/program.ts", + "../compiler/builderState.ts", + "../compiler/builder.ts", + "../compiler/resolutionCache.ts", + "../compiler/watch.ts", + "../compiler/commandLineParser.ts", + + "../services/types.ts", + "../services/utilities.ts", + "../services/classifier.ts", + "../services/pathCompletions.ts", + "../services/completions.ts", + "../services/documentHighlights.ts", + "../services/documentRegistry.ts", + "../services/importTracker.ts", + "../services/findAllReferences.ts", + "../services/goToDefinition.ts", + "../services/jsDoc.ts", + "../services/semver.ts", + "../services/jsTyping.ts", + "../services/navigateTo.ts", + "../services/navigationBar.ts", + "../services/organizeImports.ts", + "../services/outliningElementsCollector.ts", + "../services/patternMatcher.ts", + "../services/preProcess.ts", + "../services/rename.ts", + "../services/signatureHelp.ts", + "../services/suggestionDiagnostics.ts", + "../services/symbolDisplay.ts", + "../services/transpile.ts", + "../services/formatting/formattingContext.ts", + "../services/formatting/formattingScanner.ts", + "../services/formatting/rule.ts", + "../services/formatting/rules.ts", + "../services/formatting/rulesMap.ts", + "../services/formatting/formatting.ts", + "../services/formatting/smartIndenter.ts", + "../services/textChanges.ts", + "../services/codeFixProvider.ts", + "../services/refactorProvider.ts", + "../services/codefixes/addMissingInvocationForDecorator.ts", + "../services/codefixes/annotateWithTypeFromJSDoc.ts", + "../services/codefixes/convertFunctionToEs6Class.ts", + "../services/codefixes/convertToEs6Module.ts", + "../services/codefixes/correctQualifiedNameToIndexedAccessType.ts", + "../services/codefixes/fixClassIncorrectlyImplementsInterface.ts", + "../services/codefixes/importFixes.ts", + "../services/codefixes/fixSpelling.ts", + "../services/codefixes/fixAddMissingMember.ts", + "../services/codefixes/fixCannotFindModule.ts", + "../services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "../services/codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "../services/codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "../services/codefixes/fixExtendsInterfaceBecomesImplements.ts", + "../services/codefixes/fixForgottenThisPropertyAccess.ts", + "../services/codefixes/fixUnusedIdentifier.ts", + "../services/codefixes/fixJSDocTypes.ts", + "../services/codefixes/fixAwaitInSyncFunction.ts", + "../services/codefixes/disableJsDiagnostics.ts", + "../services/codefixes/helpers.ts", + "../services/codefixes/inferFromUsage.ts", + "../services/codefixes/fixInvalidImportSyntax.ts", + "../services/codefixes/fixStrictClassInitialization.ts", + "../services/codefixes/useDefaultImport.ts", + "../services/codefixes/fixes.ts", + "../services/refactors/extractSymbol.ts", + "../services/refactors/generateGetAccessorAndSetAccessor.ts", + "../services/refactors/refactors.ts", + "../services/sourcemaps.ts", + "../services/services.ts", + "../services/breakpoints.ts", + "../services/transform.ts", + "../services/shims.ts", + + "types.ts", + "shared.ts", + "utilities.ts", "protocol.ts", "scriptInfo.ts", - "scriptVersionCache.ts", - "session.ts", - "shared.ts", - "types.ts", "typingsCache.ts", - "utilities.ts", - "../services/shims.ts", - "../services/utilities.ts" + "project.ts", + "editorServices.ts", + "session.ts", + "scriptVersionCache.ts" ] } diff --git a/src/server/types.ts b/src/server/types.ts index 617a3be419a..d4ddd81c53e 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -1,7 +1,3 @@ -/// -/// -/// - declare namespace ts.server { export interface CompressedData { length: number; diff --git a/src/server/typingsCache.ts b/src/server/typingsCache.ts index a1d8f65f6e0..f2642230f2d 100644 --- a/src/server/typingsCache.ts +++ b/src/server/typingsCache.ts @@ -1,5 +1,3 @@ -/// - namespace ts.server { export interface InstallPackageOptionsWithProject extends InstallPackageOptions { projectName: string; diff --git a/src/server/utilities.ts b/src/server/utilities.ts index 3a0b1935ede..363393d401e 100644 --- a/src/server/utilities.ts +++ b/src/server/utilities.ts @@ -1,6 +1,3 @@ -/// -/// - namespace ts.server { export enum LogLevel { terse, diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index c608028b55f..faab2b08db6 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -1,8 +1,3 @@ -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. - -/// - /* @internal */ namespace ts.BreakpointResolver { /** diff --git a/src/services/codefixes/fixes.ts b/src/services/codefixes/fixes.ts index e16a7d2d8bf..bc845bd8dc0 100644 --- a/src/services/codefixes/fixes.ts +++ b/src/services/codefixes/fixes.ts @@ -1,26 +1 @@ -// Fixes higher in this list will be first in the array returned by `getCodeFixesAtPosition`. - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// +// Please delete me later. diff --git a/src/services/completions.ts b/src/services/completions.ts index bfae5ada0db..3100e4a13a9 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.Completions { export type Log = (message: string) => void; diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 7d6d78af163..5b4689cc476 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.FindAllReferences { export interface SymbolAndEntries { diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index debec04536a..494a811c238 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -1,8 +1,3 @@ -/// -/// -/// -/// - /* @internal */ namespace ts.formatting { export interface FormatContext { diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 9b9c956f670..a53a1e5ce26 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -1,6 +1,3 @@ -/// -/// - /* @internal */ namespace ts.formatting { const standardScanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false, LanguageVariant.Standard); diff --git a/src/services/formatting/rulesMap.ts b/src/services/formatting/rulesMap.ts index 75cc68cb268..b10d163343e 100644 --- a/src/services/formatting/rulesMap.ts +++ b/src/services/formatting/rulesMap.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.formatting { export function getFormatContext(options: FormatCodeSettings): FormatContext { diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts index 393b8ca34e0..6b4f7f2e1d4 100644 --- a/src/services/jsTyping.ts +++ b/src/services/jsTyping.ts @@ -1,11 +1,3 @@ -// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. -// See LICENSE.txt in the project root for complete license information. - -/// -/// -/// -/// - /* @internal */ namespace ts.JsTyping { diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index e2176d2c1c9..b029796e718 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -1,5 +1,3 @@ -/// - /* @internal */ namespace ts.NavigationBar { /** diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index fb5177f1c6a..5805a986180 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1,6 +1,3 @@ -/// -/// - /* @internal */ namespace ts.refactor.extractSymbol { const refactorName = "Extract Symbol"; diff --git a/src/services/refactors/refactors.ts b/src/services/refactors/refactors.ts index f5ef4da86a4..bc845bd8dc0 100644 --- a/src/services/refactors/refactors.ts +++ b/src/services/refactors/refactors.ts @@ -1,2 +1 @@ -/// -/// +// Please delete me later. diff --git a/src/services/services.ts b/src/services/services.ts index 1de0f65ef6b..bed301e452f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1,37 +1,3 @@ -/// -/// - -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - namespace ts { /** The version of the language service API */ export const servicesVersion = "0.8"; diff --git a/src/services/shims.ts b/src/services/shims.ts index 4ed1afb8813..b8beccab20b 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -13,8 +13,6 @@ // limitations under the License. // -/// - /* @internal */ let debugObjectHost: { CollectGarbage(): void } = (function (this: any) { return this; })(); diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 250127ecfc6..156539557a3 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -1,4 +1,3 @@ -/// /* @internal */ namespace ts.SignatureHelp { export const enum ArgumentListKind { diff --git a/src/services/transform.ts b/src/services/transform.ts index 07fc3c759e2..200fb9aacb2 100644 --- a/src/services/transform.ts +++ b/src/services/transform.ts @@ -1,5 +1,3 @@ -/// -/// namespace ts { /** * Transform one or more nodes using the supplied transformers. diff --git a/src/services/tsconfig.json b/src/services/tsconfig.json index 4f838df6341..a54790df3be 100644 --- a/src/services/tsconfig.json +++ b/src/services/tsconfig.json @@ -6,81 +6,113 @@ "declaration": true }, "files": [ - "../compiler/core.ts", - "../compiler/performance.ts", - "../compiler/sys.ts", "../compiler/types.ts", + "../compiler/performance.ts", + "../compiler/core.ts", + "../compiler/sys.ts", + "../compiler/diagnosticInformationMap.generated.ts", "../compiler/scanner.ts", - "../compiler/parser.ts", "../compiler/utilities.ts", + "../compiler/parser.ts", "../compiler/binder.ts", "../compiler/symbolWalker.ts", + "../compiler/moduleNameResolver.ts", "../compiler/checker.ts", "../compiler/factory.ts", "../compiler/visitor.ts", "../compiler/transformers/utilities.ts", + "../compiler/transformers/destructuring.ts", "../compiler/transformers/ts.ts", - "../compiler/transformers/jsx.ts", - "../compiler/transformers/esnext.ts", "../compiler/transformers/es2017.ts", + "../compiler/transformers/esnext.ts", + "../compiler/transformers/jsx.ts", "../compiler/transformers/es2016.ts", "../compiler/transformers/es2015.ts", "../compiler/transformers/es5.ts", "../compiler/transformers/generators.ts", - "../compiler/transformers/destructuring.ts", "../compiler/transformers/module/module.ts", "../compiler/transformers/module/system.ts", "../compiler/transformers/module/es2015.ts", "../compiler/transformers/declarations/diagnostics.ts", "../compiler/transformers/declarations.ts", "../compiler/transformer.ts", - "../compiler/comments.ts", "../compiler/sourcemap.ts", + "../compiler/comments.ts", "../compiler/emitter.ts", + "../compiler/watchUtilities.ts", "../compiler/program.ts", "../compiler/builderState.ts", "../compiler/builder.ts", "../compiler/resolutionCache.ts", "../compiler/watch.ts", - "../compiler/watchUtilities.ts", "../compiler/commandLineParser.ts", - "../compiler/diagnosticInformationMap.generated.ts", + "types.ts", "utilities.ts", - "breakpoints.ts", "classifier.ts", + "pathCompletions.ts", "completions.ts", "documentHighlights.ts", "documentRegistry.ts", - "findAllReferences.ts", "importTracker.ts", + "findAllReferences.ts", "goToDefinition.ts", "jsDoc.ts", + "semver.ts", "jsTyping.ts", "navigateTo.ts", "navigationBar.ts", "organizeImports.ts", "outliningElementsCollector.ts", - "pathCompletions.ts", "patternMatcher.ts", "preProcess.ts", "rename.ts", - "services.ts", - "transform.ts", - "transpile.ts", - "semver.ts", - "shims.ts", "signatureHelp.ts", "suggestionDiagnostics.ts", - "sourcemaps.ts", "symbolDisplay.ts", + "transpile.ts", + "formatting/formattingContext.ts", + "formatting/formattingScanner.ts", + "formatting/rule.ts", + "formatting/rules.ts", + "formatting/rulesMap.ts", + "formatting/formatting.ts", + "formatting/smartIndenter.ts", "textChanges.ts", + "codeFixProvider.ts", "refactorProvider.ts", - "codeFixProvider.ts" - ], - "include": [ - "formatting/*", - "codefixes/*", - "refactors/*" + "codefixes/addMissingInvocationForDecorator.ts", + "codefixes/annotateWithTypeFromJSDoc.ts", + "codefixes/convertFunctionToEs6Class.ts", + "codefixes/convertToEs6Module.ts", + "codefixes/correctQualifiedNameToIndexedAccessType.ts", + "codefixes/fixClassIncorrectlyImplementsInterface.ts", + "codefixes/importFixes.ts", + "codefixes/fixSpelling.ts", + "codefixes/fixAddMissingMember.ts", + "codefixes/fixCannotFindModule.ts", + "codefixes/fixClassDoesntImplementInheritedAbstractMember.ts", + "codefixes/fixClassSuperMustPrecedeThisAccess.ts", + "codefixes/fixConstructorForDerivedNeedSuperCall.ts", + "codefixes/fixExtendsInterfaceBecomesImplements.ts", + "codefixes/fixForgottenThisPropertyAccess.ts", + "codefixes/fixUnusedIdentifier.ts", + "codefixes/fixJSDocTypes.ts", + "codefixes/fixAwaitInSyncFunction.ts", + "codefixes/disableJsDiagnostics.ts", + "codefixes/helpers.ts", + "codefixes/inferFromUsage.ts", + "codefixes/fixInvalidImportSyntax.ts", + "codefixes/fixStrictClassInitialization.ts", + "codefixes/useDefaultImport.ts", + "codefixes/fixes.ts", + "refactors/extractSymbol.ts", + "refactors/generateGetAccessorAndSetAccessor.ts", + "refactors/refactors.ts", + "sourcemaps.ts", + "services.ts", + "breakpoints.ts", + "transform.ts", + "shims.ts" ] } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2343e68de9c..bda4d911c0c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2926,6 +2926,61 @@ declare namespace ts { function getNodeMajorVersion(): number; let sys: System; } +declare namespace ts { + type ErrorCallback = (message: DiagnosticMessage, length: number) => void; + interface Scanner { + getStartPos(): number; + getToken(): SyntaxKind; + getTextPos(): number; + getTokenPos(): number; + getTokenText(): string; + getTokenValue(): string; + hasExtendedUnicodeEscape(): boolean; + hasPrecedingLineBreak(): boolean; + isIdentifier(): boolean; + isReservedWord(): boolean; + isUnterminated(): boolean; + reScanGreaterToken(): SyntaxKind; + reScanSlashToken(): SyntaxKind; + reScanTemplateToken(): SyntaxKind; + scanJsxIdentifier(): SyntaxKind; + scanJsxAttributeValue(): SyntaxKind; + reScanJsxToken(): JsxTokenSyntaxKind; + scanJsxToken(): JsxTokenSyntaxKind; + scanJSDocToken(): JsDocSyntaxKind; + scan(): SyntaxKind; + getText(): string; + setText(text: string, start?: number, length?: number): void; + setOnError(onError: ErrorCallback): void; + setScriptTarget(scriptTarget: ScriptTarget): void; + setLanguageVariant(variant: LanguageVariant): void; + setTextPos(textPos: number): void; + lookAhead(callback: () => T): T; + scanRange(start: number, length: number, callback: () => T): T; + tryScan(callback: () => T): T; + } + function tokenToString(t: SyntaxKind): string | undefined; + function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number; + function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter; + function isWhiteSpaceLike(ch: number): boolean; + /** Does not include line breaks. For that, see isWhiteSpaceLike. */ + function isWhiteSpaceSingleLine(ch: number): boolean; + function isLineBreak(ch: number): boolean; + function couldStartTrivia(text: string, pos: number): boolean; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; + function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; + function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; + function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; + function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; + /** Optionally, get the shebang */ + function getShebang(text: string): string | undefined; + function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; + function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; +} declare namespace ts { function getDefaultLibFileName(options: CompilerOptions): string; function textSpanEnd(span: TextSpan): number; @@ -3272,61 +3327,6 @@ declare namespace ts { function isObjectLiteralElement(node: Node): node is ObjectLiteralElement; function isStringLiteralLike(node: Node): node is StringLiteralLike; } -declare namespace ts { - type ErrorCallback = (message: DiagnosticMessage, length: number) => void; - interface Scanner { - getStartPos(): number; - getToken(): SyntaxKind; - getTextPos(): number; - getTokenPos(): number; - getTokenText(): string; - getTokenValue(): string; - hasExtendedUnicodeEscape(): boolean; - hasPrecedingLineBreak(): boolean; - isIdentifier(): boolean; - isReservedWord(): boolean; - isUnterminated(): boolean; - reScanGreaterToken(): SyntaxKind; - reScanSlashToken(): SyntaxKind; - reScanTemplateToken(): SyntaxKind; - scanJsxIdentifier(): SyntaxKind; - scanJsxAttributeValue(): SyntaxKind; - reScanJsxToken(): JsxTokenSyntaxKind; - scanJsxToken(): JsxTokenSyntaxKind; - scanJSDocToken(): JsDocSyntaxKind; - scan(): SyntaxKind; - getText(): string; - setText(text: string, start?: number, length?: number): void; - setOnError(onError: ErrorCallback): void; - setScriptTarget(scriptTarget: ScriptTarget): void; - setLanguageVariant(variant: LanguageVariant): void; - setTextPos(textPos: number): void; - lookAhead(callback: () => T): T; - scanRange(start: number, length: number, callback: () => T): T; - tryScan(callback: () => T): T; - } - function tokenToString(t: SyntaxKind): string | undefined; - function getPositionOfLineAndCharacter(sourceFile: SourceFileLike, line: number, character: number): number; - function getLineAndCharacterOfPosition(sourceFile: SourceFileLike, position: number): LineAndCharacter; - function isWhiteSpaceLike(ch: number): boolean; - /** Does not include line breaks. For that, see isWhiteSpaceLike. */ - function isWhiteSpaceSingleLine(ch: number): boolean; - function isLineBreak(ch: number): boolean; - function couldStartTrivia(text: string, pos: number): boolean; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; - function forEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined; - function forEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined; - function reduceEachLeadingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function reduceEachTrailingCommentRange(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U; - function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined; - function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined; - /** Optionally, get the shebang */ - function getShebang(text: string): string | undefined; - function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; - function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; - function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; -} declare namespace ts { function createNode(kind: SyntaxKind, pos?: number, end?: number): Node; /** @@ -3354,59 +3354,6 @@ declare namespace ts { function isExternalModule(file: SourceFile): boolean; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } -declare namespace ts { - function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine; - /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ - function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): { - config?: any; - error?: Diagnostic; - }; - /** - * Parse the text of the tsconfig.json file - * @param fileName The path to the config file - * @param jsonText The text of the config file - */ - function parseConfigFileTextToJson(fileName: string, jsonText: string): { - config?: any; - error?: Diagnostic; - }; - /** - * Read tsconfig.json file - * @param fileName The path to the config file - */ - function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): JsonSourceFile; - /** - * Convert the json syntax tree into the json value - */ - function convertToObject(sourceFile: JsonSourceFile, errors: Push): any; - /** - * Parse the contents of a config file (tsconfig.json). - * @param json The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; - /** - * Parse the contents of a config file (tsconfig.json). - * @param jsonNode The contents of the config file to parse - * @param host Instance of ParseConfigHost used to enumerate files in folder. - * @param basePath A root directory to resolve relative path entries in the config - * file to. e.g. outDir - */ - function parseJsonSourceFileConfigFileContent(sourceFile: JsonSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; - function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: CompilerOptions; - errors: Diagnostic[]; - }; - function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { - options: TypeAcquisition; - errors: Diagnostic[]; - }; -} declare namespace ts { interface GetEffectiveTypeRootsHost { directoryExists?(directoryName: string): boolean; @@ -3971,6 +3918,312 @@ declare namespace ts { */ function createProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: Program, configFileParsingDiagnostics?: ReadonlyArray): Program; } +declare namespace ts { + interface EmitOutput { + outputFiles: OutputFile[]; + emitSkipped: boolean; + } + interface OutputFile { + name: string; + writeByteOrderMark: boolean; + text: string; + } +} +declare namespace ts { + type AffectedFileResult = { + result: T; + affected: SourceFile | Program; + } | undefined; + interface BuilderProgramHost { + /** + * return true if file names are treated with case sensitivity + */ + useCaseSensitiveFileNames(): boolean; + /** + * If provided this would be used this hash instead of actual file shape text for detecting changes + */ + createHash?: (data: string) => string; + /** + * When emit or emitNextAffectedFile are called without writeFile, + * this callback if present would be used to write files + */ + writeFile?: WriteFileCallback; + } + /** + * Builder to manage the program state changes + */ + interface BuilderProgram { + /** + * Returns current program + */ + getProgram(): Program; + /** + * Get compiler options of the program + */ + getCompilerOptions(): CompilerOptions; + /** + * Get the source file in the program with file name + */ + getSourceFile(fileName: string): SourceFile | undefined; + /** + * Get a list of files in the program + */ + getSourceFiles(): ReadonlyArray; + /** + * Get the diagnostics for compiler options + */ + getOptionsDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get the diagnostics that dont belong to any file + */ + getGlobalDiagnostics(cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get the diagnostics from config file parsing + */ + getConfigFileParsingDiagnostics(): ReadonlyArray; + /** + * Get the syntax diagnostics, for all source files if source file is not supplied + */ + getSyntacticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Get all the dependencies of the file + */ + getAllDependencies(sourceFile: SourceFile): ReadonlyArray; + /** + * Gets the semantic diagnostics from the program corresponding to this state of file (if provided) or whole program + * The semantic diagnostics are cached and managed here + * Note that it is assumed that when asked about semantic diagnostics through this API, + * the file has been taken out of affected files so it is safe to use cache or get from program and cache the diagnostics + * In case of SemanticDiagnosticsBuilderProgram if the source file is not provided, + * it will iterate through all the affected files, to ensure that cache stays valid and yet provide a way to get all semantic diagnostics + */ + getSemanticDiagnostics(sourceFile?: SourceFile, cancellationToken?: CancellationToken): ReadonlyArray; + /** + * Emits the JavaScript and declaration files. + * When targetSource file is specified, emits the files corresponding to that source file, + * otherwise for the whole program. + * In case of EmitAndSemanticDiagnosticsBuilderProgram, when targetSourceFile is specified, + * it is assumed that that file is handled from affected file list. If targetSourceFile is not specified, + * it will only emit all the affected files instead of whole program + * + * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host + * in that order would be used to write the files + */ + emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult; + /** + * Get the current directory of the program + */ + getCurrentDirectory(): string; + } + /** + * The builder that caches the semantic diagnostics for the program and handles the changed files and affected files + */ + interface SemanticDiagnosticsBuilderProgram extends BuilderProgram { + /** + * Gets the semantic diagnostics from the program for the next affected file and caches it + * Returns undefined if the iteration is complete + */ + getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult>; + } + /** + * The builder that can handle the changes in program and iterate through changed file to emit the files + * The semantic diagnostics are cached per file and managed by clearing for the changed/affected files + */ + interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram { + /** + * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete + * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host + * in that order would be used to write the files + */ + emitNextAffectedFile(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): AffectedFileResult; + } + /** + * Create the builder to manage semantic diagnostics and cache them + */ + function createSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; + function createSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: SemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): SemanticDiagnosticsBuilderProgram; + /** + * Create the builder that can handle the changes in program and iterate through changed files + * to emit the those files and manage semantic diagnostics cache as well + */ + function createEmitAndSemanticDiagnosticsBuilderProgram(newProgram: Program, host: BuilderProgramHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; + function createEmitAndSemanticDiagnosticsBuilderProgram(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: EmitAndSemanticDiagnosticsBuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): EmitAndSemanticDiagnosticsBuilderProgram; + /** + * Creates a builder thats just abstraction over program and can be used with watch + */ + function createAbstractBuilder(newProgram: Program, host: BuilderProgramHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; + function createAbstractBuilder(rootNames: ReadonlyArray, options: CompilerOptions, host?: CompilerHost, oldProgram?: BuilderProgram, configFileParsingDiagnostics?: ReadonlyArray): BuilderProgram; +} +declare namespace ts { + type DiagnosticReporter = (diagnostic: Diagnostic) => void; + type WatchStatusReporter = (diagnostic: Diagnostic, newLine: string, options: CompilerOptions) => void; + /** Create the program with rootNames and options, if they are undefined, oldProgram and new configFile diagnostics create new program */ + type CreateProgram = (rootNames: ReadonlyArray | undefined, options: CompilerOptions | undefined, host?: CompilerHost, oldProgram?: T, configFileParsingDiagnostics?: ReadonlyArray) => T; + interface WatchCompilerHost { + /** + * Used to create the program when need for program creation or recreation detected + */ + createProgram: CreateProgram; + /** If provided, callback to invoke after every new program creation */ + afterProgramCreate?(program: T): void; + /** If provided, called with Diagnostic message that informs about change in watch status */ + onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions): void; + useCaseSensitiveFileNames(): boolean; + getNewLine(): string; + getCurrentDirectory(): string; + getDefaultLibFileName(options: CompilerOptions): string; + getDefaultLibLocation?(): string; + createHash?(data: string): string; + /** + * Use to check file presence for source files and + * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well + */ + fileExists(path: string): boolean; + /** + * Use to read file text for source files and + * if resolveModuleNames is not provided (complier is in charge of module resolution) then module files as well + */ + readFile(path: string, encoding?: string): string | undefined; + /** If provided, used for module resolution as well as to handle directory structure */ + directoryExists?(path: string): boolean; + /** If provided, used in resolutions as well as handling directory structure */ + getDirectories?(path: string): string[]; + /** If provided, used to cache and handle directory structure modifications */ + readDirectory?(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; + /** Symbol links resolution */ + realpath?(path: string): string; + /** If provided would be used to write log about compilation */ + trace?(s: string): void; + /** If provided is used to get the environment variable */ + getEnvironmentVariable?(name: string): string; + /** If provided, used to resolve the module names, otherwise typescript's default module resolution */ + resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModule[]; + /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ + resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): (ResolvedTypeReferenceDirective | undefined)[]; + /** Used to watch changes in source files, missing files needed to update the program or config file */ + watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher; + /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */ + watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher; + /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */ + setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; + /** If provided, will be used to reset existing delayed compilation */ + clearTimeout?(timeoutId: any): void; + } + /** + * Host to create watch with root files and options + */ + interface WatchCompilerHostOfFilesAndCompilerOptions extends WatchCompilerHost { + /** root files to use to generate program */ + rootFiles: string[]; + /** Compiler options */ + options: CompilerOptions; + } + /** + * Reports config file diagnostics + */ + interface ConfigFileDiagnosticsReporter { + /** + * Reports unrecoverable error when parsing config file + */ + onUnRecoverableConfigFileDiagnostic: DiagnosticReporter; + } + /** + * Host to create watch with config file + */ + interface WatchCompilerHostOfConfigFile extends WatchCompilerHost, ConfigFileDiagnosticsReporter { + /** Name of the config file to compile */ + configFileName: string; + /** Options to extend */ + optionsToExtend?: CompilerOptions; + /** + * Used to generate source file names from the config file and its include, exclude, files rules + * and also to cache the directory stucture + */ + readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[]; + } + interface Watch { + /** Synchronize with host and get updated program */ + getProgram(): T; + } + /** + * Creates the watch what generates program using the config file + */ + interface WatchOfConfigFile extends Watch { + } + /** + * Creates the watch that generates program using the root files and compiler options + */ + interface WatchOfFilesAndCompilerOptions extends Watch { + /** Updates the root files in the program, only if this is not config file compilation */ + updateRootFileNames(fileNames: string[]): void; + } + /** + * Create the watch compiler host for either configFile or fileNames and its options + */ + function createWatchCompilerHost(rootFiles: string[], options: CompilerOptions, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfFilesAndCompilerOptions; + function createWatchCompilerHost(configFileName: string, optionsToExtend: CompilerOptions | undefined, system: System, createProgram?: CreateProgram, reportDiagnostic?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): WatchCompilerHostOfConfigFile; + /** + * Creates the watch from the host for root files and compiler options + */ + function createWatchProgram(host: WatchCompilerHostOfFilesAndCompilerOptions): WatchOfFilesAndCompilerOptions; + /** + * Creates the watch from the host for config file + */ + function createWatchProgram(host: WatchCompilerHostOfConfigFile): WatchOfConfigFile; +} +declare namespace ts { + function parseCommandLine(commandLine: ReadonlyArray, readFile?: (path: string) => string | undefined): ParsedCommandLine; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readConfigFile(fileName: string, readFile: (path: string) => string | undefined): { + config?: any; + error?: Diagnostic; + }; + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + function parseConfigFileTextToJson(fileName: string, jsonText: string): { + config?: any; + error?: Diagnostic; + }; + /** + * Read tsconfig.json file + * @param fileName The path to the config file + */ + function readJsonConfigFile(fileName: string, readFile: (path: string) => string | undefined): JsonSourceFile; + /** + * Convert the json syntax tree into the json value + */ + function convertToObject(sourceFile: JsonSourceFile, errors: Push): any; + /** + * Parse the contents of a config file (tsconfig.json). + * @param json The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; + /** + * Parse the contents of a config file (tsconfig.json). + * @param jsonNode The contents of the config file to parse + * @param host Instance of ParseConfigHost used to enumerate files in folder. + * @param basePath A root directory to resolve relative path entries in the config + * file to. e.g. outDir + */ + function parseJsonSourceFileConfigFileContent(sourceFile: JsonSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray): ParsedCommandLine; + function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: CompilerOptions; + errors: Diagnostic[]; + }; + function convertTypeAcquisitionFromJson(jsonOptions: any, basePath: string, configFileName?: string): { + options: TypeAcquisition; + errors: Diagnostic[]; + }; +} declare namespace ts { interface Node { getSourceFile(): SourceFile; @@ -4273,8 +4526,6 @@ declare namespace ts { commands?: CodeActionCommand[]; } interface CodeFixAction extends CodeAction { - /** Short name to identify the fix, for use by telemetry. */ - fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. @@ -4886,6 +5137,15 @@ declare namespace ts { */ function getDefaultLibFilePath(options: CompilerOptions): string; } +declare namespace ts { + /** + * Transform one or more nodes using the supplied transformers. + * @param source A single `Node` or an array of `Node` objects. + * @param transformers An array of `TransformerFactory` callbacks used to process the transformation. + * @param compilerOptions Optional compiler options. + */ + function transform(source: T | T[], transformers: TransformerFactory[], compilerOptions?: CompilerOptions): TransformationResult; +} declare namespace ts.server { interface CompressedData { length: number; @@ -6349,8 +6609,6 @@ declare namespace ts.server.protocol { commands?: ReadonlyArray<{}>; } interface CodeFixAction extends CodeAction { - /** Short name to identify the fix, for use by telemetry. */ - fixName: string; /** * If present, one may call 'getCombinedCodeFix' with this fixId. * This may be omitted to indicate that the code fix can't be applied in a group. @@ -7278,182 +7536,6 @@ declare namespace ts.server.protocol { ESNext = "ESNext" } } -declare namespace ts.server { - interface ServerCancellationToken extends HostCancellationToken { - setRequest(requestId: number): void; - resetRequest(requestId: number): void; - } - const nullCancellationToken: ServerCancellationToken; - interface PendingErrorCheck { - fileName: NormalizedPath; - project: Project; - } - type CommandNames = protocol.CommandTypes; - const CommandNames: any; - function formatMessage(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; - type Event = (body: T, eventName: string) => void; - interface EventSender { - event: Event; - } - interface SessionOptions { - host: ServerHost; - cancellationToken: ServerCancellationToken; - useSingleInferredProject: boolean; - useInferredProjectPerProjectRoot: boolean; - typingsInstaller: ITypingsInstaller; - byteLength: (buf: string, encoding?: string) => number; - hrtime: (start?: number[]) => number[]; - logger: Logger; - /** - * If falsy, all events are suppressed. - */ - canUseEvents: boolean; - eventHandler?: ProjectServiceEventHandler; - /** Has no effect if eventHandler is also specified. */ - suppressDiagnosticEvents?: boolean; - syntaxOnly?: boolean; - throttleWaitMilliseconds?: number; - globalPlugins?: ReadonlyArray; - pluginProbeLocations?: ReadonlyArray; - allowLocalPluginLoads?: boolean; - } - class Session implements EventSender { - private readonly gcTimer; - protected projectService: ProjectService; - private changeSeq; - private currentRequestId; - private errorCheck; - protected host: ServerHost; - private readonly cancellationToken; - protected readonly typingsInstaller: ITypingsInstaller; - protected byteLength: (buf: string, encoding?: string) => number; - private hrtime; - protected logger: Logger; - protected canUseEvents: boolean; - private suppressDiagnosticEvents?; - private eventHandler; - constructor(opts: SessionOptions); - private sendRequestCompletedEvent; - private defaultEventHandler; - private projectsUpdatedInBackgroundEvent; - logError(err: Error, cmd: string): void; - send(msg: protocol.Message): void; - event(body: T, eventName: string): void; - /** @deprecated */ - output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; - private doOutput; - private semanticCheck; - private syntacticCheck; - private suggestionCheck; - private sendDiagnosticsEvent; - /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ - private updateErrorCheck; - private cleanProjects; - private cleanup; - private getEncodedSemanticClassifications; - private getProject; - private getConfigFileAndProject; - private getConfigFileDiagnostics; - private convertToDiagnosticsWithLinePositionFromDiagnosticFile; - private getCompilerOptionsDiagnostics; - private convertToDiagnosticsWithLinePosition; - private getDiagnosticsWorker; - private getDefinition; - private getDefinitionAndBoundSpan; - private mapDefinitionInfo; - private toFileSpan; - private getTypeDefinition; - private getImplementation; - private getOccurrences; - private getSyntacticDiagnosticsSync; - private getSemanticDiagnosticsSync; - private getSuggestionDiagnosticsSync; - private getDocumentHighlights; - private setCompilerOptionsForInferredProjects; - private getProjectInfo; - private getProjectInfoWorker; - private getRenameInfo; - private getProjects; - private getDefaultProject; - private getRenameLocations; - private getReferences; - /** - * @param fileName is the name of the file to be opened - * @param fileContent is a version of the file content that is known to be more up to date than the one on disk - */ - private openClientFile; - private getPosition; - private getPositionInFile; - private getFileAndProject; - private getFileAndLanguageServiceForSyntacticOperation; - private getFileAndProjectWorker; - private getOutliningSpans; - private getTodoComments; - private getDocCommentTemplate; - private getSpanOfEnclosingComment; - private getIndentation; - private getBreakpointStatement; - private getNameOrDottedNameSpan; - private isValidBraceCompletion; - private getQuickInfoWorker; - private getFormattingEditsForRange; - private getFormattingEditsForRangeFull; - private getFormattingEditsForDocumentFull; - private getFormattingEditsAfterKeystrokeFull; - private getFormattingEditsAfterKeystroke; - private getCompletions; - private getCompletionEntryDetails; - private getCompileOnSaveAffectedFileList; - private emitFile; - private getSignatureHelpItems; - private createCheckList; - private getDiagnostics; - private change; - private reload; - private saveToTmp; - private closeClientFile; - private mapLocationNavigationBarItems; - private getNavigationBarItems; - private toLocationNavigationTree; - private toLocationTextSpan; - private getNavigationTree; - private getNavigateToItems; - private getSupportedCodeFixes; - private isLocation; - private extractPositionAndRange; - private getApplicableRefactors; - private getEditsForRefactor; - private organizeImports; - private getCodeFixes; - private getCombinedCodeFix; - private applyCodeActionCommand; - private getStartAndEndPosition; - private mapCodeAction; - private mapCodeFixAction; - private mapTextChangesToCodeEdits; - private mapTextChangesToCodeEditsUsingScriptinfo; - private convertTextChangeToCodeEdit; - private getBraceMatching; - private getDiagnosticsForProject; - getCanonicalFileName(fileName: string): string; - exit(): void; - private notRequired; - private requiredResponse; - private handlers; - addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse): void; - private setCurrentRequest; - private resetCurrentRequest; - executeWithRequestId(requestId: number, f: () => T): T; - executeCommand(request: protocol.Request): HandlerResponse; - onMessage(message: string): void; - private getFormatOptions; - private getPreferences; - } - interface HandlerResponse { - response?: {}; - responseRequired?: boolean; - } -} declare namespace ts.server { class ScriptInfo { private readonly host; @@ -7528,17 +7610,6 @@ declare namespace ts.server { onProjectClosed(project: Project): void; } } -declare namespace ts { - interface EmitOutput { - outputFiles: OutputFile[]; - emitSkipped: boolean; - } - interface OutputFile { - name: string; - writeByteOrderMark: boolean; - text: string; - } -} declare namespace ts.server { enum ProjectKind { Inferred = 0, @@ -8114,6 +8185,181 @@ declare namespace ts.server { openExternalProject(proj: protocol.ExternalProject): void; } } +declare namespace ts.server { + interface ServerCancellationToken extends HostCancellationToken { + setRequest(requestId: number): void; + resetRequest(requestId: number): void; + } + const nullCancellationToken: ServerCancellationToken; + interface PendingErrorCheck { + fileName: NormalizedPath; + project: Project; + } + type CommandNames = protocol.CommandTypes; + const CommandNames: any; + function formatMessage(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string; + type Event = (body: T, eventName: string) => void; + interface EventSender { + event: Event; + } + interface SessionOptions { + host: ServerHost; + cancellationToken: ServerCancellationToken; + useSingleInferredProject: boolean; + useInferredProjectPerProjectRoot: boolean; + typingsInstaller: ITypingsInstaller; + byteLength: (buf: string, encoding?: string) => number; + hrtime: (start?: number[]) => number[]; + logger: Logger; + /** + * If falsy, all events are suppressed. + */ + canUseEvents: boolean; + eventHandler?: ProjectServiceEventHandler; + /** Has no effect if eventHandler is also specified. */ + suppressDiagnosticEvents?: boolean; + syntaxOnly?: boolean; + throttleWaitMilliseconds?: number; + globalPlugins?: ReadonlyArray; + pluginProbeLocations?: ReadonlyArray; + allowLocalPluginLoads?: boolean; + } + class Session implements EventSender { + private readonly gcTimer; + protected projectService: ProjectService; + private changeSeq; + private currentRequestId; + private errorCheck; + protected host: ServerHost; + private readonly cancellationToken; + protected readonly typingsInstaller: ITypingsInstaller; + protected byteLength: (buf: string, encoding?: string) => number; + private hrtime; + protected logger: Logger; + protected canUseEvents: boolean; + private suppressDiagnosticEvents?; + private eventHandler; + constructor(opts: SessionOptions); + private sendRequestCompletedEvent; + private defaultEventHandler; + private projectsUpdatedInBackgroundEvent; + logError(err: Error, cmd: string): void; + send(msg: protocol.Message): void; + event(body: T, eventName: string): void; + /** @deprecated */ + output(info: any, cmdName: string, reqSeq?: number, errorMsg?: string): void; + private doOutput; + private semanticCheck; + private syntacticCheck; + private suggestionCheck; + private sendDiagnosticsEvent; + /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */ + private updateErrorCheck; + private cleanProjects; + private cleanup; + private getEncodedSemanticClassifications; + private getProject; + private getConfigFileAndProject; + private getConfigFileDiagnostics; + private convertToDiagnosticsWithLinePositionFromDiagnosticFile; + private getCompilerOptionsDiagnostics; + private convertToDiagnosticsWithLinePosition; + private getDiagnosticsWorker; + private getDefinition; + private getDefinitionAndBoundSpan; + private mapDefinitionInfo; + private toFileSpan; + private getTypeDefinition; + private getImplementation; + private getOccurrences; + private getSyntacticDiagnosticsSync; + private getSemanticDiagnosticsSync; + private getSuggestionDiagnosticsSync; + private getDocumentHighlights; + private setCompilerOptionsForInferredProjects; + private getProjectInfo; + private getProjectInfoWorker; + private getRenameInfo; + private getProjects; + private getDefaultProject; + private getRenameLocations; + private getReferences; + /** + * @param fileName is the name of the file to be opened + * @param fileContent is a version of the file content that is known to be more up to date than the one on disk + */ + private openClientFile; + private getPosition; + private getPositionInFile; + private getFileAndProject; + private getFileAndLanguageServiceForSyntacticOperation; + private getFileAndProjectWorker; + private getOutliningSpans; + private getTodoComments; + private getDocCommentTemplate; + private getSpanOfEnclosingComment; + private getIndentation; + private getBreakpointStatement; + private getNameOrDottedNameSpan; + private isValidBraceCompletion; + private getQuickInfoWorker; + private getFormattingEditsForRange; + private getFormattingEditsForRangeFull; + private getFormattingEditsForDocumentFull; + private getFormattingEditsAfterKeystrokeFull; + private getFormattingEditsAfterKeystroke; + private getCompletions; + private getCompletionEntryDetails; + private getCompileOnSaveAffectedFileList; + private emitFile; + private getSignatureHelpItems; + private createCheckList; + private getDiagnostics; + private change; + private reload; + private saveToTmp; + private closeClientFile; + private mapLocationNavigationBarItems; + private getNavigationBarItems; + private toLocationNavigationTree; + private toLocationTextSpan; + private getNavigationTree; + private getNavigateToItems; + private getSupportedCodeFixes; + private isLocation; + private extractPositionAndRange; + private getApplicableRefactors; + private getEditsForRefactor; + private organizeImports; + private getCodeFixes; + private getCombinedCodeFix; + private applyCodeActionCommand; + private getStartAndEndPosition; + private mapCodeAction; + private mapTextChangesToCodeEdits; + private mapTextChangesToCodeEditsUsingScriptinfo; + private convertTextChangeToCodeEdit; + private getBraceMatching; + private getDiagnosticsForProject; + getCanonicalFileName(fileName: string): string; + exit(): void; + private notRequired; + private requiredResponse; + private handlers; + addProtocolHandler(command: string, handler: (request: protocol.Request) => HandlerResponse): void; + private setCurrentRequest; + private resetCurrentRequest; + executeWithRequestId(requestId: number, f: () => T): T; + executeCommand(request: protocol.Request): HandlerResponse; + onMessage(message: string): void; + private getFormatOptions; + private getPreferences; + } + interface HandlerResponse { + response?: {}; + responseRequired?: boolean; + } +} export = ts; export as namespace ts; \ No newline at end of file