mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Allow --withIncrementalVerifier to pass on commandline to tsserver to run incremental verification
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../incrementalVerifier/verifier";
|
||||
import * as collections from "./_namespaces/collections";
|
||||
import * as fakes from "./_namespaces/fakes";
|
||||
import {
|
||||
@@ -11,9 +14,6 @@ import {
|
||||
} from "./_namespaces/ts";
|
||||
import * as vfs from "./_namespaces/vfs";
|
||||
import * as vpath from "./_namespaces/vpath";
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "./incrementalUtils";
|
||||
import {
|
||||
patchServiceForStateBaseline,
|
||||
} from "./projectServiceStateLogger";
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../server" },
|
||||
{ "path": "../typingsInstallerCore" },
|
||||
{ "path": "../deprecatedCompat" }
|
||||
{ "path": "../deprecatedCompat" },
|
||||
{ "path": "../incrementalVerifier" }
|
||||
],
|
||||
|
||||
"include": ["**/*"]
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
/* Generated file to emulate the ts.server namespace. */
|
||||
|
||||
export * from "../../jsTyping/_namespaces/ts.server";
|
||||
export * from "../../server/_namespaces/ts.server";
|
||||
@@ -0,0 +1,9 @@
|
||||
/* Generated file to emulate the ts namespace. */
|
||||
|
||||
export * from "../../compiler/_namespaces/ts";
|
||||
export * from "../../jsTyping/_namespaces/ts";
|
||||
export * from "../../services/_namespaces/ts";
|
||||
export * from "../../server/_namespaces/ts";
|
||||
export * from "../verifier";
|
||||
import * as server from "./ts.server";
|
||||
export { server };
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"references": [
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../services" },
|
||||
{ "path": "../server" }
|
||||
],
|
||||
"include": ["**/*"]
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as ts from "./_namespaces/ts";
|
||||
|
||||
/** @internal */
|
||||
export function reportDocumentRegistryStats(documentRegistry: ts.DocumentRegistry) {
|
||||
const str: string[] = [];
|
||||
documentRegistry.getBuckets().forEach((bucketEntries, key) => {
|
||||
@@ -193,12 +194,14 @@ function getProgramStructure(program: ts.Program | undefined) {
|
||||
return baseline.join("\n");
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function verifyProgramStructure(expectedProgram: ts.Program, actualProgram: ts.Program, projectName: string) {
|
||||
const actual = getProgramStructure(actualProgram);
|
||||
const expected = getProgramStructure(expectedProgram);
|
||||
ts.Debug.assert(actual === expected, `Program verification:: ${projectName}`);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function verifyResolutionCache(
|
||||
actual: ts.ResolutionCache,
|
||||
actualProgram: ts.Program,
|
||||
@@ -583,11 +586,13 @@ function onProjectCreation(project: ts.server.Project) {
|
||||
(project as ts.ResolutionCacheHost).afterResolveSingleModuleNameWithoutWatching = afterResolveSingleModuleNameWithoutWatching;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export interface IncrementalVerifierCallbacks {
|
||||
beforeVerification?(): any;
|
||||
afterVerification?(dataFromBefore: any): void;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export function incrementalVerifier(service: ts.server.ProjectService) {
|
||||
service.verifyDocumentRegistry = withIncrementalVerifierCallbacks(service, verifyDocumentRegistry);
|
||||
service.verifyProgram = withIncrementalVerifierCallbacks(service, verifyProgram);
|
||||
@@ -15,6 +15,7 @@
|
||||
{ "path": "../server" },
|
||||
{ "path": "../typingsInstallerCore" },
|
||||
{ "path": "../deprecatedCompat" },
|
||||
{ "path": "../incrementalVerifier" },
|
||||
{ "path": "../harness" }
|
||||
],
|
||||
"include": ["**/*"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
verifyProgramStructure,
|
||||
verifyResolutionCache,
|
||||
} from "../../../harness/incrementalUtils";
|
||||
} from "../../../incrementalVerifier/verifier";
|
||||
import {
|
||||
patchHostForBuildInfoReadWrite,
|
||||
} from "../../_namespaces/fakes";
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../../../harness/incrementalUtils";
|
||||
import {
|
||||
patchServiceForStateBaseline,
|
||||
} from "../../../harness/projectServiceStateLogger";
|
||||
@@ -8,6 +5,9 @@ import {
|
||||
createLoggerWithInMemoryLogs,
|
||||
LoggerWithInMemoryLogs,
|
||||
} from "../../../harness/tsserverLogger";
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../../../incrementalVerifier/verifier";
|
||||
import * as Harness from "../../_namespaces/Harness";
|
||||
import * as ts from "../../_namespaces/ts";
|
||||
import {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../../../../harness/incrementalUtils";
|
||||
import {
|
||||
createHasErrorMessageLogger,
|
||||
} from "../../../../harness/tsserverLogger";
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../../../../incrementalVerifier/verifier";
|
||||
import * as Harness from "../../../_namespaces/Harness";
|
||||
import * as ts from "../../../_namespaces/ts";
|
||||
import {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
IncrementalVerifierCallbacks,
|
||||
} from "../../../harness/incrementalUtils";
|
||||
import {
|
||||
LoggerWithInMemoryLogs,
|
||||
} from "../../../harness/tsserverLogger";
|
||||
import {
|
||||
IncrementalVerifierCallbacks,
|
||||
} from "../../../incrementalVerifier/verifier";
|
||||
import * as ts from "../../_namespaces/ts";
|
||||
import {
|
||||
jsonToReadableText,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
reportDocumentRegistryStats,
|
||||
} from "../../../harness/incrementalUtils";
|
||||
} from "../../../incrementalVerifier/verifier";
|
||||
import * as ts from "../../_namespaces/ts";
|
||||
import {
|
||||
jsonToReadableText,
|
||||
|
||||
@@ -2,13 +2,13 @@ import {
|
||||
expect,
|
||||
} from "chai";
|
||||
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../../../harness/incrementalUtils";
|
||||
import {
|
||||
createHasErrorMessageLogger,
|
||||
nullLogger,
|
||||
} from "../../../harness/tsserverLogger";
|
||||
import {
|
||||
incrementalVerifier,
|
||||
} from "../../../incrementalVerifier/verifier";
|
||||
import * as Harness from "../../_namespaces/Harness";
|
||||
import * as ts from "../../_namespaces/ts";
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
{ "path": "./deprecatedCompat" },
|
||||
{ "path": "./executeCommandLine" },
|
||||
{ "path": "./harness" },
|
||||
{ "path": "./incrementalVerifier" },
|
||||
{ "path": "./jsTyping" },
|
||||
{ "path": "./server" },
|
||||
{ "path": "./services" },
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
FileWatcher,
|
||||
getDirectoryPath,
|
||||
getRootLength,
|
||||
incrementalVerifier,
|
||||
LanguageServiceMode,
|
||||
MapLike,
|
||||
noop,
|
||||
@@ -30,7 +31,6 @@ import {
|
||||
StartInput,
|
||||
StartSessionOptions,
|
||||
} from "./common";
|
||||
|
||||
interface LogOptions {
|
||||
file?: string;
|
||||
detailLevel?: ts.server.LogLevel;
|
||||
@@ -589,6 +589,7 @@ function startNodeSession(options: StartSessionOptions, logger: ts.server.Logger
|
||||
logger,
|
||||
canUseEvents: true,
|
||||
typesMapLocation,
|
||||
incrementalVerifier: withIncrementalVerifier ? incrementalVerifier : undefined,
|
||||
});
|
||||
|
||||
this.eventPort = eventPort;
|
||||
@@ -689,6 +690,7 @@ function startNodeSession(options: StartSessionOptions, logger: ts.server.Logger
|
||||
const validateDefaultNpmLocation = ts.server.hasArgument(ts.server.Arguments.ValidateDefaultNpmLocation);
|
||||
const disableAutomaticTypingAcquisition = ts.server.hasArgument("--disableAutomaticTypingAcquisition");
|
||||
const useNodeIpc = ts.server.hasArgument("--useNodeIpc");
|
||||
const withIncrementalVerifier = ts.server.hasArgument("--withIncrementalVerifier");
|
||||
const telemetryEnabled = ts.server.hasArgument(ts.server.Arguments.EnableTelemetry);
|
||||
const commandLineTraceDir = ts.server.findArgument("--traceDirectory");
|
||||
const traceDir = commandLineTraceDir
|
||||
|
||||
@@ -4,5 +4,6 @@ export * from "../../compiler/_namespaces/ts";
|
||||
export * from "../../jsTyping/_namespaces/ts";
|
||||
export * from "../../services/_namespaces/ts";
|
||||
export * from "../../server/_namespaces/ts";
|
||||
export * from "../../incrementalVerifier/_namespaces/ts";
|
||||
import * as server from "./ts.server";
|
||||
export { server };
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../services" },
|
||||
{ "path": "../server" }
|
||||
{ "path": "../server" },
|
||||
{ "path": "../incrementalVerifier" }
|
||||
],
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user