From ec8e9a0f98ee3e0671093101a08d0719cddb58c2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 25 Aug 2022 11:38:01 -0700 Subject: [PATCH 01/13] Add test using existing plugin It shows that some of the watches couldnt be overriden before project is created --- src/testRunner/unittests/tscWatch/helpers.ts | 65 ++++++++ .../unittests/tsserver/watchEnvironment.ts | 66 ++++++++ .../unittests/virtualFileSystemWithWatch.ts | 4 +- .../plugin-overriding-watch.js | 157 ++++++++++++++++++ 4 files changed, 290 insertions(+), 2 deletions(-) create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/plugin-overriding-watch.js diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index e864b976277ba..2fa3c46789b13 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -15,6 +15,7 @@ import { File, FileOrFolderOrSymLink, FileOrFolderOrSymLinkMap, + serializeMultiMap, TestServerHost, TestServerHostCreationParameters, TestServerHostTrackingWrittenFiles, @@ -327,3 +328,67 @@ export function solutionBuildWithBaseline(sys: TestServerHost, solutionRoots: re export function createSystemWithSolutionBuild(solutionRoots: readonly string[], files: FileOrFolderOrSymLinkMap | readonly FileOrFolderOrSymLink[], params?: TestServerHostCreationParameters) { return solutionBuildWithBaseline(createWatchedSystem(files, params), solutionRoots); } + +interface WatchedFileCallback { + callback: ts.FileWatcherCallback; + pollingInterval: number | undefined; + options: ts.WatchOptions | undefined; +} +interface WatchedDirectoryCallback { + callback: ts.DirectoryWatcherCallback; + options: ts.WatchOptions | undefined; +} +export interface WatchFactorySystem extends TestServerHost { + factoryData: { + watchedFiles: ts.MultiMap; + watchedDirectories: ts.MultiMap; + watchedDirectoriesRecursive: ts.MultiMap; + watchFile(path: string, callback: ts.FileWatcherCallback, pollingInterval?: ts.PollingInterval, options?: ts.WatchOptions): ts.FileWatcher; + watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean, options?: ts.WatchOptions): ts.FileWatcher; + onConfigurationChanged(config: any): void; + } +} + +export function createWatchFactorySystem(inputSystem: TestServerHost, log: (s: string) => void = s => inputSystem.write(s + "\n"), pluginName?: string): WatchFactorySystem { + const watchedFiles = ts.createMultiMap(); + const watchedDirectories = ts.createMultiMap(); + const watchedDirectoriesRecursive = ts.createMultiMap(); + let serializedWatchedFiles: Map | undefined; + let serializedWatchedDirectories: Map | undefined; + let serializedWatchedDirectoriesRecursive: Map | undefined; + const system = inputSystem as WatchFactorySystem; + const originalSerializeWatches = system.serializeWatches; + system.serializeWatches = serializeWatches; + system.factoryData = { watchedFiles, watchedDirectories, watchedDirectoriesRecursive, watchFile, watchDirectory, onConfigurationChanged }; + return system; + + function watchFile(path: string, callback: ts.FileWatcherCallback, pollingInterval?: ts.PollingInterval, options?: ts.WatchOptions) { + log(`Custom ${pluginName || ""}watchFile: ${path} ${pollingInterval} ${JSON.stringify(options)}`); + const watchedFileCallback: WatchedFileCallback = { callback, pollingInterval, options }; + watchedFiles.add(path, watchedFileCallback); + system.hasWatchChanges = true; + return { close: () => watchedFiles.remove(path, watchedFileCallback) }; + } + + function watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean, options?: ts.WatchOptions) { + log(`Custom ${pluginName || ""}watchDirectory: ${path} ${recursive} ${JSON.stringify(options)}`); + const watchedDirectoryCallback: WatchedDirectoryCallback = { callback, options }; + (recursive ? watchedDirectoriesRecursive : watchedDirectories).add(path, watchedDirectoryCallback); + system.hasWatchChanges = true; + return { close: () => (recursive ? watchedDirectoriesRecursive : watchedDirectories).remove(path, watchedDirectoryCallback) }; + } + + function onConfigurationChanged(config: any) { + log(`Custom:: ${pluginName || ""}onConfigurationChanged:: ${JSON.stringify(config)}`); + } + + function serializeWatches(baseline: string[] = []) { + const hasWatchChanges = system.hasWatchChanges; + originalSerializeWatches.call(system, baseline); + if (!hasWatchChanges) return baseline; + serializedWatchedFiles = serializeMultiMap(baseline, `${pluginName || ""}Plugin WatchedFiles`, watchedFiles, serializedWatchedFiles); + serializedWatchedDirectories = serializeMultiMap(baseline, `${pluginName || ""}Plugin WatchedDirectories:Recursive`, watchedDirectoriesRecursive, serializedWatchedDirectories); + serializedWatchedDirectoriesRecursive = serializeMultiMap(baseline, `${pluginName || ""}Plugin WatchedDirectories`, watchedDirectories, serializedWatchedDirectoriesRecursive); + return baseline; + } +} \ No newline at end of file diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index ea7e84cf4c54a..cf41c5d4f159d 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -2,6 +2,7 @@ import * as ts from "../../_namespaces/ts"; import { commonFile1, commonFile2, + createWatchFactorySystem, } from "../tscWatch/helpers"; import { createServerHost, @@ -20,6 +21,7 @@ import { protocolFileLocationFromSubstring, setCompilerOptionsForInferredProjectsRequestForSession, TestSession, + TestSessionOptions, toExternalFiles, } from "./helpers"; @@ -495,3 +497,67 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFile is single watcher baselineTsserverLogs("watchEnvironment", "when watchFile is single watcher per file", session); }); }); + +describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { + it("plugin overriding watch", () => { + const { host, session, plugin, aTs, bTs, } = createHostForPlugins({ globalPlugins: ["myplugin"] }); + const existingWatchFile = host.watchFile; + const existingWatchDirectory = host.watchDirectory; + host.require = (initialPath, moduleName) => { + session.logger.log(`CustomRequire:: Resolving ${moduleName} from ${initialPath}`); + return { + module: (): ts.server.PluginModule => ({ + create: info => { + info.serverHost.watchFile = plugin.watchFile; + info.serverHost.watchDirectory = plugin.watchDirectory; + return info.languageService; + } + }), + error: undefined + }; + }; + openFilesForSession([aTs], session); + session.logger.log(`Host watchFile expected to be patched. Actual: ${host.watchFile !== existingWatchFile}`); + session.logger.log(`Host watchDirectory expected to be patched. Actual: ${host.watchDirectory !== existingWatchDirectory}`); + + // Change b.ts + session.logger.log("Change file"); + host.writeFile(bTs.path, aTs.content); + // Since we have overriden watch, this shouldnt do anything + host.runQueuedTimeoutCallbacks(); + + // Actually invoke watches + session.logger.log("Invoke plugin watches"); + plugin.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); + // Host should have updates queued + host.runQueuedTimeoutCallbacks(); + + baselineTsserverLogs("watchEnvironment", "plugin overriding watch", session); + }); + + function createHostForPlugins(opts?: Partial, watchOptions?: ts.WatchOptions) { + const configFile: File = { + path: `/user/username/projects/myproject/tsconfig.json`, + content: JSON.stringify({ watchOptions }) + }; + const aTs: File = { + path: `/user/username/projects/myproject/a.ts`, + content: `export class a { prop = "hello"; foo() { return this.prop; } }` + }; + const bTs: File = { + path: `/user/username/projects/myproject/b.ts`, + content: `export class b { prop = "hello"; foo() { return this.prop; } }` + }; + const host = createServerHost([aTs, bTs, configFile, libFile]); + const session = createSession(host, { + ...opts, + logger: createLoggerWithInMemoryLogs(host), + pluginProbeLocations: ["/a/pluginprobe1", "/a/pluginprobe2"], + }); + return { host, session, aTs, bTs, plugin: createFactoryFunctions(session) }; + } + + function createFactoryFunctions(session: TestSession, pluginName?: string) { + return createWatchFactorySystem(session.testhost, s => session.logger.log(s), pluginName).factoryData; + } +}); diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 3873a36051c85..10814e7787072 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -610,7 +610,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, this.removeFileOrFolder(currentEntry); } - private hasWatchChanges?: boolean; + hasWatchChanges?: boolean; private createWatcher(map: MultiMap, path: Path, callback: T): FileWatcher { this.hasWatchChanges = true; map.add(path, callback); @@ -1102,7 +1102,7 @@ function diffFsEntry(baseline: string[], oldFsEntry: FSEntry | undefined, newFsE } } -function serializeMultiMap(baseline: string[], caption: string, multiMap: MultiMap, serialized: Map | undefined) { +export function serializeMultiMap(baseline: string[], caption: string, multiMap: MultiMap, serialized: Map | undefined) { let hasChange = diffMap(baseline, caption, multiMap, serialized, /*deleted*/ false); hasChange = diffMap(baseline, caption, serialized, multiMap, /*deleted*/ true) || hasChange; if (hasChange) { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/plugin-overriding-watch.js b/tests/baselines/reference/tsserver/watchEnvironment/plugin-overriding-watch.js new file mode 100644 index 0000000000000..459958c216fc4 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/plugin-overriding-watch.js @@ -0,0 +1,157 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Loading global plugin myplugin +Info seq [hh:mm:ss:mss] Enabling plugin myplugin from candidate paths: /a/pluginprobe1,/a/pluginprobe2,/a/lib/tsc.js/../../.. +Info seq [hh:mm:ss:mss] Loading myplugin from /a/pluginprobe1 (resolved to /a/pluginprobe1/node_modules) +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules +Info seq [hh:mm:ss:mss] Plugin validation succeeded +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 undefined +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 undefined +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true undefined +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Plugin WatchedFiles:: +/user/username/projects/myproject/b.ts: *new* + {"pollingInterval":500} +/a/lib/lib.d.ts: *new* + {"pollingInterval":500} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {} + +Host watchFile expected to be patched. Actual: true +Host watchDirectory expected to be patched. Actual: true +Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 From 5af131f25e6b52845dde9ccdd0398f0bab010079 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 9 Nov 2022 16:03:54 -0800 Subject: [PATCH 02/13] Some refactoring so server require and system require match --- src/compiler/sys.ts | 17 +++++++++++++++-- src/compiler/types.ts | 2 +- src/harness/harnessLanguageService.ts | 2 +- src/server/project.ts | 11 ++--------- .../unittests/virtualFileSystemWithWatch.ts | 4 ++-- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 50e7076774c3b..24097099c4792 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -28,6 +28,7 @@ import { matchesExclude, matchFiles, memoize, + ModuleImportResult, noop, normalizePath, normalizeSlashes, @@ -35,7 +36,6 @@ import { Path, perfLogger, PollingWatchKind, - RequireResult, resolveJSModule, some, startsWith, @@ -882,6 +882,19 @@ function createFsWatchCallbackForDirectoryWatcherCallback( }; } +/** @internal */ +export function resolveModule(moduleName: string, initialDir: string, host: Pick, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined { + const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules"))); + log(`Loading ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`); + const result = host.require!(resolvedPath, moduleName); // TODO: GH#18217 + if (result.error) { + const err = result.error.stack || result.error.message || JSON.stringify(result.error); + (logErrors || log)(`Failed to load module '${moduleName}' from ${resolvedPath}: ${err}`); + return undefined; + } + return result.module; +} + /** @internal */ export type FileSystemEntryExists = (fileorDirectrory: string, entryKind: FileSystemEntryKind) => boolean; @@ -1428,7 +1441,7 @@ export interface System { base64decode?(input: string): string; base64encode?(input: string): string; /** @internal */ bufferFrom?(input: string, encoding?: string): Buffer; - /** @internal */ require?(baseDir: string, moduleName: string): RequireResult; + /** @internal */ require?(baseDir: string, moduleName: string): ModuleImportResult; // For testing /** @internal */ now?(): Date; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b97d9becc8f68..5013a182d581e 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7343,7 +7343,7 @@ export interface ConfigFileSpecs { } /** @internal */ -export type RequireResult = +export type ModuleImportResult = | { module: T, modulePath?: string, error: undefined } | { module: undefined, modulePath?: undefined, error: { stack?: string, message?: string } }; diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index a8c854325a266..d8b7e5eb9a415 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -885,7 +885,7 @@ class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { return mockHash(s); } - require(_initialDir: string, _moduleName: string): ts.RequireResult { + require(_initialDir: string, _moduleName: string): ts.ModuleImportResult { switch (_moduleName) { // Adds to the Quick Info a fixed string and a string from the config file // and replaces the first display part diff --git a/src/server/project.ts b/src/server/project.ts index f05f4d4ae8fc6..e17f8185269d5 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -99,6 +99,7 @@ import { ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + resolveModule, resolvePackageNameToPackageJson, returnFalse, returnTrue, @@ -395,15 +396,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo } public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined { - const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules"))); - log(`Loading ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`); - const result = host.require!(resolvedPath, moduleName); // TODO: GH#18217 - if (result.error) { - const err = result.error.stack || result.error.message || JSON.stringify(result.error); - (logErrors || log)(`Failed to load module '${moduleName}' from ${resolvedPath}: ${err}`); - return undefined; - } - return result.module; + return resolveModule(moduleName, initialDir, host, log, logErrors); } /** @internal */ diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 10814e7787072..33a8e964e9ef9 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -31,13 +31,13 @@ import { isString, mapDefined, matchFiles, + ModuleImportResult, ModuleResolutionHost, MultiMap, noop, patchWriteFileEnsuringDirectory, Path, PollingInterval, - RequireResult, server, SortedArray, sys, @@ -292,7 +292,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, private readonly environmentVariables?: Map; private readonly executingFilePath: string; private readonly currentDirectory: string; - public require: ((initialPath: string, moduleName: string) => RequireResult) | undefined; + public require: ((initialPath: string, moduleName: string) => ModuleImportResult) | undefined; public storeFilesChangingSignatureDuringEmit = true; watchFile: HostWatchFile; private inodeWatching: boolean | undefined; From d718275dd12ce3bb3d0a890603c983e69b3807b3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 9 Sep 2022 13:11:35 -0700 Subject: [PATCH 03/13] No Need to overwrite the require implementation --- src/tsserver/nodeServer.ts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/tsserver/nodeServer.ts b/src/tsserver/nodeServer.ts index ce3a0c2d682ab..1154b4d5ec0d0 100644 --- a/src/tsserver/nodeServer.ts +++ b/src/tsserver/nodeServer.ts @@ -20,7 +20,6 @@ import { normalizePath, normalizeSlashes, perfLogger, - resolveJSModule, SortedReadonlyArray, startTracing, stripQuotes, @@ -57,7 +56,6 @@ import { ITypingsInstaller, Logger, LogLevel, - ModuleImportResult, Msg, nowString, nullCancellationToken, @@ -381,15 +379,6 @@ export function initializeNodeSystem(): StartInput { sys.gc = () => global.gc?.(); } - sys.require = (initialDir: string, moduleName: string): ModuleImportResult => { - try { - return { module: require(resolveJSModule(moduleName, initialDir, sys)), error: undefined }; - } - catch (error) { - return { module: undefined, error }; - } - }; - let cancellationToken: ServerCancellationToken; try { const factory = require("./cancellationToken"); From 6123b7370ae931f2896823cb8731d601d929a50c Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 5 Oct 2022 15:55:42 -0700 Subject: [PATCH 04/13] Refactor --- src/server/editorServices.ts | 14 ++++---- src/server/project.ts | 33 +++++++++---------- .../reference/api/tsserverlibrary.d.ts | 5 ++- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 8e4443e22086d..375fd28140416 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -962,7 +962,8 @@ export class ProjectService { public readonly globalPlugins: readonly string[]; public readonly pluginProbeLocations: readonly string[]; public readonly allowLocalPluginLoads: boolean; - private currentPluginConfigOverrides: Map | undefined; + /** @internal */ + currentPluginConfigOverrides: Map | undefined; public readonly typesMapLocation: string | undefined; @@ -2189,7 +2190,6 @@ export class ProjectService { /*lastFileExceededProgramSize*/ this.getFilenameForExceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), options.compileOnSave === undefined ? true : options.compileOnSave, /*projectFilePath*/ undefined, - this.currentPluginConfigOverrides, watchOptionsAndErrors?.watchOptions ); project.setProjectErrors(watchOptionsAndErrors?.errors); @@ -2354,7 +2354,7 @@ export class ProjectService { project.enableLanguageService(); this.watchWildcards(configFilename, configFileExistenceInfo, project); } - project.enablePluginsWithOptions(compilerOptions, this.currentPluginConfigOverrides); + project.enablePluginsWithOptions(compilerOptions); const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles()); this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition!, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions); tracing?.pop(); @@ -2737,7 +2737,7 @@ export class ProjectService { typeAcquisition = this.typeAcquisitionForInferredProjects; } watchOptionsAndErrors = watchOptionsAndErrors || undefined; - const project = new InferredProject(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors?.watchOptions, projectRootPath, currentDirectory, this.currentPluginConfigOverrides, typeAcquisition); + const project = new InferredProject(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors?.watchOptions, projectRootPath, currentDirectory, typeAcquisition); project.setProjectErrors(watchOptionsAndErrors?.errors); if (isSingleInferredProject) { this.inferredProjects.unshift(project); @@ -4243,7 +4243,7 @@ export class ProjectService { } /** @internal */ - requestEnablePlugin(project: Project, pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined) { + requestEnablePlugin(project: Project, pluginConfigEntry: PluginImport, searchPaths: string[]) { if (!this.host.importPlugin && !this.host.require) { this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); return; @@ -4257,7 +4257,7 @@ export class ProjectService { // If the host supports dynamic import, begin enabling the plugin asynchronously. if (this.host.importPlugin) { - const importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides); + const importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths); this.pendingPluginEnablements ??= new Map(); let promises = this.pendingPluginEnablements.get(project); if (!promises) this.pendingPluginEnablements.set(project, promises = []); @@ -4266,7 +4266,7 @@ export class ProjectService { } // Otherwise, load the plugin using `require` - project.endEnablePlugin(project.beginEnablePluginSync(pluginConfigEntry, searchPaths, pluginConfigOverrides)); + project.endEnablePlugin(project.beginEnablePluginSync(pluginConfigEntry, searchPaths)); } /** @internal */ diff --git a/src/server/project.ts b/src/server/project.ts index e17f8185269d5..d0b1448fd0476 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -255,7 +255,6 @@ export type PluginModuleFactory = (mod: { typescript: typeof ts }) => PluginModu /** @internal */ export interface BeginEnablePluginResult { pluginConfigEntry: PluginImport; - pluginConfigOverrides: Map | undefined; resolvedModule: PluginModuleFactory | undefined; errorLogs: string[] | undefined; } @@ -1789,7 +1788,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo ]; } - protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map | undefined): void { + protected enableGlobalPlugins(options: CompilerOptions): void { if (!this.projectService.globalPlugins.length) return; const host = this.projectService.host; @@ -1810,7 +1809,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo // Provide global: true so plugins can detect why they can't find their config this.projectService.logger.info(`Loading global plugin ${globalPluginName}`); - this.enablePlugin({ name: globalPluginName, global: true } as PluginImport, searchPaths, pluginConfigOverrides); + this.enablePlugin({ name: globalPluginName, global: true } as PluginImport, searchPaths); } } @@ -1819,7 +1818,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo * * @internal */ - beginEnablePluginSync(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined): BeginEnablePluginResult { + beginEnablePluginSync(pluginConfigEntry: PluginImport, searchPaths: string[]): BeginEnablePluginResult { Debug.assertIsDefined(this.projectService.host.require); let errorLogs: string[] | undefined; @@ -1829,7 +1828,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo }; const resolvedModule = firstDefined(searchPaths, searchPath => Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError) as PluginModuleFactory | undefined); - return { pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs }; + return { pluginConfigEntry, resolvedModule, errorLogs }; } /** @@ -1837,7 +1836,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo * * @internal */ - async beginEnablePluginAsync(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined): Promise { + async beginEnablePluginAsync(pluginConfigEntry: PluginImport, searchPaths: string[]): Promise { Debug.assertIsDefined(this.projectService.host.importPlugin); let errorLogs: string[] | undefined; @@ -1853,7 +1852,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo break; } } - return { pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs }; + return { pluginConfigEntry, resolvedModule, errorLogs }; } /** @@ -1861,9 +1860,9 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo * * @internal */ - endEnablePlugin({ pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs }: BeginEnablePluginResult) { + endEnablePlugin({ pluginConfigEntry, resolvedModule, errorLogs }: BeginEnablePluginResult) { if (resolvedModule) { - const configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name); + const configurationOverride = this.projectService.currentPluginConfigOverrides?.get(pluginConfigEntry.name); if (configurationOverride) { // Preserve the name property since it's immutable const pluginName = pluginConfigEntry.name; @@ -1879,8 +1878,8 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo } } - protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined): void { - this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths, pluginConfigOverrides); + protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void { + this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths); } private enableProxy(pluginModuleFactory: PluginModuleFactory, configEntry: PluginImport) { @@ -2170,7 +2169,6 @@ export class InferredProject extends Project { watchOptions: WatchOptions | undefined, projectRootPath: NormalizedPath | undefined, currentDirectory: string, - pluginConfigOverrides: Map | undefined, typeAcquisition: TypeAcquisition | undefined) { super(projectService.newInferredProjectName(), ProjectKind.Inferred, @@ -2189,7 +2187,7 @@ export class InferredProject extends Project { if (!projectRootPath && !projectService.useSingleInferredProject) { this.canonicalCurrentDirectory = projectService.toCanonicalFileName(this.currentDirectory); } - this.enableGlobalPlugins(this.getCompilerOptions(), pluginConfigOverrides); + this.enableGlobalPlugins(this.getCompilerOptions()); } override addRoot(info: ScriptInfo) { @@ -2707,7 +2705,7 @@ export class ConfiguredProject extends Project { } /** @internal */ - enablePluginsWithOptions(options: CompilerOptions, pluginConfigOverrides: Map | undefined): void { + enablePluginsWithOptions(options: CompilerOptions): void { this.plugins.length = 0; if (!options.plugins?.length && !this.projectService.globalPlugins.length) return; const host = this.projectService.host; @@ -2726,11 +2724,11 @@ export class ConfiguredProject extends Project { // Enable tsconfig-specified plugins if (options.plugins) { for (const pluginConfigEntry of options.plugins) { - this.enablePlugin(pluginConfigEntry, searchPaths, pluginConfigOverrides); + this.enablePlugin(pluginConfigEntry, searchPaths); } } - return this.enableGlobalPlugins(options, pluginConfigOverrides); + return this.enableGlobalPlugins(options); } /** @@ -2862,7 +2860,6 @@ export class ExternalProject extends Project { lastFileExceededProgramSize: string | undefined, public override compileOnSaveEnabled: boolean, projectFilePath?: string, - pluginConfigOverrides?: Map, watchOptions?: WatchOptions) { super(externalProjectName, ProjectKind.External, @@ -2875,7 +2872,7 @@ export class ExternalProject extends Project { watchOptions, projectService.host, getDirectoryPath(projectFilePath || normalizeSlashes(externalProjectName))); - this.enableGlobalPlugins(this.getCompilerOptions(), pluginConfigOverrides); + this.enableGlobalPlugins(this.getCompilerOptions()); } override updateGraph() { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 4bf70d659b1ff..15ae16ee27f81 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3328,8 +3328,8 @@ declare namespace ts { setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void; getTypeAcquisition(): ts.TypeAcquisition; protected removeRoot(info: ScriptInfo): void; - protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map | undefined): void; - protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map | undefined): void; + protected enableGlobalPlugins(options: CompilerOptions): void; + protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[]): void; private enableProxy; /** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */ refreshDiagnostics(): void; @@ -3631,7 +3631,6 @@ declare namespace ts { readonly globalPlugins: readonly string[]; readonly pluginProbeLocations: readonly string[]; readonly allowLocalPluginLoads: boolean; - private currentPluginConfigOverrides; readonly typesMapLocation: string | undefined; readonly serverMode: LanguageServiceMode; /** Tracks projects that we have already sent telemetry for. */ From 9436c077946599825db94f8092461b19af35ec66 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 10 Oct 2022 10:31:22 -0700 Subject: [PATCH 05/13] More refactoring --- src/compiler/sys.ts | 34 +++++-- src/server/editorServices.ts | 15 ++- src/server/project.ts | 92 ++++++------------- .../reference/api/tsserverlibrary.d.ts | 2 +- 4 files changed, 68 insertions(+), 75 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 24097099c4792..9d3e6d9e89344 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -35,6 +35,7 @@ import { orderedRemoveItem, Path, perfLogger, + PluginImport, PollingWatchKind, resolveJSModule, some, @@ -883,16 +884,33 @@ function createFsWatchCallbackForDirectoryWatcherCallback( } /** @internal */ -export function resolveModule(moduleName: string, initialDir: string, host: Pick, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined { - const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules"))); - log(`Loading ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`); - const result = host.require!(resolvedPath, moduleName); // TODO: GH#18217 - if (result.error) { +export interface ImportPluginResult { + pluginConfigEntry: PluginImport; + resolvedModule: T | undefined; + errorLogs: string[] | undefined; +} +/** @internal */ +export function resolveModule( + pluginConfigEntry: PluginImport, + searchPaths: string[], + host: Pick, + log: (message: string) => void, +): ImportPluginResult { + Debug.assertIsDefined(host.require); + let errorLogs: string[] | undefined; + let resolvedModule: T | undefined; + for (const initialDir of searchPaths) { + const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules"))); + log(`Loading ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`); + const result = host.require(resolvedPath, pluginConfigEntry.name); // TODO: GH#18217 + if (!result.error) { + resolvedModule = result.module as T; + break; + } const err = result.error.stack || result.error.message || JSON.stringify(result.error); - (logErrors || log)(`Failed to load module '${moduleName}' from ${resolvedPath}: ${err}`); - return undefined; + (errorLogs ??= []).push(`Failed to load module '${pluginConfigEntry.name}' from ${resolvedPath}: ${err}`); } - return result.module; + return { pluginConfigEntry, resolvedModule, errorLogs }; } /** @internal */ diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 375fd28140416..76f471286327d 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -100,6 +100,7 @@ import { removeIgnoredPath, removeMinAndVersionNumbers, ResolvedProjectReference, + resolveModule, resolveProjectReferencePath, returnNoopFileWatcher, returnTrue, @@ -4257,7 +4258,12 @@ export class ProjectService { // If the host supports dynamic import, begin enabling the plugin asynchronously. if (this.host.importPlugin) { - const importPromise = project.beginEnablePluginAsync(pluginConfigEntry, searchPaths); + const importPromise: Promise = Project.importServicePluginAsync( + pluginConfigEntry, + searchPaths, + this.host, + s => this.logger.info(s), + ); this.pendingPluginEnablements ??= new Map(); let promises = this.pendingPluginEnablements.get(project); if (!promises) this.pendingPluginEnablements.set(project, promises = []); @@ -4266,7 +4272,12 @@ export class ProjectService { } // Otherwise, load the plugin using `require` - project.endEnablePlugin(project.beginEnablePluginSync(pluginConfigEntry, searchPaths)); + project.endEnablePlugin(resolveModule( + pluginConfigEntry, + searchPaths, + this.host, + s => this.logger.info(s), + )); } /** @internal */ diff --git a/src/server/project.ts b/src/server/project.ts index d0b1448fd0476..6e641c80d779f 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -38,7 +38,6 @@ import { FileWatcherCallback, FileWatcherEventKind, filter, - firstDefined, flatMap, forEach, forEachEntry, @@ -60,6 +59,7 @@ import { getStringComparer, HasInvalidatedResolutions, HostCancellationToken, + ImportPluginResult, inferredTypesContainingFile, InstallPackageOptions, IScriptSnapshot, @@ -253,11 +253,7 @@ export interface PluginModuleWithName { export type PluginModuleFactory = (mod: { typescript: typeof ts }) => PluginModule; /** @internal */ -export interface BeginEnablePluginResult { - pluginConfigEntry: PluginImport; - resolvedModule: PluginModuleFactory | undefined; - errorLogs: string[] | undefined; -} +export type BeginEnablePluginResult = ImportPluginResult; /** * The project root can be script info - if root is present, @@ -394,28 +390,38 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo return hasOneOrMoreJsAndNoTsFiles(this); } - public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined { - return resolveModule(moduleName, initialDir, host, log, logErrors); + public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined { + return resolveModule({ name: moduleName }, [initialDir], host, log).resolvedModule; } /** @internal */ - public static async importServicePluginAsync(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): Promise<{} | undefined> { + public static async importServicePluginAsync( + pluginConfigEntry: PluginImport, + searchPaths: string[], + host: ServerHost, + log: (message: string) => void, + ): Promise> { Debug.assertIsDefined(host.importPlugin); - const resolvedPath = combinePaths(initialDir, "node_modules"); - log(`Dynamically importing ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`); - let result: ModuleImportResult; - try { - result = await host.importPlugin(resolvedPath, moduleName); - } - catch (e) { - result = { module: undefined, error: e }; - } - if (result.error) { + let errorLogs: string[] | undefined; + let resolvedModule: T | undefined; + for (const initialDir of searchPaths) { + const resolvedPath = combinePaths(initialDir, "node_modules"); + log(`Dynamically importing ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`); + let result: ModuleImportResult; + try { + result = await host.importPlugin(resolvedPath, pluginConfigEntry.name); + } + catch (e) { + result = { module: undefined, error: e }; + } + if (!result.error) { + resolvedModule = result.module as T; + break; + } const err = result.error.stack || result.error.message || JSON.stringify(result.error); - (logErrors || log)(`Failed to dynamically import module '${moduleName}' from ${resolvedPath}: ${err}`); - return undefined; + (errorLogs ??= []).push(`Failed to dynamically import module '${pluginConfigEntry.name}' from ${resolvedPath}: ${err}`); } - return result.module; + return { pluginConfigEntry, resolvedModule, errorLogs }; } /** @internal */ @@ -1813,48 +1819,6 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo } } - /** - * Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin synchronously using 'require'. - * - * @internal - */ - beginEnablePluginSync(pluginConfigEntry: PluginImport, searchPaths: string[]): BeginEnablePluginResult { - Debug.assertIsDefined(this.projectService.host.require); - - let errorLogs: string[] | undefined; - const log = (message: string) => this.projectService.logger.info(message); - const logError = (message: string) => { - (errorLogs ??= []).push(message); - }; - const resolvedModule = firstDefined(searchPaths, searchPath => - Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError) as PluginModuleFactory | undefined); - return { pluginConfigEntry, resolvedModule, errorLogs }; - } - - /** - * Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin asynchronously using dynamic `import`. - * - * @internal - */ - async beginEnablePluginAsync(pluginConfigEntry: PluginImport, searchPaths: string[]): Promise { - Debug.assertIsDefined(this.projectService.host.importPlugin); - - let errorLogs: string[] | undefined; - const log = (message: string) => this.projectService.logger.info(message); - const logError = (message: string) => { - (errorLogs ??= []).push(message); - }; - - let resolvedModule: PluginModuleFactory | undefined; - for (const searchPath of searchPaths) { - resolvedModule = await Project.importServicePluginAsync(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError) as PluginModuleFactory | undefined; - if (resolvedModule !== undefined) { - break; - } - } - return { pluginConfigEntry, resolvedModule, errorLogs }; - } - /** * Performs the remaining steps of enabling a plugin after its module has been instantiated. * diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 15ae16ee27f81..43bf744a64fab 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3241,7 +3241,7 @@ declare namespace ts { private readonly cancellationToken; isNonTsProject(): boolean; isJsOnlyProject(): boolean; - static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined; + static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined; isKnownTypesPackageName(name: string): boolean; installPackage(options: InstallPackageOptions): Promise; private get typingsCache(); From afc70c732a285eeb162160e3435ac172bd9b85ea Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 8 Nov 2022 14:07:58 -0800 Subject: [PATCH 06/13] watchFactory option --- src/compiler/commandLineParser.ts | 14 + src/compiler/diagnosticMessages.json | 8 + src/compiler/types.ts | 13 +- src/server/editorServices.ts | 12 +- src/server/protocol.ts | 1 + .../unittests/config/commandLineParsing.ts | 4 + .../config/tsconfigParsingWatchOptions.ts | 6 + .../tsbuildWatch/watchEnvironment.ts | 203 ++++++++++ src/testRunner/unittests/tscWatch/helpers.ts | 16 + .../unittests/tscWatch/watchEnvironment.ts | 202 ++++++++++ .../unittests/tsserver/watchEnvironment.ts | 174 +++++++++ .../reference/api/tsserverlibrary.d.ts | 14 +- tests/baselines/reference/api/typescript.d.ts | 13 +- .../errors on invalid watchFactory.js | 9 + .../parseBuildOptions/parse --watchFactory.js | 10 + .../errors on invalid watchFactory.js | 9 + .../parseCommandLine/parse --watchFactory.js | 10 + .../watchFactory/tsconfig.json | 6 + .../different options with json api.js | 39 ++ ...fferent options with jsonSourceFile api.js | 42 +++ .../watchFactory/in-config-file-object.js | 151 ++++++++ .../in-config-file-with-error-object.js | 108 ++++++ .../watchFactory/in-config-file-with-error.js | 108 ++++++ .../watchFactory/in-config-file.js | 151 ++++++++ .../through-commandline-object.js | 151 ++++++++ .../through-commandline-with-error-object.js | 33 ++ .../through-commandline-with-error.js | 33 ++ .../watchFactory/through-commandline.js | 151 ++++++++ ...-host-does-not-implement-require-object.js | 151 ++++++++ .../when-host-does-not-implement-require.js | 151 ++++++++ ...in-does-not-implements-watchFile-object.js | 216 +++++++++++ ...en-plugin-does-not-implements-watchFile.js | 216 +++++++++++ ...n-doesnt-return-factory-function-object.js | 151 ++++++++ ...n-plugin-doesnt-return-factory-function.js | 151 ++++++++ .../when-plugin-not-found-object.js | 151 ++++++++ .../watchFactory/when-plugin-not-found.js | 151 ++++++++ .../watchFactory/in-config-file-object.js | 169 +++++++++ .../in-config-file-with-error-object.js | 179 +++++++++ .../watchFactory/in-config-file-with-error.js | 179 +++++++++ .../watchFactory/in-config-file.js | 169 +++++++++ .../through-commandline-object.js | 169 +++++++++ .../through-commandline-with-error-object.js | 32 ++ .../through-commandline-with-error.js | 32 ++ .../watchFactory/through-commandline.js | 169 +++++++++ ...-host-does-not-implement-require-object.js | 169 +++++++++ .../when-host-does-not-implement-require.js | 169 +++++++++ ...in-does-not-implements-watchFile-object.js | 244 ++++++++++++ ...en-plugin-does-not-implements-watchFile.js | 244 ++++++++++++ ...n-doesnt-return-factory-function-object.js | 169 +++++++++ ...n-plugin-doesnt-return-factory-function.js | 169 +++++++++ .../when-plugin-not-found-object.js | 169 +++++++++ .../watchFactory/when-plugin-not-found.js | 169 +++++++++ ...on-of-host-allowLocalPluginLoads-object.js | 210 +++++++++++ ...iguration-of-host-allowLocalPluginLoads.js | 210 +++++++++++ ...Factory-as-configuration-of-host-object.js | 210 +++++++++++ ...onfiguration-of-host-with-errors-object.js | 165 ++++++++ ...ry-as-configuration-of-host-with-errors.js | 165 ++++++++ ...inOverride-allowLocalPluginLoads-object.js | 232 ++++++++++++ ...th-pluginOverride-allowLocalPluginLoads.js | 232 ++++++++++++ ...tion-of-host-with-pluginOverride-object.js | 232 ++++++++++++ ...nfiguration-of-host-with-pluginOverride.js | 232 ++++++++++++ .../watchFactory-as-configuration-of-host.js | 210 +++++++++++ ...on-of-host-allowLocalPluginLoads-object.js | 313 +++++++++++++++ ...iguration-of-host-allowLocalPluginLoads.js | 313 +++++++++++++++ ...as-well-as-configuration-of-host-object.js | 313 +++++++++++++++ ...inOverride-allowLocalPluginLoads-object.js | 357 ++++++++++++++++++ ...th-pluginOverride-allowLocalPluginLoads.js | 357 ++++++++++++++++++ ...tion-of-host-with-pluginOverride-object.js | 357 ++++++++++++++++++ ...nfiguration-of-host-with-pluginOverride.js | 357 ++++++++++++++++++ ...config-as-well-as-configuration-of-host.js | 313 +++++++++++++++ ...onfig-file-allowLocalPluginLoads-object.js | 223 +++++++++++ ...ry-in-config-file-allowLocalPluginLoads.js | 223 +++++++++++ .../watchFactory-in-config-file-object.js | 223 +++++++++++ ...inOverride-allowLocalPluginLoads-object.js | 245 ++++++++++++ ...th-pluginOverride-allowLocalPluginLoads.js | 245 ++++++++++++ ...-config-file-with-pluginOverride-object.js | 245 ++++++++++++ ...tory-in-config-file-with-pluginOverride.js | 245 ++++++++++++ .../watchFactory-in-config-file.js | 223 +++++++++++ 78 files changed, 12275 insertions(+), 4 deletions(-) create mode 100644 tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory.js create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js create mode 100644 tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 3b2120d258c8c..4ae9d2f6815f2 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -93,6 +93,7 @@ import { ParseConfigHost, ParsedCommandLine, parseJsonText, + parsePackageName, Path, PollingWatchKind, PrefixUnaryExpression, @@ -312,8 +313,21 @@ export const optionsForWatch: CommandLineOption[] = [ category: Diagnostics.Watch_and_Build_Modes, description: Diagnostics.Remove_a_list_of_files_from_the_watch_mode_s_processing, }, + { + name: "watchFactory", + type: "string", + category: Diagnostics.Watch_and_Build_Modes, + description: Diagnostics.Specify_which_factory_to_invoke_watchFile_and_watchDirectory_on, + extraValidation: watchFactoryToDiagnostic + }, ]; +function watchFactoryToDiagnostic(watchFactory: CompilerOptionsValue): [DiagnosticMessage] | undefined { + return parsePackageName(watchFactory as string).rest ? + [Diagnostics.watchFactory_name_can_only_be_a_package_name] : + undefined; +} + /** @internal */ export const commonOptionsWithBuild: CommandLineOption[] = [ { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 804ffeeff8ffa..3666f73db9036 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4333,6 +4333,10 @@ "category": "Error", "code": 5108 }, + "'watchFactory' name can only be a package name.": { + "category": "Error", + "code": 5109 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", @@ -6091,6 +6095,10 @@ "category": "Message", "code": 6718 }, + "Specify which factory to invoke 'watchFile' and 'watchDirectory' on.": { + "category": "Message", + "code": 6719 + }, "Default catch clause variables as 'unknown' instead of 'any'.": { "category": "Message", "code": 6803 diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5013a182d581e..a810fc712e279 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,7 +1,11 @@ +import * as ts from "./_namespaces/ts"; import { BaseNodeFactory, CreateSourceFileOptions, + DirectoryWatcherCallback, EmitHelperFactory, + FileWatcher, + FileWatcherCallback, GetCanonicalFileName, MapLike, ModeAwareCache, @@ -7051,7 +7055,7 @@ export enum PollingWatchKind { FixedChunkSize, } -export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[] | ProjectReference[] | null | undefined; +export type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport | PluginImport[] | ProjectReference[] | null | undefined; export interface CompilerOptions { /** @internal */ all?: boolean; @@ -7202,6 +7206,12 @@ export interface CompilerOptions { [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } +export type UserWatchFactoryModule = (mod: { typescript: typeof ts, options: WatchOptions, config: any }) => UserWatchFactory; +export interface UserWatchFactory { + watchFile?(fileName: string, callback: FileWatcherCallback, pollingInterval: number, options: WatchOptions | undefined): FileWatcher; + watchDirectory?(fileName: string, callback: DirectoryWatcherCallback, recursive: boolean, options: WatchOptions | undefined): FileWatcher; + onConfigurationChanged?(config: any): void; +} export interface WatchOptions { watchFile?: WatchFileKind; watchDirectory?: WatchDirectoryKind; @@ -7209,6 +7219,7 @@ export interface WatchOptions { synchronousWatchDirectory?: boolean; excludeDirectories?: string[]; excludeFiles?: string[]; + watchFactory?: string | PluginImport; [option: string]: CompilerOptionsValue | undefined; } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 76f471286327d..35ba0bac9ed30 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -46,6 +46,7 @@ import { forEachKey, forEachResolvedProjectReference, FormatCodeSettings, + formatDiagnostics, getAnyExtensionFromPath, getBaseFileName, getDefaultFormatCodeSettings, @@ -3224,8 +3225,17 @@ export class ProjectService { } if (args.watchOptions) { - this.hostConfiguration.watchOptions = convertWatchOptions(args.watchOptions)?.watchOptions; + const result = convertWatchOptions(args.watchOptions); + this.hostConfiguration.watchOptions = result?.watchOptions; this.logger.info(`Host watch options changed to ${JSON.stringify(this.hostConfiguration.watchOptions)}, it will be take effect for next watches.`); + if (result?.errors?.length) { + this.logger.info(`Watch options supplied had errors: Supplied options: ${JSON.stringify(args.watchOptions)}`); + this.logger.info(`Diagnostics:: ${formatDiagnostics(result.errors, { + getCurrentDirectory: () => this.host.getCurrentDirectory(), + getNewLine: () => this.host.newLine, + getCanonicalFileName: createGetCanonicalFileName(this.host.useCaseSensitiveFileNames), + })}`); + } } } } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 819c4797084fc..19d428354650c 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1600,6 +1600,7 @@ export interface WatchOptions { synchronousWatchDirectory?: boolean; excludeDirectories?: string[]; excludeFiles?: string[]; + watchFactory?: string | PluginImport; [option: string]: CompilerOptionsValue | undefined; } diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 33a6ad5c24db9..b62c282ffc9fd 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -189,6 +189,8 @@ describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => { assertParseResult("errors on invalid excludeDirectories", ["--excludeDirectories", "**/../*", "0.ts"]); assertParseResult("parse --excludeFiles", ["--excludeFiles", "**/temp/*.ts", "0.ts"]); assertParseResult("errors on invalid excludeFiles", ["--excludeFiles", "**/../*", "0.ts"]); + assertParseResult("parse --watchFactory", ["--watchFactory", "somefactory", "0.ts"]); + assertParseResult("errors on invalid watchFactory", ["--watchFactory", "somefactory/../malicious", "0.ts"]); }); }); @@ -243,6 +245,8 @@ describe("unittests:: config:: commandLineParsing:: parseBuildOptions", () => { assertParseResult("errors on invalid excludeDirectories", ["--excludeDirectories", "**/../*"]); assertParseResult("parse --excludeFiles", ["--excludeFiles", "**/temp/*.ts"]); assertParseResult("errors on invalid excludeFiles", ["--excludeFiles", "**/../*"]); + assertParseResult("parse --watchFactory", ["--watchFactory", "somefactory"]); + assertParseResult("errors on invalid watchFactory", ["--watchFactory", "somefactory/../malicious"]); }); }); diff --git a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts index e87053dd5f546..f324350719c44 100644 --- a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts +++ b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts @@ -121,6 +121,12 @@ describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileText { json: { watchOptions: { excludeFiles: ["**/../*"] } }, }, + { + json: { watchOptions: { watchFactory: "somefactory" } }, + }, + { + json: { watchOptions: { watchFactory: "somefactory/../malicious" } }, + }, ]); verifyWatchOptions("watch options extending passed in watch options", () => [ diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 792a1f9ff4850..8d564ca599a2f 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -2,7 +2,11 @@ import * as ts from "../../_namespaces/ts"; import { createBaseline, createSolutionBuilderWithWatchHostForBaseline, + createWatchFactorySystem, + implementRequireForWatchFactorySystem, runWatchBaseline, + VerifyTscWatch, + verifyTscWatch, } from "../tscWatch/helpers"; import { createWatchedSystem, @@ -119,4 +123,203 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi })); } }); + + describe("watchFactory", () => { + verifyWatchFactory({ + subScenario: `watchFactory/in config file`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: createSystemWithFactory, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + // timeouts: sys => sys.runQueuedTimeoutCallbacks(), + // }, + // { + // caption: "Invoke plugin watches", + // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/in config file with error`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: createSystemWithFactory, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin/../malicious"); + + verifyWatchFactoryCommandLine({ + subScenario: `watchFactory/through commandline`, + sys: () => createSystemWithFactory(), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + // timeouts: sys => sys.runQueuedTimeoutCallbacks(), + // }, + // { + // caption: "Invoke plugin watches", + // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactoryCommandLine({ + subScenario: `watchFactory/through commandline with error`, + sys: () => { + // Patch to not throw exception so the tests can run and baseline + const sys = createSystem(); + sys.exit = exitCode => sys.exitCode = exitCode; + return sys; + }, + }, "myplugin/../malicious"); + + verifyWatchFactory({ + subScenario: `watchFactory/when plugin not found`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: watchOptions => { + const system = createSystem(watchOptions); + system.require = (initialPath, moduleName) => { + system.write(`Require:: Resolving ${moduleName} from ${initialPath}\n`); + return { + module: undefined, + error: { message: `Cannot find module myPlugin at ${initialPath}` } + }; + }; + return system; + }, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/when plugin does not implements watchFile`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: watchOptions => createSystemWithFactory(watchOptions, /*excludeWatchFile*/ true), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Add file", + edit: sys => sys.writeFile(`/user/username/projects/myproject/c.ts`, "export function foo() { }"), + // timeouts: sys => sys.runQueuedTimeoutCallbacks(), + // }, + // { + // caption: "Invoke plugin watches", + // edit: sys => (sys as WatchFactorySystem).factoryData.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/when plugin doesnt return factory function`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: watchOptions => { + const system = createSystem(watchOptions); + system.require = (initialPath, moduleName) => { + system.write(`Require:: Resolving ${moduleName} from ${initialPath}\n`); + return { + module: { watchDirectory: system.factoryData.watchDirectory }, + error: undefined + }; + }; + return system; + }, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/when host does not implement require`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: createSystem, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + function createSystem(watchOptions?: ts.WatchOptions) { + const configFile: File = { + path: `/user/username/projects/myproject/tsconfig.json`, + content: JSON.stringify({ watchOptions }) + }; + const aTs: File = { + path: `/user/username/projects/myproject/a.ts`, + content: `export class a { prop = "hello"; foo() { return this.prop; } }` + }; + const bTs: File = { + path: `/user/username/projects/myproject/b.ts`, + content: `export class b { prop = "hello"; foo() { return this.prop; } }` + }; + + return createWatchFactorySystem(createWatchedSystem([aTs, bTs, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" })); + } + + function createSystemWithFactory(watchOptions?: ts.WatchOptions, excludeWatchFile?: boolean) { + return implementRequireForWatchFactorySystem(createSystem(watchOptions), !!excludeWatchFile); + } + + function verifyWatchFactory( + input: Omit & { sys: (watchOptions?: ts.WatchOptions) => TestServerHost; }, + watchFactory: string, + ) { + verifyTscWatch({ + scenario: "watchEnvironment", + ...input, + sys: () => input.sys({ watchFactory }), + }); + verifyTscWatch({ + scenario: "watchEnvironment", + ...input, + subScenario: `${input.subScenario} object`, + sys: () => input.sys({ watchFactory }), + // sys: () => input.sys({ watchFactory: { name: watchFactory, myconfig: "somethingelse" } as ts.PluginImport }), + }); + } + + function verifyWatchFactoryCommandLine( + input: Omit, + watchFactory: string, + ) { + verifyTscWatch({ + scenario: "watchEnvironment", + ...input, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", watchFactory], + }); + verifyTscWatch({ + scenario: "watchEnvironment", + ...input, + subScenario: `${input.subScenario} object`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", watchFactory], + // commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], + }); + } + }); }); diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 2fa3c46789b13..4ca728aad51b2 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -391,4 +391,20 @@ export function createWatchFactorySystem(inputSystem: TestServerHost, log: (s: s serializedWatchedDirectoriesRecursive = serializeMultiMap(baseline, `${pluginName || ""}Plugin WatchedDirectories`, watchedDirectories, serializedWatchedDirectoriesRecursive); return baseline; } +} + +export function implementRequireForWatchFactorySystem(system: WatchFactorySystem, excludeWatchFile: boolean) { + system.require = (initialPath, moduleName) => { + system.write(`Require:: Resolving ${moduleName} from ${initialPath}\n`); + return { + module: (({ options, config }) => { + system.write(`Require:: Module ${moduleName} created with config: ${JSON.stringify(config)} and options: ${JSON.stringify(options)}\n`); + return !excludeWatchFile ? + system.factoryData : + { watchDirectory: system.factoryData.watchDirectory }; + }) as ts.UserWatchFactoryModule, + error: undefined + }; + }; + return system; } \ No newline at end of file diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index 3d3506b248355..b8906a89bec8b 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -11,7 +11,10 @@ import { import { commonFile1, commonFile2, + createWatchFactorySystem, + implementRequireForWatchFactorySystem, noopChange, + VerifyTscWatch, verifyTscWatch, } from "./helpers"; @@ -710,4 +713,203 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po } ] }); + + describe("watchFactory", () => { + verifyWatchFactory({ + subScenario: `watchFactory/in config file`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: createSystemWithFactory, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + // timeouts: sys => sys.runQueuedTimeoutCallbacks(), + // }, + // { + // caption: "Invoke plugin watches", + // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/in config file with error`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: createSystemWithFactory, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin/../malicious"); + + verifyWatchFactoryCommandLine({ + subScenario: `watchFactory/through commandline`, + sys: () => createSystemWithFactory(), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + // timeouts: sys => sys.runQueuedTimeoutCallbacks(), + // }, + // { + // caption: "Invoke plugin watches", + // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactoryCommandLine({ + subScenario: `watchFactory/through commandline with error`, + sys: () => { + // Patch to not throw exception so the tests can run and baseline + const sys = createSystem(); + sys.exit = exitCode => sys.exitCode = exitCode; + return sys; + }, + }, "myplugin/../malicious"); + + verifyWatchFactory({ + subScenario: `watchFactory/when plugin not found`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: watchOptions => { + const system = createSystem(watchOptions); + system.require = (initialPath, moduleName) => { + system.write(`Require:: Resolving ${moduleName} from ${initialPath}\n`); + return { + module: undefined, + error: { message: `Cannot find module myPlugin at ${initialPath}` } + }; + }; + return system; + }, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/when plugin does not implements watchFile`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: watchOptions => createSystemWithFactory(watchOptions, /*excludeWatchFile*/ true), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Add file", + edit: sys => sys.writeFile(`/user/username/projects/myproject/c.ts`, "export function foo() { }"), + // timeouts: sys => sys.runQueuedTimeoutCallbacks(), + // }, + // { + // caption: "Invoke plugin watches", + // edit: sys => (sys as WatchFactorySystem).factoryData.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/when plugin doesnt return factory function`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: watchOptions => { + const system = createSystem(watchOptions); + system.require = (initialPath, moduleName) => { + system.write(`Require:: Resolving ${moduleName} from ${initialPath}\n`); + return { + module: { watchDirectory: system.factoryData.watchDirectory }, + error: undefined + }; + }; + return system; + }, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/when host does not implement require`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: createSystem, + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + function createSystem(watchOptions?: ts.WatchOptions) { + const configFile: File = { + path: `/user/username/projects/myproject/tsconfig.json`, + content: JSON.stringify({ watchOptions }) + }; + const aTs: File = { + path: `/user/username/projects/myproject/a.ts`, + content: `export class a { prop = "hello"; foo() { return this.prop; } }` + }; + const bTs: File = { + path: `/user/username/projects/myproject/b.ts`, + content: `export class b { prop = "hello"; foo() { return this.prop; } }` + }; + + return createWatchFactorySystem(createWatchedSystem([aTs, bTs, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" })); + } + + function createSystemWithFactory(watchOptions?: ts.WatchOptions, excludeWatchFile?: boolean) { + return implementRequireForWatchFactorySystem(createSystem(watchOptions), !!excludeWatchFile); + } + + function verifyWatchFactory( + input: Omit & { sys: (watchOptions?: ts.WatchOptions) => TestServerHost; }, + watchFactory: string, + ) { + verifyTscWatch({ + scenario, + ...input, + sys: () => input.sys({ watchFactory }), + }); + verifyTscWatch({ + scenario, + ...input, + subScenario: `${input.subScenario} object`, + sys: () => input.sys({ watchFactory }), + // sys: () => input.sys({ watchFactory: { name: watchFactory, myconfig: "somethingelse" } as ts.PluginImport }), + }); + } + + function verifyWatchFactoryCommandLine( + input: Omit, + watchFactory: string, + ) { + verifyTscWatch({ + scenario, + ...input, + commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", watchFactory], + }); + verifyTscWatch({ + scenario, + ...input, + subScenario: `${input.subScenario} object`, + commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", watchFactory], + // commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], + }); + } + }); }); diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index cf41c5d4f159d..03f618c032385 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -3,6 +3,7 @@ import { commonFile1, commonFile2, createWatchFactorySystem, + WatchFactorySystem, } from "../tscWatch/helpers"; import { createServerHost, @@ -535,6 +536,131 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { baselineTsserverLogs("watchEnvironment", "plugin overriding watch", session); }); + function verifyWatchFactory(pluginOverride: boolean, allowLocalPluginLoads: boolean, useObject: boolean) { + it(scenarioName("watchFactory in config file", pluginOverride, allowLocalPluginLoads, useObject), () => { + const { host, session, plugin, aTs } = createHostForPlugins( + { allowLocalPluginLoads }, + { watchFactory: getWatchFactory("myplugin", useObject) } + ); + host.require = requireReturningWatchFactory(session, plugin); + if (pluginOverride) configurePlugin(session, "myplugin", { init: "initialConfig" }); + openFilesForSession([aTs], session); + + // Add c.ts + session.logger.log("Add a file"); + host.writeFile(`/user/username/projects/myproject/c.ts`, aTs.content); + // Since we have overriden watch, this shouldnt do anything + host.runQueuedTimeoutCallbacks(); + + // // Actually invoke watches + // session.logger.log("Invoke plugin watches"); + // plugin.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)); + // Host should have updates queued + host.runQueuedTimeoutCallbacks(); + + // Configuration changed + configurePlugin(session, "myplugin"); + configurePlugin(session, "randomplugin"); + + baselineTsserverLogs("watchEnvironment", scenarioName("watchFactory in config file", pluginOverride, allowLocalPluginLoads, useObject), session); + }); + + it(scenarioName("watchFactory as configuration of host", pluginOverride, allowLocalPluginLoads, useObject), () => { + const { host, session, plugin, aTs, bTs, } = createHostForPlugins({ allowLocalPluginLoads }); + host.require = requireReturningWatchFactory(session, plugin); + configureGlobalWatchOptions(session, "myplugin", useObject); + if (pluginOverride) configurePlugin(session, "myplugin", { init: "initialConfig" }); + openFilesForSession([aTs], session); + + // Change b.ts + session.logger.log("Change file"); + host.writeFile(bTs.path, aTs.content); + // Since we have overriden watch, this shouldnt do anything + host.runQueuedTimeoutCallbacks(); + + // // Actually invoke watches + // session.logger.log("Invoke plugin watches"); + // plugin.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); + // Host should have updates queued + host.runQueuedTimeoutCallbacks(); + + // Configuration changed + configurePlugin(session, "myplugin"); + configurePlugin(session, "randomplugin"); + + baselineTsserverLogs("watchEnvironment", scenarioName("watchFactory as configuration of host", pluginOverride, allowLocalPluginLoads, useObject), session); + }); + + it(scenarioName("watchFactory in config as well as configuration of host", pluginOverride, allowLocalPluginLoads, useObject), () => { + const { host, session, plugin, aTs, bTs, } = createHostForPlugins( + { allowLocalPluginLoads }, + { watchFactory: getWatchFactory("myplugin", useObject) } + ); + const plugin2 = createFactoryFunctions(session, "myplugin2"); + host.require = requireReturningWatchFactory(session, plugin, plugin2); + configureGlobalWatchOptions(session, "myplugin2", useObject); + if (pluginOverride) { + configurePlugin(session, "myplugin", { init: "initialConfig" }); + configurePlugin(session, "myplugin2", { init2: "initialConfig2" }); + } + openFilesForSession([aTs], session); + + // Add c.ts + session.logger.log("Add a file"); + host.writeFile(`/user/username/projects/myproject/c.ts`, aTs.content); + // Since we have overriden watch, this shouldnt do anything + host.runQueuedTimeoutCallbacks(); + + // // Actually invoke watches + // session.logger.log("Invoke plugin watches"); + // plugin.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)); + // Host should have updates queued + host.runQueuedTimeoutCallbacks(); + + // Change b.ts + session.logger.log("Change file"); + host.writeFile(bTs.path, aTs.content); + // Since we have overriden watch, this shouldnt do anything + host.runQueuedTimeoutCallbacks(); + + // // Actually invoke watches + // session.logger.log("Invoke plugin watches"); + // plugin2.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); + // Host should have updates queued + host.runQueuedTimeoutCallbacks(); + + // Configuration changed + configurePlugin(session, "myplugin"); + configurePlugin(session, "myplugin2"); + configurePlugin(session, "randomplugin"); + + baselineTsserverLogs("watchEnvironment", scenarioName("watchFactory in config as well as configuration of host", pluginOverride, allowLocalPluginLoads, useObject), session); + }); + + if (allowLocalPluginLoads || pluginOverride) return; + it(scenarioName("watchFactory as configuration of host with errors", pluginOverride, allowLocalPluginLoads, useObject), () => { + const { host, session, aTs, bTs, } = createHostForPlugins(); + host.require = ts.notImplemented; // Should throw if called + configureGlobalWatchOptions(session, "myplugin/../malicious", useObject); + openFilesForSession([aTs], session); + + // Change b.ts + session.logger.log("Change file"); + host.writeFile(bTs.path, aTs.content); + host.runQueuedTimeoutCallbacks(); + + baselineTsserverLogs("watchEnvironment", scenarioName("watchFactory as configuration of host with errors", pluginOverride, allowLocalPluginLoads, useObject), session); + }); + } + verifyWatchFactory(/*pluginOverride*/ false, /*allowLocalPluginLoads*/ false, /*useObject*/ false); + verifyWatchFactory(/*pluginOverride*/ false, /*allowLocalPluginLoads*/ true, /*useObject*/ false); + verifyWatchFactory(/*pluginOverride*/ false, /*allowLocalPluginLoads*/ false, /*useObject*/ true); + verifyWatchFactory(/*pluginOverride*/ false, /*allowLocalPluginLoads*/ true, /*useObject*/ true); + verifyWatchFactory(/*pluginOverride*/ true, /*allowLocalPluginLoads*/ false, /*useObject*/ false); + verifyWatchFactory(/*pluginOverride*/ true, /*allowLocalPluginLoads*/ true, /*useObject*/ false); + verifyWatchFactory(/*pluginOverride*/ true, /*allowLocalPluginLoads*/ false, /*useObject*/ true); + verifyWatchFactory(/*pluginOverride*/ true, /*allowLocalPluginLoads*/ true, /*useObject*/ true); + function createHostForPlugins(opts?: Partial, watchOptions?: ts.WatchOptions) { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, @@ -560,4 +686,52 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { function createFactoryFunctions(session: TestSession, pluginName?: string) { return createWatchFactorySystem(session.testhost, s => session.logger.log(s), pluginName).factoryData; } + + function scenarioName(scenario: string, pluginOverride: boolean, allowLocalPluginLoads: boolean, useObject: boolean) { + return `${scenario}${pluginOverride ? " with pluginOverride" : ""}${allowLocalPluginLoads ? " allowLocalPluginLoads" : ""}${useObject ? " object" : ""}`; + } + + interface PluginImport extends ts.PluginImport { + myconfig: "somethingelse"; + } + function getWatchFactory(watchFactory: string, _useObject: boolean): PluginImport | string { + return watchFactory; + // return useObject ? { name: watchFactory, myconfig: "somethingelse" } : watchFactory; + } + + function configureGlobalWatchOptions(session: TestSession, watchFactory: string, useObject: boolean) { + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.Configure, + arguments: { watchOptions: { watchFactory: getWatchFactory(watchFactory, useObject) } } + }); + } + + function configurePlugin(session: TestSession, pluginName: string, configuration?: any) { + session.executeCommandSeq({ + command: ts.server.protocol.CommandTypes.ConfigurePlugin, + arguments: { + pluginName, + configuration: configuration || { extraData: "myData" } + } + }); + } + + function requireReturningWatchFactory( + session: TestSession, + plugin: WatchFactorySystem["factoryData"], + plugin2?: WatchFactorySystem["factoryData"], + ): ts.System["require"] { + return (initialPath, moduleName) => { + session.logger.log(`CustomRequire:: Resolving ${moduleName} from ${initialPath}`); + return { + module: (({ options, config }) => { + session.logger.log(`Require:: Module ${moduleName} created with config: ${JSON.stringify(config)} and options: ${JSON.stringify(options)}`); + return !plugin2 || moduleName === "myplugin" ? + plugin : + plugin2; + }) as ts.UserWatchFactoryModule, + error: undefined + }; + }; + } }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 43bf744a64fab..de332c539a4a2 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1236,6 +1236,7 @@ declare namespace ts { synchronousWatchDirectory?: boolean; excludeDirectories?: string[]; excludeFiles?: string[]; + watchFactory?: string | PluginImport; [option: string]: CompilerOptionsValue | undefined; } /** @@ -7118,7 +7119,7 @@ declare namespace ts { DynamicPriority = 2, FixedChunkSize = 3 } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[] | ProjectReference[] | null | undefined; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport | PluginImport[] | ProjectReference[] | null | undefined; interface CompilerOptions { allowImportingTsExtensions?: boolean; allowJs?: boolean; @@ -7225,6 +7226,16 @@ declare namespace ts { useDefineForClassFields?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } + type UserWatchFactoryModule = (mod: { + typescript: typeof ts; + options: WatchOptions; + config: any; + }) => UserWatchFactory; + interface UserWatchFactory { + watchFile?(fileName: string, callback: FileWatcherCallback, pollingInterval: number, options: WatchOptions | undefined): FileWatcher; + watchDirectory?(fileName: string, callback: DirectoryWatcherCallback, recursive: boolean, options: WatchOptions | undefined): FileWatcher; + onConfigurationChanged?(config: any): void; + } interface WatchOptions { watchFile?: WatchFileKind; watchDirectory?: WatchDirectoryKind; @@ -7232,6 +7243,7 @@ declare namespace ts { synchronousWatchDirectory?: boolean; excludeDirectories?: string[]; excludeFiles?: string[]; + watchFactory?: string | PluginImport; [option: string]: CompilerOptionsValue | undefined; } interface TypeAcquisition { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 6acc0c5bc906e..1ab053963bef8 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3107,7 +3107,7 @@ declare namespace ts { DynamicPriority = 2, FixedChunkSize = 3 } - type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport[] | ProjectReference[] | null | undefined; + type CompilerOptionsValue = string | number | boolean | (string | number)[] | string[] | MapLike | PluginImport | PluginImport[] | ProjectReference[] | null | undefined; interface CompilerOptions { allowImportingTsExtensions?: boolean; allowJs?: boolean; @@ -3214,6 +3214,16 @@ declare namespace ts { useDefineForClassFields?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } + type UserWatchFactoryModule = (mod: { + typescript: typeof ts; + options: WatchOptions; + config: any; + }) => UserWatchFactory; + interface UserWatchFactory { + watchFile?(fileName: string, callback: FileWatcherCallback, pollingInterval: number, options: WatchOptions | undefined): FileWatcher; + watchDirectory?(fileName: string, callback: DirectoryWatcherCallback, recursive: boolean, options: WatchOptions | undefined): FileWatcher; + onConfigurationChanged?(config: any): void; + } interface WatchOptions { watchFile?: WatchFileKind; watchDirectory?: WatchDirectoryKind; @@ -3221,6 +3231,7 @@ declare namespace ts { synchronousWatchDirectory?: boolean; excludeDirectories?: string[]; excludeFiles?: string[]; + watchFactory?: string | PluginImport; [option: string]: CompilerOptionsValue | undefined; } interface TypeAcquisition { diff --git a/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory.js b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory.js new file mode 100644 index 0000000000000..5204dec29797d --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory.js @@ -0,0 +1,9 @@ +--watchFactory somefactory/../malicious +buildOptions:: +{} +WatchOptions:: +{} +Projects:: +. +Errors:: +error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory.js b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory.js new file mode 100644 index 0000000000000..e347456bb182b --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory.js @@ -0,0 +1,10 @@ +--watchFactory somefactory +buildOptions:: +{} +WatchOptions:: +{ + "watchFactory": "somefactory" +} +Projects:: +. +Errors:: diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory.js new file mode 100644 index 0000000000000..b8fb8bc4e0be5 --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory.js @@ -0,0 +1,9 @@ +--watchFactory somefactory/../malicious 0.ts +CompilerOptions:: +{} +WatchOptions:: +{} +FileNames:: +0.ts +Errors:: +error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory.js new file mode 100644 index 0000000000000..e71412f5e45a7 --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory.js @@ -0,0 +1,10 @@ +--watchFactory somefactory 0.ts +CompilerOptions:: +{} +WatchOptions:: +{ + "watchFactory": "somefactory" +} +FileNames:: +0.ts +Errors:: diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json new file mode 100644 index 0000000000000..ef316c37ec59c --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": {}, + "watchOptions": { + "watchFactory": "someString" + } +} diff --git a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js index 10368b04e7c7f..a4a4be40e9fd7 100644 --- a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js +++ b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js @@ -171,3 +171,42 @@ Result: WatchOptions:: Errors:: error TS5065: File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '**/../*'. + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": "somefactory" + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{ + "watchFactory": "somefactory" +} +Errors:: + + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": "somefactory/../malicious" + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{} +Errors:: +error TS5109: 'watchFactory' name can only be a package name. + diff --git a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js index 7748786348fe6..ecffdf4c90415 100644 --- a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js @@ -177,3 +177,45 @@ Errors:: 4 "**/../*"    ~~~~~~~~~ + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": "somefactory" + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{ + "watchFactory": "somefactory" +} +Errors:: + + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": "somefactory/../malicious" + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{} +Errors:: +tsconfig.json:3:19 - error TS5109: 'watchFactory' name can only be a package name. + +3 "watchFactory": "somefactory/../malicious" +   ~~~~~~~~~~~~~~~~~~~~~~~~~~ + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js new file mode 100644 index 0000000000000..f1219d063d1dc --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js @@ -0,0 +1,108 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin/../malicious"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:24 AM] Found 1 error. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +[12:00:27 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js new file mode 100644 index 0000000000000..f1219d063d1dc --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js @@ -0,0 +1,108 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin/../malicious"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:24 AM] Found 1 error. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +[12:00:27 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js new file mode 100644 index 0000000000000..eeacd88f29f4e --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js new file mode 100644 index 0000000000000..af294142d0cca --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js @@ -0,0 +1,33 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin/../malicious +Output:: +error TS5109: 'watchFactory' name can only be a package name. + + + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js new file mode 100644 index 0000000000000..af294142d0cca --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js @@ -0,0 +1,33 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin/../malicious +Output:: +error TS5109: 'watchFactory' name can only be a package name. + + + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js new file mode 100644 index 0000000000000..eeacd88f29f4e --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js new file mode 100644 index 0000000000000..bcdd10824c18a --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -0,0 +1,216 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + + +Change:: Add file + +Input:: +//// [/user/username/projects/myproject/c.ts] +export function foo() { } + + +Before running Timeout callback:: count: 1 +2: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +[12:00:41 AM] File change detected. Starting incremental compilation... + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +[12:00:46 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/c.ts (computed .d.ts) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/a.ts: + {} +/user/username/projects/myproject/b.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] file changed its modified time +//// [/user/username/projects/myproject/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js new file mode 100644 index 0000000000000..bcdd10824c18a --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js @@ -0,0 +1,216 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + + +Change:: Add file + +Input:: +//// [/user/username/projects/myproject/c.ts] +export function foo() { } + + +Before running Timeout callback:: count: 1 +2: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +[12:00:41 AM] File change detected. Starting incremental compilation... + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +[12:00:46 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/c.ts (computed .d.ts) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/a.ts: + {} +/user/username/projects/myproject/b.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] file changed its modified time +//// [/user/username/projects/myproject/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js new file mode 100644 index 0000000000000..8b0eb3598f310 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js @@ -0,0 +1,151 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +[12:00:29 AM] Found 0 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +[12:00:32 AM] File change detected. Starting incremental compilation... + +[12:00:38 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] file changed its modified time +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js new file mode 100644 index 0000000000000..4de9ca9bc8aa3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js @@ -0,0 +1,179 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin/../malicious"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:35 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js new file mode 100644 index 0000000000000..4de9ca9bc8aa3 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js @@ -0,0 +1,179 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin/../malicious"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. + +1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} +   ~~~~~~~~~~~~~~~~~~~~~~~ + +[12:00:35 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js new file mode 100644 index 0000000000000..cce38f32ddda2 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js new file mode 100644 index 0000000000000..b9b25c21827dd --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js @@ -0,0 +1,32 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin/../malicious +Output:: +error TS5109: 'watchFactory' name can only be a package name. + + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js new file mode 100644 index 0000000000000..b9b25c21827dd --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js @@ -0,0 +1,32 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin/../malicious +Output:: +error TS5109: 'watchFactory' name can only be a package name. + + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js new file mode 100644 index 0000000000000..cce38f32ddda2 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js new file mode 100644 index 0000000000000..047d929544a25 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -0,0 +1,244 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + + +Change:: Add file + +Input:: +//// [/user/username/projects/myproject/c.ts] +export function foo() { } + + +Before running Timeout callback:: count: 1 +2: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Scheduling update +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Reloading new file names and options +Synchronizing program +[12:00:38 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +[12:00:41 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/c.ts (computed .d.ts) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/a.ts: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js new file mode 100644 index 0000000000000..047d929544a25 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js @@ -0,0 +1,244 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + + +Change:: Add file + +Input:: +//// [/user/username/projects/myproject/c.ts] +export function foo() { } + + +Before running Timeout callback:: count: 1 +2: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Scheduling update +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Reloading new file names and options +Synchronizing program +[12:00:38 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +[12:00:41 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts +/user/username/projects/myproject/c.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/c.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/c.ts (computed .d.ts) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/a.ts: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/c.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = void 0; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js new file mode 100644 index 0000000000000..6f0a9e1508ee4 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js @@ -0,0 +1,169 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +[12:00:28 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:00:35 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js new file mode 100644 index 0000000000000..f60b597a26f0d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -0,0 +1,210 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js new file mode 100644 index 0000000000000..f60b597a26f0d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js @@ -0,0 +1,210 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js new file mode 100644 index 0000000000000..f60b597a26f0d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js @@ -0,0 +1,210 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js new file mode 100644 index 0000000000000..528e0903ebca8 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js @@ -0,0 +1,165 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin/../malicious" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Watch options supplied had errors: Supplied options: {"watchFactory":"myplugin/../malicious"} +Info seq [hh:mm:ss:mss] Diagnostics:: error TS5109: 'watchFactory' name can only be a package name. + +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors.js new file mode 100644 index 0000000000000..528e0903ebca8 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors.js @@ -0,0 +1,165 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin/../malicious" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Watch options supplied had errors: Supplied options: {"watchFactory":"myplugin/../malicious"} +Info seq [hh:mm:ss:mss] Diagnostics:: error TS5109: 'watchFactory' name can only be a package name. + +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js new file mode 100644 index 0000000000000..e50d5dda95bbc --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -0,0 +1,232 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js new file mode 100644 index 0000000000000..e50d5dda95bbc --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -0,0 +1,232 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js new file mode 100644 index 0000000000000..e50d5dda95bbc --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js @@ -0,0 +1,232 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js new file mode 100644 index 0000000000000..e50d5dda95bbc --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js @@ -0,0 +1,232 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js new file mode 100644 index 0000000000000..f60b597a26f0d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js @@ -0,0 +1,210 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + } +} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js new file mode 100644 index 0000000000000..b58c96ba559fe --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -0,0 +1,313 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js new file mode 100644 index 0000000000000..b58c96ba559fe --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js @@ -0,0 +1,313 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js new file mode 100644 index 0000000000000..b58c96ba559fe --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js @@ -0,0 +1,313 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js new file mode 100644 index 0000000000000..cb9b0f411045d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -0,0 +1,357 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "init2": "initialConfig2" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 6, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 7, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":7,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js new file mode 100644 index 0000000000000..cb9b0f411045d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -0,0 +1,357 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "init2": "initialConfig2" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 6, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 7, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":7,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js new file mode 100644 index 0000000000000..cb9b0f411045d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js @@ -0,0 +1,357 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "init2": "initialConfig2" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 6, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 7, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":7,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js new file mode 100644 index 0000000000000..cb9b0f411045d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js @@ -0,0 +1,357 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "init2": "initialConfig2" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 6, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 7, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":7,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js new file mode 100644 index 0000000000000..b58c96ba559fe --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js @@ -0,0 +1,313 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configure", + "arguments": { + "watchOptions": { + "watchFactory": "myplugin2" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Change file +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Before running Timeout callback:: count: 2 +3: /user/username/projects/myproject/tsconfig.json +4: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 3 structureChanged: false structureIsReused:: Completely Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-2 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin2", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 5, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js new file mode 100644 index 0000000000000..27fc2e8bcd32d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js @@ -0,0 +1,223 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js new file mode 100644 index 0000000000000..27fc2e8bcd32d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js @@ -0,0 +1,223 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js new file mode 100644 index 0000000000000..27fc2e8bcd32d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js @@ -0,0 +1,223 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js new file mode 100644 index 0000000000000..e5b0750883a03 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js @@ -0,0 +1,245 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js new file mode 100644 index 0000000000000..e5b0750883a03 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js @@ -0,0 +1,245 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js new file mode 100644 index 0000000000000..e5b0750883a03 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js @@ -0,0 +1,245 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js new file mode 100644 index 0000000000000..e5b0750883a03 --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js @@ -0,0 +1,245 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "init": "initialConfig" + } + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":1,"success":true} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 4, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js new file mode 100644 index 0000000000000..27fc2e8bcd32d --- /dev/null +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js @@ -0,0 +1,223 @@ +currentDirectory:: / useCaseSensitiveFileNames: false +Info seq [hh:mm:ss:mss] Provided types map file "/a/lib/typesMap.json" doesn't exist +Before request +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +Info seq [hh:mm:ss:mss] request: + { + "command": "open", + "arguments": { + "file": "/user/username/projects/myproject/a.ts" + }, + "seq": 1, + "type": "request" + } +Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject +Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { + "rootNames": [ + "/user/username/projects/myproject/a.ts", + "/user/username/projects/myproject/b.ts" + ], + "options": { + "configFilePath": "/user/username/projects/myproject/tsconfig.json" + }, + "watchOptions": { + "watchFactory": "myplugin" + } +} +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (3) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +Add a file +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Before running Timeout callback:: count: 2 +1: /user/username/projects/myproject/tsconfig.json +2: *ensureProjectForOpenFiles* +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + /a/lib/lib.d.ts Text-1 "/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }" + /user/username/projects/myproject/a.ts SVC-1-0 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/b.ts Text-1 "export class b { prop = \"hello\"; foo() { return this.prop; } }" + /user/username/projects/myproject/c.ts Text-1 "export class a { prop = \"hello\"; foo() { return this.prop; } }" + + + ../../../../a/lib/lib.d.ts + Default library for target 'es5' + a.ts + Matched by default include pattern '**/*' + b.ts + Matched by default include pattern '**/*' + c.ts + Matched by default include pattern '**/*' + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Running: *ensureProjectForOpenFiles* +Info seq [hh:mm:ss:mss] Before ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +Info seq [hh:mm:ss:mss] After ensureProjectForOpenFiles: +Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) +Info seq [hh:mm:ss:mss] Files (4) + +Info seq [hh:mm:ss:mss] ----------------------------------------------- +Info seq [hh:mm:ss:mss] Open files: +Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts ProjectRootPath: undefined +Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json +After running Timeout callback:: count: 0 + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: + {} +/user/username/projects/myproject/b.ts: + {} +/a/lib/lib.d.ts: + {} +/user/username/projects/myproject/c.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: + {} + +Before running Timeout callback:: count: 0 + +After running Timeout callback:: count: 0 + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "myplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 2, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request + +Before request + +Info seq [hh:mm:ss:mss] request: + { + "command": "configurePlugin", + "arguments": { + "pluginName": "randomplugin", + "configuration": { + "extraData": "myData" + } + }, + "seq": 3, + "type": "request" + } +Info seq [hh:mm:ss:mss] response: + {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} +Info seq [hh:mm:ss:mss] response: + { + "responseRequired": false + } +After request From 30335f71156d25b4d82e2d3f0bd8a477b29011eb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 8 Sep 2022 16:17:00 -0700 Subject: [PATCH 07/13] watchFactory implementation --- src/compiler/commandLineParser.ts | 26 +++--- src/compiler/sys.ts | 71 +++++++++++++++- src/compiler/types.ts | 5 +- src/server/editorServices.ts | 24 +++++- src/server/project.ts | 6 ++ .../tsbuildWatch/watchEnvironment.ts | 31 +++---- src/testRunner/unittests/tscWatch/helpers.ts | 4 +- .../unittests/tscWatch/watchEnvironment.ts | 31 +++---- .../unittests/tsserver/watchEnvironment.ts | 24 +++--- .../unittests/virtualFileSystemWithWatch.ts | 1 + .../reference/api/tsserverlibrary.d.ts | 3 +- tests/baselines/reference/api/typescript.d.ts | 2 +- .../watchFactory/in-config-file-object.js | 31 +++++-- .../watchFactory/in-config-file.js | 31 +++++-- .../through-commandline-object.js | 31 +++++-- .../watchFactory/through-commandline.js | 31 +++++-- ...-host-does-not-implement-require-object.js | 1 + .../when-host-does-not-implement-require.js | 1 + ...in-does-not-implements-watchFile-object.js | 27 +++++-- ...en-plugin-does-not-implements-watchFile.js | 27 +++++-- ...n-doesnt-return-factory-function-object.js | 4 + ...n-plugin-doesnt-return-factory-function.js | 4 + .../when-plugin-not-found-object.js | 5 ++ .../watchFactory/when-plugin-not-found.js | 5 ++ .../watchFactory/in-config-file-object.js | 41 +++++++--- .../watchFactory/in-config-file.js | 41 +++++++--- .../through-commandline-object.js | 41 +++++++--- .../watchFactory/through-commandline.js | 41 +++++++--- ...-host-does-not-implement-require-object.js | 1 + .../when-host-does-not-implement-require.js | 1 + ...in-does-not-implements-watchFile-object.js | 40 +++++---- ...en-plugin-does-not-implements-watchFile.js | 40 +++++---- ...n-doesnt-return-factory-function-object.js | 4 + ...n-plugin-doesnt-return-factory-function.js | 4 + .../when-plugin-not-found-object.js | 5 ++ .../watchFactory/when-plugin-not-found.js | 5 ++ ...on-of-host-allowLocalPluginLoads-object.js | 40 +++++---- ...iguration-of-host-allowLocalPluginLoads.js | 40 +++++---- ...Factory-as-configuration-of-host-object.js | 40 +++++---- ...inOverride-allowLocalPluginLoads-object.js | 40 +++++---- ...th-pluginOverride-allowLocalPluginLoads.js | 40 +++++---- ...tion-of-host-with-pluginOverride-object.js | 40 +++++---- ...nfiguration-of-host-with-pluginOverride.js | 40 +++++---- .../watchFactory-as-configuration-of-host.js | 40 +++++---- ...on-of-host-allowLocalPluginLoads-object.js | 81 +++++++++++-------- ...iguration-of-host-allowLocalPluginLoads.js | 81 +++++++++++-------- ...as-well-as-configuration-of-host-object.js | 81 +++++++++++-------- ...inOverride-allowLocalPluginLoads-object.js | 81 +++++++++++-------- ...th-pluginOverride-allowLocalPluginLoads.js | 81 +++++++++++-------- ...tion-of-host-with-pluginOverride-object.js | 81 +++++++++++-------- ...nfiguration-of-host-with-pluginOverride.js | 81 +++++++++++-------- ...config-as-well-as-configuration-of-host.js | 81 +++++++++++-------- ...onfig-file-allowLocalPluginLoads-object.js | 52 ++++++------ ...ry-in-config-file-allowLocalPluginLoads.js | 52 ++++++------ .../watchFactory-in-config-file-object.js | 52 ++++++------ ...inOverride-allowLocalPluginLoads-object.js | 52 ++++++------ ...th-pluginOverride-allowLocalPluginLoads.js | 52 ++++++------ ...-config-file-with-pluginOverride-object.js | 52 ++++++------ ...tory-in-config-file-with-pluginOverride.js | 52 ++++++------ .../watchFactory-in-config-file.js | 52 ++++++------ 60 files changed, 1302 insertions(+), 772 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4ae9d2f6815f2..2022eed86f461 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -2819,7 +2819,7 @@ export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceF } /** @internal */ -export function setConfigFileInOptions(options: CompilerOptions, configFile: TsConfigSourceFile | undefined) { +export function setConfigFileInOptions(options: CompilerOptions | WatchOptions, configFile: TsConfigSourceFile | undefined) { if (configFile) { Object.defineProperty(options, "configFile", { enumerable: false, writable: false, value: configFile }); } @@ -2865,9 +2865,9 @@ function parseJsonConfigFileContentWorker( const parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache); const { raw } = parsedConfig; const options = extend(existingOptions, parsedConfig.options || {}); - const watchOptions = existingWatchOptions && parsedConfig.watchOptions ? - extend(existingWatchOptions, parsedConfig.watchOptions) : - parsedConfig.watchOptions || existingWatchOptions; + const watchOptions = existingWatchOptions || parsedConfig.watchOptions ? + extend(existingWatchOptions || {}, parsedConfig.watchOptions || {}) : + undefined; options.configFilePath = configFileName && normalizeSlashes(configFileName); const configFileSpecs = getConfigFileSpecs(); @@ -3110,7 +3110,7 @@ function parseConfig( if (ownConfig.extendedConfigPath) { // copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios. resolutionStack = resolutionStack.concat([resolvedPath]); - const result: ExtendsResult = { options:{} }; + const result: ExtendsResult = { options: {} }; if (isString(ownConfig.extendedConfigPath)) { applyExtendedConfig(result, ownConfig.extendedConfigPath); } @@ -3124,17 +3124,17 @@ function parseConfig( if (sourceFile && result.extendedSourceFiles) sourceFile.extendedSourceFiles = arrayFrom(result.extendedSourceFiles.keys()); ownConfig.options = assign(result.options, ownConfig.options); - ownConfig.watchOptions = ownConfig.watchOptions && result.watchOptions ? - assign(result.watchOptions, ownConfig.watchOptions) : - ownConfig.watchOptions || result.watchOptions; - } + ownConfig.watchOptions = ownConfig.watchOptions || result.watchOptions ? + assign(result.watchOptions || {}, ownConfig.watchOptions) : + undefined; + } return ownConfig; function applyExtendedConfig(result: ExtendsResult, extendedConfigPath: string){ const extendedConfig = getExtendedConfig(sourceFile, extendedConfigPath, host, resolutionStack, errors, extendedConfigCache, result); if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) { const extendsRaw = extendedConfig.raw; - let relativeDifference: string | undefined ; + let relativeDifference: string | undefined; const setPropertyInResultIfNotUndefined = (propertyName: "include" | "exclude" | "files") => { if (extendsRaw[propertyName]) { result[propertyName] = map(extendsRaw[propertyName], (path: string) => isRootedDiskPath(path) ? path : combinePaths( @@ -3150,9 +3150,9 @@ function parseConfig( result.compileOnSave = extendsRaw.compileOnSave; } assign(result.options, extendedConfig.options); - result.watchOptions = result.watchOptions && extendedConfig.watchOptions ? - assign({}, result.watchOptions, extendedConfig.watchOptions) : - result.watchOptions || extendedConfig.watchOptions; + result.watchOptions = result.watchOptions || extendedConfig.watchOptions ? + assign(result.watchOptions || {}, extendedConfig.watchOptions) : + undefined; // TODO extend type typeAcquisition } } diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 9d3e6d9e89344..3587cb6e3f85b 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,3 +1,4 @@ +import * as ts from "./_namespaces/ts"; import { AssertionLevel, closeFileWatcher, @@ -15,6 +16,7 @@ import { endsWith, enumerateInsertsAndDeletes, FileSystemEntries, + forEach, getDirectoryPath, getFallbackOptions, getNormalizedAbsolutePath, @@ -33,16 +35,20 @@ import { normalizePath, normalizeSlashes, orderedRemoveItem, + parsePackageName, Path, perfLogger, PluginImport, PollingWatchKind, resolveJSModule, + returnUndefined, some, startsWith, stringContains, timestamp, unorderedRemoveItem, + UserWatchFactory, + UserWatchFactoryModule, WatchDirectoryKind, WatchFileKind, WatchOptions, @@ -470,7 +476,7 @@ function createFixedChunkSizePollingWatchFile(host: { } } -interface SingleFileWatcher{ +interface SingleFileWatcher { watcher: FileWatcher; callbacks: T[]; } @@ -828,6 +834,11 @@ export const enum FileSystemEntryKind { Directory, } +/** @internal */ +export function setWatchOptionInternalProperty(options: WatchOptions, key: K, value: WatchOptions[K]) { + Object.defineProperty(options, key, { configurable: false, enumerable: false, value }); +} + function createFileWatcherCallback(callback: FsWatchCallback): FileWatcherCallback { return (_fileName, eventKind, modifiedTime) => callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); } @@ -938,6 +949,7 @@ export interface CreateSystemWatchFunctions { tscWatchDirectory: string | undefined; inodeWatching: boolean; sysLog: (s: string) => void; + getSystem: () => System; } /** @internal */ @@ -958,6 +970,7 @@ export function createSystemWatchFunctions({ tscWatchDirectory, inodeWatching, sysLog, + getSystem, }: CreateSystemWatchFunctions): { watchFile: HostWatchFile; watchDirectory: HostWatchDirectory; } { const pollingWatches = new Map>(); const fsWatches = new Map>(); @@ -967,12 +980,59 @@ export function createSystemWatchFunctions({ let nonPollingWatchFile: HostWatchFile | undefined; let hostRecursiveDirectoryWatcher: HostWatchDirectory | undefined; let hitSystemWatcherLimit = false; + let reportErrorOnMissingRequire = true; + return { watchFile, - watchDirectory + watchDirectory, }; + function getUserWatchFactory(options: WatchOptions | undefined): UserWatchFactory | undefined { + if (!options?.watchFactory) return undefined; + // Look if we alaready have this factory resolved + if (options.getResolvedWatchFactory) return options.getResolvedWatchFactory(); + const system = getSystem(); + if (!system.require) { + if (reportErrorOnMissingRequire) sysLog(`Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin.`); + reportErrorOnMissingRequire = false; + return setUserWatchFactory(options, /*userWatchFactory*/ undefined); + } + const factoryName = isString(options.watchFactory) ? options.watchFactory : options.watchFactory.name; + if (!factoryName || parsePackageName(factoryName).rest) { + sysLog(`Skipped loading watchFactory ${isString(options.watchFactory) ? options.watchFactory : JSON.stringify(options.watchFactory)} because it can be named with only package name`); + return setUserWatchFactory(options, /*userWatchFactory*/ undefined); + } + const searchPaths = [ + combinePaths(system.getExecutingFilePath(), "../../..") + ]; + sysLog(`Enabling watchFactory ${isString(options.watchFactory) ? options.watchFactory : JSON.stringify(options.watchFactory)} from candidate paths: ${searchPaths.join(",")}`); + const { resolvedModule, errorLogs, pluginConfigEntry } = resolveModule( + isString(options.watchFactory) ? { name: options.watchFactory } : options.watchFactory, + searchPaths, + getSystem(), + sysLog + ); + if (typeof resolvedModule === "function") { + return setUserWatchFactory(options, resolvedModule({ typescript: ts, options, config: pluginConfigEntry })); + } + else if (!resolvedModule) { + forEach(errorLogs, sysLog); + sysLog(`Couldn't find ${pluginConfigEntry.name}`); + } + else { + sysLog(`Skipped loading plugin ${pluginConfigEntry.name} because it did not expose a proper factory function`); + } + return setUserWatchFactory(options, /*userWatchFactory*/ undefined); + } + + function setUserWatchFactory(options: WatchOptions, userWatchFactory: UserWatchFactory | undefined) { + setWatchOptionInternalProperty(options, "getResolvedWatchFactory", userWatchFactory ? () => userWatchFactory : returnUndefined); + return userWatchFactory; + } + function watchFile(fileName: string, callback: FileWatcherCallback, pollingInterval: PollingInterval, options: WatchOptions | undefined): FileWatcher { + const userWatchFactory = getUserWatchFactory(options); + if (typeof userWatchFactory?.watchFile === "function") return userWatchFactory.watchFile(fileName, callback, pollingInterval, options); options = updateOptionsForWatchFile(options, useNonPollingWatchers); const watchFileKind = Debug.checkDefined(options.watchFile); switch (watchFileKind) { @@ -1053,6 +1113,8 @@ export function createSystemWatchFunctions({ } function watchDirectory(directoryName: string, callback: DirectoryWatcherCallback, recursive: boolean, options: WatchOptions | undefined): FileWatcher { + const userWatchFactory = getUserWatchFactory(options); + if (typeof userWatchFactory?.watchDirectory === "function") return userWatchFactory.watchDirectory(directoryName, callback, recursive, options); if (fsSupportsRecursiveFsWatch) { return fsWatch( directoryName, @@ -1498,7 +1560,7 @@ export let sys: System = (() => { let profilePath = "./profile.cpuprofile"; const Buffer: { - new (input: string, encoding?: string): any; + new(input: string, encoding?: string): any; from?(input: string, encoding?: string): any; } = require("buffer").Buffer; @@ -1536,6 +1598,7 @@ export let sys: System = (() => { tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, inodeWatching: isLinuxOrMacOs, sysLog, + getSystem: () => nodeSystem, }); const nodeSystem: System = { args: process.argv.slice(2), @@ -1544,7 +1607,7 @@ export let sys: System = (() => { write(s: string): void { process.stdout.write(s); }, - getWidthOfTerminal(){ + getWidthOfTerminal() { return process.stdout.columns; }, writeOutputIsTTY() { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a810fc712e279..7aa149f4e2dc7 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7221,7 +7221,10 @@ export interface WatchOptions { excludeFiles?: string[]; watchFactory?: string | PluginImport; - [option: string]: CompilerOptionsValue | undefined; + // All the internal properties are set as non enumerable and non configurable so that they arenot enumerated when checking if options have changed + /** @internal */ getResolvedWatchFactory?(): UserWatchFactory | undefined; + + [option: string]: CompilerOptionsValue | Function | undefined; } export interface TypeAcquisition { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 35ba0bac9ed30..b2a7823c769cd 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -830,7 +830,7 @@ export interface WatchOptionsAndErrors { } /** @internal */ -export interface ParsedConfig{ +export interface ParsedConfig { cachedDirectoryStructureHost: CachedDirectoryStructureHost; /** * The map contains @@ -940,6 +940,7 @@ export class ProjectService { /** @internal */ readonly throttledOperations: ThrottledOperations; private readonly hostConfiguration: HostConfiguration; + /** @internal */ private readonly projectWatchOptions = new Map(); private safelist: SafeList = defaultTypeSafeList; private readonly legacySafelist = new Map(); @@ -1309,6 +1310,7 @@ export class ProjectService { !project.projectRootPath || !this.compilerOptionsForInferredProjectsPerProjectRoot.has(project.projectRootPath)) { project.setCompilerOptions(compilerOptions); project.setTypeAcquisition(typeAcquisition); + this.clearWatchOptionsFromProjectWatchOptions(project.getWatchOptions()); project.setWatchOptions(watchOptions?.watchOptions); project.setProjectErrors(watchOptions?.errors); project.compileOnSaveEnabled = compilerOptions.compileOnSave!; @@ -1887,6 +1889,7 @@ export class ProjectService { // If there are still projects watching this config file existence and config, there is nothing to do if (configFileExistenceInfo.config?.projects.size) return; + this.clearWatchOptionsFromProjectWatchOptions(configFileExistenceInfo.config.parsedCommandLine?.watchOptions); configFileExistenceInfo.config = undefined; clearSharedExtendedConfigFileWatcher(canonicalConfigFilePath, this.sharedExtendedConfigFileWatchers); Debug.checkDefined(configFileExistenceInfo.watcher); @@ -2404,6 +2407,7 @@ export class ProjectService { }, /*replacer*/ undefined, " ")}`); const oldCommandLine = configFileExistenceInfo.config?.parsedCommandLine; + this.clearWatchOptionsFromProjectWatchOptions(oldCommandLine?.watchOptions); if (!configFileExistenceInfo.config) { configFileExistenceInfo.config = { parsedCommandLine, cachedDirectoryStructureHost, projects: new Map() }; } @@ -3227,6 +3231,7 @@ export class ProjectService { if (args.watchOptions) { const result = convertWatchOptions(args.watchOptions); this.hostConfiguration.watchOptions = result?.watchOptions; + this.projectWatchOptions.clear(); this.logger.info(`Host watch options changed to ${JSON.stringify(this.hostConfiguration.watchOptions)}, it will be take effect for next watches.`); if (result?.errors?.length) { this.logger.info(`Watch options supplied had errors: Supplied options: ${JSON.stringify(args.watchOptions)}`); @@ -3247,9 +3252,19 @@ export class ProjectService { /** @internal */ private getWatchOptionsFromProjectWatchOptions(projectOptions: WatchOptions | undefined) { - return projectOptions && this.hostConfiguration.watchOptions ? + if (!projectOptions) return this.hostConfiguration.watchOptions; + let options = this.projectWatchOptions.get(projectOptions); + if (options) return options; + this.projectWatchOptions.set(projectOptions, options = this.hostConfiguration.watchOptions ? { ...this.hostConfiguration.watchOptions, ...projectOptions } : - projectOptions || this.hostConfiguration.watchOptions; + projectOptions + ); + return options; + } + + /** @internal */ + clearWatchOptionsFromProjectWatchOptions(projectOptions: WatchOptions | undefined) { + if (projectOptions) this.projectWatchOptions.delete(projectOptions); } closeLog() { @@ -3881,7 +3896,7 @@ export class ProjectService { currentProjects: Iterable, includeProjectReferenceRedirectInfo: boolean | undefined, result: ProjectFilesWithTSDiagnostics[] - ): void { + ): void { for (const proj of currentProjects) { const knownProject = find(lastKnownProjectVersions, p => p.projectName === proj.getProjectName()); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version, includeProjectReferenceRedirectInfo)); @@ -4172,6 +4187,7 @@ export class ProjectService { externalProject.enableLanguageService(); } externalProject.setProjectErrors(watchOptionsAndErrors?.errors); + this.clearWatchOptionsFromProjectWatchOptions(externalProject.getWatchOptions()); // external project already exists and not config files were added - update the project and return; // The graph update here isnt postponed since any file open operation needs all updated external projects this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors?.watchOptions); diff --git a/src/server/project.ts b/src/server/project.ts index 6e641c80d779f..b2802722dec71 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -2188,6 +2188,7 @@ export class InferredProject extends Project { override close() { forEach(this.getRootScriptInfos(), info => this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info)); + this.projectService.clearWatchOptionsFromProjectWatchOptions(this.watchOptions); super.close(); } @@ -2848,6 +2849,11 @@ export class ExternalProject extends Project { override getExcludedFiles() { return this.excludedFiles; } + + override close() { + this.projectService.clearWatchOptionsFromProjectWatchOptions(this.watchOptions); + super.close(); + } } /** @internal */ diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 8d564ca599a2f..8644f1a4019e8 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -7,6 +7,7 @@ import { runWatchBaseline, VerifyTscWatch, verifyTscWatch, + WatchFactorySystem, } from "../tscWatch/helpers"; import { createWatchedSystem, @@ -133,11 +134,11 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi { caption: "Change file", edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), - // timeouts: sys => sys.runQueuedTimeoutCallbacks(), - // }, - // { - // caption: "Invoke plugin watches", - // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Invoke plugin watches", + edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ] @@ -163,11 +164,11 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi { caption: "Change file", edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), - // timeouts: sys => sys.runQueuedTimeoutCallbacks(), - // }, - // { - // caption: "Invoke plugin watches", - // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Invoke plugin watches", + edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ] @@ -219,11 +220,11 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi { caption: "Add file", edit: sys => sys.writeFile(`/user/username/projects/myproject/c.ts`, "export function foo() { }"), - // timeouts: sys => sys.runQueuedTimeoutCallbacks(), - // }, - // { - // caption: "Invoke plugin watches", - // edit: sys => (sys as WatchFactorySystem).factoryData.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Invoke plugin watches", + edit: sys => (sys as WatchFactorySystem).factoryData.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ] diff --git a/src/testRunner/unittests/tscWatch/helpers.ts b/src/testRunner/unittests/tscWatch/helpers.ts index 4ca728aad51b2..22053ed80c2b3 100644 --- a/src/testRunner/unittests/tscWatch/helpers.ts +++ b/src/testRunner/unittests/tscWatch/helpers.ts @@ -338,7 +338,7 @@ interface WatchedDirectoryCallback { callback: ts.DirectoryWatcherCallback; options: ts.WatchOptions | undefined; } -export interface WatchFactorySystem extends TestServerHost { +export type WatchFactorySystem = TscWatchSystem & { factoryData: { watchedFiles: ts.MultiMap; watchedDirectories: ts.MultiMap; @@ -347,7 +347,7 @@ export interface WatchFactorySystem extends TestServerHost { watchDirectory(path: string, callback: ts.DirectoryWatcherCallback, recursive?: boolean, options?: ts.WatchOptions): ts.FileWatcher; onConfigurationChanged(config: any): void; } -} +}; export function createWatchFactorySystem(inputSystem: TestServerHost, log: (s: string) => void = s => inputSystem.write(s + "\n"), pluginName?: string): WatchFactorySystem { const watchedFiles = ts.createMultiMap(); diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index b8906a89bec8b..29d922f100e74 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -16,6 +16,7 @@ import { noopChange, VerifyTscWatch, verifyTscWatch, + WatchFactorySystem, } from "./helpers"; describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => { @@ -723,11 +724,11 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po { caption: "Change file", edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), - // timeouts: sys => sys.runQueuedTimeoutCallbacks(), - // }, - // { - // caption: "Invoke plugin watches", - // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Invoke plugin watches", + edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ] @@ -753,11 +754,11 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po { caption: "Change file", edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), - // timeouts: sys => sys.runQueuedTimeoutCallbacks(), - // }, - // { - // caption: "Invoke plugin watches", - // edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Invoke plugin watches", + edit: sys => (sys as WatchFactorySystem).factoryData.watchedFiles.get(`/user/username/projects/myproject/b.ts`)!.forEach(({ callback }) => callback(`/user/username/projects/myproject/b.ts`, ts.FileWatcherEventKind.Changed)), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ] @@ -809,11 +810,11 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po { caption: "Add file", edit: sys => sys.writeFile(`/user/username/projects/myproject/c.ts`, "export function foo() { }"), - // timeouts: sys => sys.runQueuedTimeoutCallbacks(), - // }, - // { - // caption: "Invoke plugin watches", - // edit: sys => (sys as WatchFactorySystem).factoryData.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + { + caption: "Invoke plugin watches", + edit: sys => (sys as WatchFactorySystem).factoryData.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)), timeouts: sys => sys.runQueuedTimeoutCallbacks(), }, ] diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 03f618c032385..7ab91aff123ca 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -552,9 +552,9 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { // Since we have overriden watch, this shouldnt do anything host.runQueuedTimeoutCallbacks(); - // // Actually invoke watches - // session.logger.log("Invoke plugin watches"); - // plugin.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)); + // Actually invoke watches + session.logger.log("Invoke plugin watches"); + plugin.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)); // Host should have updates queued host.runQueuedTimeoutCallbacks(); @@ -578,9 +578,9 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { // Since we have overriden watch, this shouldnt do anything host.runQueuedTimeoutCallbacks(); - // // Actually invoke watches - // session.logger.log("Invoke plugin watches"); - // plugin.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); + // Actually invoke watches + session.logger.log("Invoke plugin watches"); + plugin.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); // Host should have updates queued host.runQueuedTimeoutCallbacks(); @@ -611,9 +611,9 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { // Since we have overriden watch, this shouldnt do anything host.runQueuedTimeoutCallbacks(); - // // Actually invoke watches - // session.logger.log("Invoke plugin watches"); - // plugin.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)); + // Actually invoke watches + session.logger.log("Invoke plugin watches"); + plugin.watchedDirectoriesRecursive.get("/user/username/projects/myproject")!.forEach(({ callback }) => callback(`/user/username/projects/myproject/c.ts`)); // Host should have updates queued host.runQueuedTimeoutCallbacks(); @@ -623,9 +623,9 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { // Since we have overriden watch, this shouldnt do anything host.runQueuedTimeoutCallbacks(); - // // Actually invoke watches - // session.logger.log("Invoke plugin watches"); - // plugin2.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); + // Actually invoke watches + session.logger.log("Invoke plugin watches"); + plugin2.watchedFiles.get(bTs.path)!.forEach(({ callback }) => callback(bTs.path, ts.FileWatcherEventKind.Changed)); // Host should have updates queued host.runQueuedTimeoutCallbacks(); diff --git a/src/testRunner/unittests/virtualFileSystemWithWatch.ts b/src/testRunner/unittests/virtualFileSystemWithWatch.ts index 33a8e964e9ef9..a495a3ec65ebe 100644 --- a/src/testRunner/unittests/virtualFileSystemWithWatch.ts +++ b/src/testRunner/unittests/virtualFileSystemWithWatch.ts @@ -342,6 +342,7 @@ export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, tscWatchDirectory, inodeWatching: !!this.inodeWatching, sysLog: s => this.write(s + this.newLine), + getSystem: () => this, }); this.watchFile = watchFile; this.watchDirectory = watchDirectory; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index de332c539a4a2..5484b36bd15f8 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3404,6 +3404,7 @@ declare namespace ts { excludedFiles: readonly NormalizedPath[]; updateGraph(): boolean; getExcludedFiles(): readonly ts.server.NormalizedPath[]; + close(): void; } function convertFormatOptions(protocolOptions: protocol.FormatCodeSettings): FormatCodeSettings; function convertCompilerOptions(protocolOptions: protocol.ExternalProjectCompilerOptions): CompilerOptions & protocol.CompileOnSaveMixin; @@ -7244,7 +7245,7 @@ declare namespace ts { excludeDirectories?: string[]; excludeFiles?: string[]; watchFactory?: string | PluginImport; - [option: string]: CompilerOptionsValue | undefined; + [option: string]: CompilerOptionsValue | Function | undefined; } interface TypeAcquisition { enable?: boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1ab053963bef8..5b55b7eae3ed0 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3232,7 +3232,7 @@ declare namespace ts { excludeDirectories?: string[]; excludeFiles?: string[]; watchFactory?: string | PluginImport; - [option: string]: CompilerOptionsValue | undefined; + [option: string]: CompilerOptionsValue | Function | undefined; } interface TypeAcquisition { enable?: boolean; diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js index 8b0eb3598f310..39c4204942a75 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -30,10 +30,18 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -54,17 +62,17 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -104,6 +112,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js index 8b0eb3598f310..39c4204942a75 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js @@ -30,10 +30,18 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -54,17 +62,17 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -104,6 +112,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js index eeacd88f29f4e..92241db67a8b3 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -30,10 +30,18 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -54,17 +62,17 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -104,6 +112,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js index eeacd88f29f4e..92241db67a8b3 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js @@ -30,10 +30,18 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -54,17 +62,17 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -104,6 +112,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js index 8b0eb3598f310..1c2353fa6d021 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -30,6 +30,7 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js index 8b0eb3598f310..1c2353fa6d021 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js @@ -30,6 +30,7 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js index bcdd10824c18a..29cc38b59ffd9 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -30,7 +30,12 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json @@ -62,9 +67,9 @@ FsWatches:: /user/username/projects/myproject/b.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -157,6 +162,17 @@ Input:: export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 2: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 @@ -166,9 +182,6 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec [12:00:41 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json [12:00:46 AM] Found 0 errors. Watching for file changes. @@ -198,9 +211,9 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js index bcdd10824c18a..29cc38b59ffd9 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js @@ -30,7 +30,12 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json @@ -62,9 +67,9 @@ FsWatches:: /user/username/projects/myproject/b.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -157,6 +162,17 @@ Input:: export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 2: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 @@ -166,9 +182,6 @@ Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myprojec [12:00:41 AM] File change detected. Starting incremental compilation... FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json [12:00:46 AM] Found 0 errors. Watching for file changes. @@ -198,9 +211,9 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js index 8b0eb3598f310..4e6465c695c70 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -30,6 +30,10 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Skipped loading plugin myplugin because it did not expose a proper factory function DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js index 8b0eb3598f310..4e6465c695c70 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js @@ -30,6 +30,10 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Skipped loading plugin myplugin because it did not expose a proper factory function DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js index 8b0eb3598f310..28d67acdd3567 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -30,6 +30,11 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Failed to load module 'myplugin' from /a/lib/tsc.js/../../../node_modules: Cannot find module myPlugin at /a/lib/tsc.js/../../../node_modules +Couldn't find myplugin DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js index 8b0eb3598f310..28d67acdd3567 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js @@ -30,6 +30,11 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Failed to load module 'myplugin' from /a/lib/tsc.js/../../../node_modules: Cannot find module myPlugin at /a/lib/tsc.js/../../../node_modules +Couldn't find myplugin DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js index 6f0a9e1508ee4..d91f539abdf5f 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -29,18 +29,28 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory @@ -62,23 +72,21 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -118,6 +126,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js index 6f0a9e1508ee4..d91f539abdf5f 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js @@ -29,18 +29,28 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory @@ -62,23 +72,21 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -118,6 +126,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js index cce38f32ddda2..3cfa08a53ffa4 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -29,18 +29,28 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory @@ -62,23 +72,21 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -118,6 +126,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js index cce38f32ddda2..3cfa08a53ffa4 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js @@ -29,18 +29,28 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file +Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory @@ -62,23 +72,21 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/a.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -118,6 +126,17 @@ Input:: export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js index 6f0a9e1508ee4..b71d313d8c278 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -29,6 +29,7 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin. Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js index 6f0a9e1508ee4..b71d313d8c278 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js @@ -29,6 +29,7 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin. Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js index 047d929544a25..bd78a9bbe4adc 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -29,6 +29,10 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -37,10 +41,12 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"wa FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory @@ -62,10 +68,6 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: /user/username/projects/myproject/tsconfig.json: *new* {} @@ -76,9 +78,11 @@ FsWatches:: /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -175,6 +179,17 @@ Input:: export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 2: timerToUpdateProgram After running Timeout callback:: count: 0 @@ -190,9 +205,6 @@ CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file -DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory [12:00:41 AM] Found 0 errors. Watching for file changes. @@ -212,10 +224,6 @@ Semantic diagnostics in builder refreshed for:: Shape signatures in builder refreshed for:: /user/username/projects/myproject/c.ts (computed .d.ts) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: /user/username/projects/myproject/tsconfig.json: {} @@ -228,9 +236,11 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js index 047d929544a25..bd78a9bbe4adc 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js @@ -29,6 +29,10 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -37,10 +41,12 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"wa FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory @@ -62,10 +68,6 @@ Shape signatures in builder refreshed for:: /user/username/projects/myproject/a.ts (used version) /user/username/projects/myproject/b.ts (used version) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: /user/username/projects/myproject/tsconfig.json: *new* {} @@ -76,9 +78,11 @@ FsWatches:: /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined @@ -175,6 +179,17 @@ Input:: export function foo() { } +Before running Timeout callback:: count: 0 +After running Timeout callback:: count: 0 +Output:: + +exitCode:: ExitStatus.undefined + + +Change:: Invoke plugin watches + +Input:: + Before running Timeout callback:: count: 1 2: timerToUpdateProgram After running Timeout callback:: count: 0 @@ -190,9 +205,6 @@ CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file -DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/c.js -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.js :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory [12:00:41 AM] Found 0 errors. Watching for file changes. @@ -212,10 +224,6 @@ Semantic diagnostics in builder refreshed for:: Shape signatures in builder refreshed for:: /user/username/projects/myproject/c.ts (computed .d.ts) -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: /user/username/projects/myproject/tsconfig.json: {} @@ -228,9 +236,11 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject: - {} + {"options":{"watchFactory":"myplugin"}} exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js index 6f0a9e1508ee4..0603355480af0 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -29,6 +29,10 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Skipped loading plugin myplugin because it did not expose a proper factory function Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js index 6f0a9e1508ee4..0603355480af0 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js @@ -29,6 +29,10 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Skipped loading plugin myplugin because it did not expose a proper factory function Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js index 6f0a9e1508ee4..0f65303a0f1fb 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -29,6 +29,11 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Failed to load module 'myplugin' from /a/lib/tsc.js/../../../node_modules: Cannot find module myPlugin at /a/lib/tsc.js/../../../node_modules +Couldn't find myplugin Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js index 6f0a9e1508ee4..0f65303a0f1fb 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js @@ -29,6 +29,11 @@ Output:: Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) +Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Failed to load module 'myplugin' from /a/lib/tsc.js/../../../node_modules: Cannot find module myPlugin at /a/lib/tsc.js/../../../node_modules +Couldn't find myplugin Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js index f60b597a26f0d..6911ed935f2c2 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -69,11 +72,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -104,23 +111,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -128,9 +141,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -161,10 +171,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js index f60b597a26f0d..6911ed935f2c2 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -69,11 +72,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -104,23 +111,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -128,9 +141,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -161,10 +171,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js index f60b597a26f0d..6911ed935f2c2 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -69,11 +72,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -104,23 +111,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -128,9 +141,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -161,10 +171,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index e50d5dda95bbc..3dfea3450c563 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -81,6 +81,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -91,11 +94,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -126,23 +133,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -150,9 +163,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -183,10 +193,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index e50d5dda95bbc..3dfea3450c563 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -81,6 +81,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -91,11 +94,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -126,23 +133,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -150,9 +163,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -183,10 +193,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js index e50d5dda95bbc..3dfea3450c563 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js @@ -81,6 +81,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -91,11 +94,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -126,23 +133,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -150,9 +163,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -183,10 +193,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js index e50d5dda95bbc..3dfea3450c563 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js @@ -81,6 +81,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -91,11 +94,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -126,23 +133,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -150,9 +163,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -183,10 +193,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js index f60b597a26f0d..6911ed935f2c2 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -69,11 +72,15 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } } Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -104,23 +111,29 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - -FsWatches:: +Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {} + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} /a/lib/lib.d.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} -FsWatchesRecursive:: +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Change file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -128,9 +141,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -161,10 +171,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js index b58c96ba559fe..ee909f8c990d5 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -73,12 +76,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +119,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,12 +151,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -178,29 +194,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -208,9 +228,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -242,10 +259,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js index b58c96ba559fe..ee909f8c990d5 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -73,12 +76,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +119,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,12 +151,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -178,29 +194,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -208,9 +228,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -242,10 +259,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js index b58c96ba559fe..ee909f8c990d5 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -73,12 +76,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +119,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,12 +151,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -178,29 +194,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -208,9 +228,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -242,10 +259,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index cb9b0f411045d..8487f2240ce71 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -103,6 +103,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -117,12 +120,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -153,23 +163,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -177,12 +195,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -222,29 +238,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -252,9 +272,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -286,10 +303,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index cb9b0f411045d..8487f2240ce71 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -103,6 +103,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -117,12 +120,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -153,23 +163,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -177,12 +195,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -222,29 +238,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -252,9 +272,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -286,10 +303,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js index cb9b0f411045d..8487f2240ce71 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js @@ -103,6 +103,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -117,12 +120,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -153,23 +163,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -177,12 +195,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -222,29 +238,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -252,9 +272,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -286,10 +303,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js index cb9b0f411045d..8487f2240ce71 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js @@ -103,6 +103,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -117,12 +120,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -153,23 +163,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -177,12 +195,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -222,29 +238,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -252,9 +272,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -286,10 +303,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js index b58c96ba559fe..ee909f8c990d5 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js @@ -59,6 +59,9 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -73,12 +76,19 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +119,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: *new* + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: *new* - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,12 +151,10 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -178,29 +194,33 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} /user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} + {"options":{"watchFactory":"myplugin"}} -FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} +myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /a/lib/lib.d.ts: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} /user/username/projects/myproject/c.ts: *new* - {} - -FsWatchesRecursive:: -/user/username/projects/myproject: - {} + {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} +Change file Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/b.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + After running Timeout callback:: count: 0 -Change file +Invoke plugin watches Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -208,9 +228,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/userna Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/b.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json @@ -242,10 +259,6 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -Before running Timeout callback:: count: 0 - -After running Timeout callback:: count: 0 - Before request Info seq [hh:mm:ss:mss] request: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js index 27fc2e8bcd32d..4c0a5071e8386 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js @@ -51,12 +51,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -87,23 +92,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -111,9 +124,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -156,13 +166,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -170,13 +174,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js index 27fc2e8bcd32d..4c0a5071e8386 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js @@ -51,12 +51,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -87,23 +92,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -111,9 +124,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -156,13 +166,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -170,13 +174,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js index 27fc2e8bcd32d..4c0a5071e8386 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js @@ -51,12 +51,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -87,23 +92,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -111,9 +124,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -156,13 +166,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -170,13 +174,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js index e5b0750883a03..3f72e9b5977ac 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js @@ -73,12 +73,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +114,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,9 +146,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -178,13 +188,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -192,13 +196,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js index e5b0750883a03..3f72e9b5977ac 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js @@ -73,12 +73,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +114,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,9 +146,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -178,13 +188,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -192,13 +196,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js index e5b0750883a03..3f72e9b5977ac 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js @@ -73,12 +73,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +114,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,9 +146,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -178,13 +188,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -192,13 +196,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js index e5b0750883a03..3f72e9b5977ac 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js @@ -73,12 +73,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -109,23 +114,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -133,9 +146,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -178,13 +188,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -192,13 +196,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js index 27fc2e8bcd32d..4c0a5071e8386 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js @@ -51,12 +51,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -87,23 +92,31 @@ Info seq [hh:mm:ss:mss] response: } After request -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: *new* - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: *new* - {} /user/username/projects/myproject/b.ts: *new* {} /a/lib/lib.d.ts: *new* {} -FsWatchesRecursive:: +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: *new* + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + +Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {} + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: *new* + {"options":{"watchFactory":"myplugin"}} Add a file +Before running Timeout callback:: count: 0 +//// [/user/username/projects/myproject/c.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + + +After running Timeout callback:: count: 0 + +Invoke plugin watches Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* @@ -111,9 +124,6 @@ Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/u Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* -//// [/user/username/projects/myproject/c.ts] -export class a { prop = "hello"; foo() { return this.prop; } } - Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 undefined WatchType: Closed Script info @@ -156,13 +166,7 @@ Info seq [hh:mm:ss:mss] FileName: /user/username/projects/myproject/a.ts Proje Info seq [hh:mm:ss:mss] Projects: /user/username/projects/myproject/tsconfig.json After running Timeout callback:: count: 0 -PolledWatches:: -/user/username/projects/myproject/node_modules/@types: - {"pollingInterval":500} - FsWatches:: -/user/username/projects/myproject/tsconfig.json: - {} /user/username/projects/myproject/b.ts: {} /a/lib/lib.d.ts: @@ -170,13 +174,15 @@ FsWatches:: /user/username/projects/myproject/c.ts: *new* {} -FsWatchesRecursive:: -/user/username/projects/myproject: - {} - -Before running Timeout callback:: count: 0 +Plugin WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} -After running Timeout callback:: count: 0 +Plugin WatchedDirectories:Recursive:: +/user/username/projects/myproject: + {"options":{"watchFactory":"myplugin"}} +/user/username/projects/myproject/node_modules/@types: + {"options":{"watchFactory":"myplugin"}} Before request From f5bca5b1a50aeedc00374f65208240ff857263e5 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 13 Sep 2022 12:22:59 -0700 Subject: [PATCH 08/13] Add onConfigurationChanged just like LS plugins --- src/server/editorServices.ts | 7 +++++++ src/server/project.ts | 4 ++-- ...s-configuration-of-host-allowLocalPluginLoads-object.js | 1 + ...ctory-as-configuration-of-host-allowLocalPluginLoads.js | 1 + .../watchFactory-as-configuration-of-host-object.js | 1 + ...ost-with-pluginOverride-allowLocalPluginLoads-object.js | 1 + ...on-of-host-with-pluginOverride-allowLocalPluginLoads.js | 1 + ...-as-configuration-of-host-with-pluginOverride-object.js | 1 + ...Factory-as-configuration-of-host-with-pluginOverride.js | 1 + .../watchFactory-as-configuration-of-host.js | 1 + ...s-configuration-of-host-allowLocalPluginLoads-object.js | 2 ++ ...-well-as-configuration-of-host-allowLocalPluginLoads.js | 2 ++ ...ry-in-config-as-well-as-configuration-of-host-object.js | 2 ++ ...ost-with-pluginOverride-allowLocalPluginLoads-object.js | 2 ++ ...on-of-host-with-pluginOverride-allowLocalPluginLoads.js | 2 ++ ...-as-configuration-of-host-with-pluginOverride-object.js | 2 ++ ...as-well-as-configuration-of-host-with-pluginOverride.js | 2 ++ ...chFactory-in-config-as-well-as-configuration-of-host.js | 2 ++ ...hFactory-in-config-file-allowLocalPluginLoads-object.js | 1 + .../watchFactory-in-config-file-allowLocalPluginLoads.js | 1 + .../watchEnvironment/watchFactory-in-config-file-object.js | 1 + ...ile-with-pluginOverride-allowLocalPluginLoads-object.js | 1 + ...onfig-file-with-pluginOverride-allowLocalPluginLoads.js | 1 + ...tchFactory-in-config-file-with-pluginOverride-object.js | 1 + .../watchFactory-in-config-file-with-pluginOverride.js | 1 + .../watchEnvironment/watchFactory-in-config-file.js | 1 + 26 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index b2a7823c769cd..9b154a123a764 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -809,6 +809,10 @@ function setProjectOptionsUsed(project: ConfiguredProject | ExternalProject) { } } +function onWachOptionsFactoryConfigurationChanged(watchOptions: WatchOptions, pluginName: string, configuration: any) { + if (watchOptions.watchFactory === pluginName) watchOptions.getResolvedWatchFactory?.()?.onConfigurationChanged?.(configuration); +} + /** @internal */ export interface OpenFileArguments { fileName: string; @@ -4392,6 +4396,9 @@ export class ProjectService { configurePlugin(args: protocol.ConfigurePluginRequestArguments) { // For any projects that already have the plugin loaded, configure the plugin this.forEachEnabledProject(project => project.onPluginConfigurationChanged(args.pluginName, args.configuration)); + this.projectWatchOptions.forEach(options => + onWachOptionsFactoryConfigurationChanged(options, args.pluginName, args.configuration)); + if (this.hostConfiguration.watchOptions) onWachOptionsFactoryConfigurationChanged(this.hostConfiguration.watchOptions, args.pluginName, args.configuration); // Also save the current configuration to pass on to any projects that are yet to be loaded. // If a plugin is configured twice, only the latest configuration will be remembered. diff --git a/src/server/project.ts b/src/server/project.ts index b2802722dec71..5546973bcfbce 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1882,8 +1882,8 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo /** @internal */ onPluginConfigurationChanged(pluginName: string, configuration: any) { - this.plugins.filter(plugin => plugin.name === pluginName).forEach(plugin => { - if (plugin.module.onConfigurationChanged) { + this.plugins.forEach(plugin => { + if (plugin.name === pluginName && plugin.module.onConfigurationChanged) { plugin.module.onConfigurationChanged(configuration); } }); diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js index 6911ed935f2c2..3cba2b197ef1a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -185,6 +185,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js index 6911ed935f2c2..3cba2b197ef1a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js @@ -185,6 +185,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js index 6911ed935f2c2..3cba2b197ef1a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js @@ -185,6 +185,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index 3dfea3450c563..dee45b582488d 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -207,6 +207,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index 3dfea3450c563..dee45b582488d 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -207,6 +207,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js index 3dfea3450c563..dee45b582488d 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js @@ -207,6 +207,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js index 3dfea3450c563..dee45b582488d 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js @@ -207,6 +207,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js index 6911ed935f2c2..3cba2b197ef1a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js @@ -185,6 +185,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js index ee909f8c990d5..c2d27ca63706b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -273,6 +273,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -295,6 +296,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js index ee909f8c990d5..c2d27ca63706b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js @@ -273,6 +273,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -295,6 +296,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js index ee909f8c990d5..c2d27ca63706b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js @@ -273,6 +273,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -295,6 +296,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index 8487f2240ce71..d4a427d75a39e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -317,6 +317,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 5, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -339,6 +340,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 6, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index 8487f2240ce71..d4a427d75a39e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -317,6 +317,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 5, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -339,6 +340,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 6, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js index 8487f2240ce71..d4a427d75a39e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js @@ -317,6 +317,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 5, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -339,6 +340,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 6, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js index 8487f2240ce71..d4a427d75a39e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js @@ -317,6 +317,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 5, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -339,6 +340,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 6, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js index ee909f8c990d5..c2d27ca63706b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js @@ -273,6 +273,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -295,6 +296,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } +Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js index 4c0a5071e8386..eaac403b930fa 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js @@ -198,6 +198,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js index 4c0a5071e8386..eaac403b930fa 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js @@ -198,6 +198,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js index 4c0a5071e8386..eaac403b930fa 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js @@ -198,6 +198,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js index 3f72e9b5977ac..7581269a4e4ea 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js @@ -220,6 +220,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js index 3f72e9b5977ac..7581269a4e4ea 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js @@ -220,6 +220,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js index 3f72e9b5977ac..7581269a4e4ea 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js @@ -220,6 +220,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js index 3f72e9b5977ac..7581269a4e4ea 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js @@ -220,6 +220,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js index 4c0a5071e8386..eaac403b930fa 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js @@ -198,6 +198,7 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } +Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: From ac6b5e97286a94f55d5ac7a31f15a8e2f80845ff Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 7 Oct 2022 13:56:59 -0700 Subject: [PATCH 09/13] Allow watchFactory as a object with name and configuration --- src/compiler/commandLineParser.ts | 107 ++++++++++++------ src/compiler/types.ts | 22 ++-- src/executeCommandLine/executeCommandLine.ts | 4 + src/harness/harnessIO.ts | 5 +- .../unittests/config/commandLineParsing.ts | 6 + src/testRunner/unittests/config/showConfig.ts | 19 ++++ .../config/tsconfigParsingWatchOptions.ts | 6 + .../tsbuildWatch/watchEnvironment.ts | 6 +- .../unittests/tscWatch/watchEnvironment.ts | 6 +- .../unittests/tsserver/watchEnvironment.ts | 5 +- .../errors on invalid watchFactory name.js | 9 ++ .../errors on invalid watchFactory object.js | 9 ++ .../parse --watchFactory object.js | 13 +++ .../errors on invalid watchFactory name.js | 9 ++ .../errors on invalid watchFactory object.js | 9 ++ .../parse --watchFactory object.js | 13 +++ .../watchFactory/tsconfig.json | 4 +- .../watchFactoryWithStringValue/tsconfig.json | 6 + .../different options with json api.js | 47 ++++++++ ...fferent options with jsonSourceFile api.js | 50 ++++++++ .../watchFactory/in-config-file-object.js | 36 +++--- .../in-config-file-with-error-object.js | 14 +-- .../through-commandline-object.js | 36 +++--- .../through-commandline-with-error-object.js | 2 +- ...-host-does-not-implement-require-object.js | 16 +-- ...in-does-not-implements-watchFile-object.js | 32 +++--- ...n-doesnt-return-factory-function-object.js | 18 +-- .../when-plugin-not-found-object.js | 18 +-- .../watchFactory/in-config-file-object.js | 50 ++++---- .../in-config-file-with-error-object.js | 14 +-- .../through-commandline-object.js | 50 ++++---- .../through-commandline-with-error-object.js | 2 +- ...-host-does-not-implement-require-object.js | 22 ++-- ...in-does-not-implements-watchFile-object.js | 44 +++---- ...n-doesnt-return-factory-function-object.js | 24 ++-- .../when-plugin-not-found-object.js | 24 ++-- ...on-of-host-allowLocalPluginLoads-object.js | 48 ++++---- ...Factory-as-configuration-of-host-object.js | 48 ++++---- ...onfiguration-of-host-with-errors-object.js | 7 +- ...inOverride-allowLocalPluginLoads-object.js | 48 ++++---- ...tion-of-host-with-pluginOverride-object.js | 48 ++++---- ...on-of-host-allowLocalPluginLoads-object.js | 84 +++++++------- ...as-well-as-configuration-of-host-object.js | 84 +++++++------- ...inOverride-allowLocalPluginLoads-object.js | 84 +++++++------- ...tion-of-host-with-pluginOverride-object.js | 84 +++++++------- ...onfig-file-allowLocalPluginLoads-object.js | 42 +++---- .../watchFactory-in-config-file-object.js | 42 +++---- ...inOverride-allowLocalPluginLoads-object.js | 42 +++---- ...-config-file-with-pluginOverride-object.js | 42 +++---- 49 files changed, 870 insertions(+), 590 deletions(-) create mode 100644 tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory name.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory object.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory object.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory name.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory object.js create mode 100644 tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory object.js create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactoryWithStringValue/tsconfig.json diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 2022eed86f461..d64e08712da14 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -12,6 +12,7 @@ import { CommandLineOption, CommandLineOptionOfCustomType, CommandLineOptionOfListType, + CommandLineOptionOfObjectType, CompilerOptions, CompilerOptionsValue, ConfigFileSpecs, @@ -22,6 +23,7 @@ import { createGetCanonicalFileName, Debug, Diagnostic, + DiagnosticAndArguments, DiagnosticArguments, DiagnosticMessage, Diagnostics, @@ -45,6 +47,7 @@ import { flatten, forEach, forEachEntry, + forEachPropertyAssignment, forEachTsConfigPropArray, getBaseFileName, getDirectoryPath, @@ -95,6 +98,7 @@ import { parseJsonText, parsePackageName, Path, + PluginImport, PollingWatchKind, PrefixUnaryExpression, ProjectReference, @@ -112,7 +116,6 @@ import { toPath, tracing, trimString, - TsConfigOnlyOption, TsConfigSourceFile, TypeAcquisition, unescapeLeadingUnderscores, @@ -315,17 +318,27 @@ export const optionsForWatch: CommandLineOption[] = [ }, { name: "watchFactory", - type: "string", + type: "string | object", category: Diagnostics.Watch_and_Build_Modes, description: Diagnostics.Specify_which_factory_to_invoke_watchFile_and_watchDirectory_on, - extraValidation: watchFactoryToDiagnostic + extraValidation: watchFactoryToDiagnostic, + elementOptions: commandLineOptionsToMap([ + { + name: "name", + type: "string", + description: Diagnostics.Specify_which_factory_to_invoke_watchFile_and_watchDirectory_on, + }, + ]), }, ]; -function watchFactoryToDiagnostic(watchFactory: CompilerOptionsValue): [DiagnosticMessage] | undefined { - return parsePackageName(watchFactory as string).rest ? - [Diagnostics.watchFactory_name_can_only_be_a_package_name] : - undefined; +function watchFactoryToDiagnostic(watchFactory: CompilerOptionsValue, valueExpression: Expression | undefined) { + const watchFactoryName = isString(watchFactory) ? watchFactory : (watchFactory as PluginImport).name; + if (watchFactoryName && !parsePackageName(watchFactoryName).rest) return undefined; + const diagnostics: DiagnosticAndArguments = [Diagnostics.watchFactory_name_can_only_be_a_package_name]; + if (!valueExpression || !isObjectLiteralExpression(valueExpression)) return diagnostics; + const errorNode = forEachPropertyAssignment(valueExpression, "name", prop => prop.initializer); + return errorNode ? { diagnostics, errorNode } : diagnostics; } /** @internal */ @@ -1739,12 +1752,32 @@ export function parseListTypeOption(opt: CommandLineOptionOfListType, value = "" return mapDefined(values, v => validateJsonOptionValue(opt.element, v || "", errors)); case "boolean": case "object": + case "string | object": return Debug.fail(`List of ${opt.element.type} is not yet supported.`); default: return mapDefined(values, v => parseCustomTypeOption(opt.element as CommandLineOptionOfCustomType, v, errors)); } } +/** @internal */ +export function parseObjectTypeOption(opt: CommandLineOptionOfObjectType, value: string | undefined, errors: Diagnostic[]): { value: CompilerOptionsValue | undefined } | undefined { + if (value === undefined) return undefined; + value = trimString(value); + if (startsWith(value, "-")) return undefined; + if (opt.type === "string | object" && !startsWith(value, "{")) { + return { value: validateJsonOptionValue(opt, value, errors) }; + } + try { + const parsedValue = JSON.parse(value); + if (typeof parsedValue === "object") { + return { value: validateJsonOptionValue(opt, parsedValue, errors) }; + } + } + catch { } // eslint-disable-line no-empty + errors.push(createCompilerDiagnostic(Diagnostics.Argument_for_0_option_must_be_Colon_1, opt.name, getCompilerOptionValueTypeString(opt))); + return { value: undefined }; +} + /** @internal */ export interface OptionsBase { [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; @@ -1922,9 +1955,15 @@ function parseOptionValue( case "listOrElement": Debug.fail("listOrElement not supported here"); break; + case "object": + case "string | object": + const objectResult = parseObjectTypeOption(opt, args[i], errors); + options[opt.name] = objectResult?.value; + if (objectResult) i++; + break; // If not a primitive, the possible types are specified in what is effectively a map of options. default: - options[opt.name] = parseCustomTypeOption(opt as CommandLineOptionOfCustomType, args[i], errors); + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); i++; break; } @@ -2167,30 +2206,30 @@ const extendsOptionDeclaration: CommandLineOptionOfListType = { type: "listOrElement", element: { name: "extends", - type: "string" + type: "string", }, category: Diagnostics.File_Management, disallowNullOrUndefined: true, }; -const compilerOptionsDeclaration: TsConfigOnlyOption = { +const compilerOptionsDeclaration: CommandLineOptionOfObjectType = { name: "compilerOptions", type: "object", elementOptions: getCommandLineCompilerOptionsMap(), extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics, }; -const watchOptionsDeclaration: TsConfigOnlyOption = { +const watchOptionsDeclaration: CommandLineOptionOfObjectType = { name: "watchOptions", type: "object", elementOptions: getCommandLineWatchOptionsMap(), extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics, }; -const typeAcquisitionDeclaration: TsConfigOnlyOption = { +const typeAcquisitionDeclaration: CommandLineOptionOfObjectType = { name: "typeAcquisition", type: "object", elementOptions: getCommandLineTypeAcquisitionMap(), extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics }; -let _tsconfigRootOptions: TsConfigOnlyOption; +let _tsconfigRootOptions: CommandLineOptionOfObjectType; function getTsconfigRootOptionsMap() { if (_tsconfigRootOptions === undefined) { _tsconfigRootOptions = { @@ -2248,12 +2287,12 @@ function getTsconfigRootOptionsMap() { /** @internal */ export interface JsonConversionNotifier { - rootOptions: TsConfigOnlyOption; + rootOptions: CommandLineOptionOfObjectType; onPropertySet( keyText: string, value: any, propertyAssignment: PropertyAssignment, - parentOption: TsConfigOnlyOption | undefined, + parentOption: CommandLineOptionOfObjectType | undefined, option: CommandLineOption | undefined, ): void; } @@ -2314,7 +2353,7 @@ export function convertToJson( function convertObjectLiteralExpressionToJson( node: ObjectLiteralExpression, - objectOption: TsConfigOnlyOption | undefined, + objectOption: CommandLineOptionOfObjectType | undefined, ): any { const result: any = returnValue ? {} : undefined; for (const element of node.properties) { @@ -2394,7 +2433,7 @@ export function convertToJson( // that satifies it and need it to modify options set in them (for normalizing file paths) // vs what we set in the json // If need arises, we can modify this interface and callbacks as needed - return convertObjectLiteralExpressionToJson(objectLiteralExpression, option as TsConfigOnlyOption); + return convertObjectLiteralExpressionToJson(objectLiteralExpression, option as CommandLineOptionOfObjectType); case SyntaxKind.ArrayLiteralExpression: return convertArrayLiteralExpressionToJson( @@ -2435,6 +2474,9 @@ function isCompilerOptionsValue(option: CommandLineOption | undefined, value: an if (option.type === "listOrElement") { return isArray(value) || isCompilerOptionsValue(option.element, value); } + if (option.type === "string | object") { + return isString(value) || typeof value === "object"; + } const expectedType = isString(option.type) ? option.type : "string"; return typeof value === expectedType; } @@ -2544,6 +2586,7 @@ function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption case "number": case "boolean": case "object": + case "string | object": // this is of a type CommandLineOptionOfPrimitiveType return undefined; case "list": @@ -3260,7 +3303,7 @@ function parseOwnConfigOfJsonSourceFile( keyText: string, value: any, propertyAssignment: PropertyAssignment, - parentOption: TsConfigOnlyOption | undefined, + parentOption: CommandLineOptionOfObjectType | undefined, option: CommandLineOption | undefined, ) { // Ensure value is verified except for extends which is handled in its own way for error reporting @@ -3271,7 +3314,8 @@ function parseOwnConfigOfJsonSourceFile( if (parentOption === compilerOptionsDeclaration) currentOption = options; else if (parentOption === watchOptionsDeclaration) currentOption = watchOptions ??= {}; else if (parentOption === typeAcquisitionDeclaration) currentOption = typeAcquisition ??= getDefaultTypeAcquisition(configFileName); - else Debug.fail("Unknown option"); + // Ignore anything other option that comes through as parent is not from root + else return; currentOption[option.name] = value; } else if (keyText && parentOption?.extraKeyDiagnostics) { @@ -3483,11 +3527,10 @@ export function convertJsonOption( return undefined; } if (isCompilerOptionsValue(opt, value)) { - const optType = opt.type; - if ((optType === "list") && isArray(value)) { + if ((opt.type === "list") && isArray(value)) { return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression as ArrayLiteralExpression | undefined, sourceFile); } - else if (optType === "listOrElement") { + else if (opt.type === "listOrElement") { return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression as ArrayLiteralExpression | undefined, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile); @@ -3521,9 +3564,11 @@ function validateJsonOptionValue( sourceFile?: TsConfigSourceFile, ): T | undefined { if (isNullOrUndefined(value)) return undefined; - const d = opt.extraValidation?.(value); + const d = opt.extraValidation?.(value, valueExpression); if (!d) return value; - errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d)); + const diagnostics = isArray(d) ? d : d.diagnostics; + const errorNode = isArray(d) ? valueExpression : d.errorNode; + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, errorNode, ...diagnostics)); return undefined; } @@ -3754,20 +3799,16 @@ function matchesExcludeWorker( function validateSpecs(specs: readonly string[], errors: Diagnostic[], disallowTrailingRecursion: boolean, jsonSourceFile: TsConfigSourceFile | undefined, specKey: string): readonly string[] { return specs.filter(spec => { if (!isString(spec)) return false; - const diag = specToDiagnostic(spec, disallowTrailingRecursion); + const diag = specToDiagnostic(spec, /*_valueExpresion*/ undefined, disallowTrailingRecursion); if (diag !== undefined) { - errors.push(createDiagnostic(...diag)); + const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, ...diag)); } return diag === undefined; }); - - function createDiagnostic(message: DiagnosticMessage, spec: string): Diagnostic { - const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec); - return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec); - } } -function specToDiagnostic(spec: CompilerOptionsValue, disallowTrailingRecursion?: boolean): [DiagnosticMessage, string] | undefined { +function specToDiagnostic(spec: CompilerOptionsValue, _valueExpresion?: Expression, disallowTrailingRecursion?: boolean): DiagnosticAndArguments | undefined { Debug.assert(typeof spec === "string"); if (disallowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { return [Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec]; @@ -3932,6 +3973,7 @@ function getOptionValueWithEmptyStrings(value: any, option: CommandLineOption): if (value === undefined) return value; switch (option.type) { case "object": // "paths". Can't get any useful information from the value since we blank out strings, so just return "". + case "string | object": return ""; case "string": // Could be any arbitrary string -- use empty string instead. return ""; @@ -3962,6 +4004,7 @@ function getDefaultValueForOption(option: CommandLineOption): {} { case "boolean": return true; case "string": + case "string | object": const defaultValue = option.defaultValueDescription; return option.isFilePath ? `./${defaultValue && typeof defaultValue === "string" ? defaultValue : ""}` : ""; case "list": diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7aa149f4e2dc7..6d4b4d9e23361 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6946,7 +6946,7 @@ export interface Diagnostic extends DiagnosticRelatedInformation { export type DiagnosticArguments = (string | number)[]; /** @internal */ -export type DiagnosticAndArguments = [message: DiagnosticMessage, ...args: DiagnosticArguments]; +export type DiagnosticAndArguments = readonly [message: DiagnosticMessage, ...args: DiagnosticArguments]; export interface DiagnosticRelatedInformation { category: DiagnosticCategory; @@ -7372,10 +7372,16 @@ export interface CreateProgramOptions { typeScriptVersion?: string; } + /** @internal */ +export type CommandLineOptionExtraValidation = (value: CompilerOptionsValue, valueExpression?: Expression) => + DiagnosticAndArguments | + { diagnostics: DiagnosticAndArguments; errorNode: Expression; } | + undefined; + /** @internal */ export interface CommandLineOptionBase { name: string; - type: "string" | "number" | "boolean" | "object" | "list" | "listOrElement" | Map; // a value of a primitive type, or an object literal mapping named values to actual values + type: "string" | "number" | "boolean" | "object" | "list" | "listOrElement" | "string | object" | Map; // a value of a primitive type, or an object literal mapping named values to actual values isFilePath?: boolean; // True if option value is a path or fileName shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' description?: DiagnosticMessage; // The message describing what the command line switch does. @@ -7395,8 +7401,8 @@ export interface CommandLineOptionBase { affectsDeclarationPath?: true; // true if the options affects declaration file path computed affectsBuildInfo?: true; // true if this options should be emitted in buildInfo transpileOptionValue?: boolean | undefined; // If set this means that the option should be set to this value when transpiling - extraValidation?: (value: CompilerOptionsValue) => [DiagnosticMessage, ...string[]] | undefined; // Additional validation to be performed for the value to be valid - disallowNullOrUndefined?: true; // If set option does not allow setting null + extraValidation?: CommandLineOptionExtraValidation; // Additional validation to be performed for the value to be valid + disallowNullOrUndefined?: true; // If set option does not allow setting null } /** @internal */ @@ -7439,8 +7445,8 @@ export interface DidYouMeanOptionsDiagnostics { } /** @internal */ -export interface TsConfigOnlyOption extends CommandLineOptionBase { - type: "object"; +export interface CommandLineOptionOfObjectType extends CommandLineOptionBase { + type: "object" | "string | object"; elementOptions?: Map; extraKeyDiagnostics?: DidYouMeanOptionsDiagnostics; } @@ -7448,12 +7454,12 @@ export interface TsConfigOnlyOption extends CommandLineOptionBase { /** @internal */ export interface CommandLineOptionOfListType extends CommandLineOptionBase { type: "list" | "listOrElement"; - element: CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption; + element: CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | CommandLineOptionOfObjectType; listPreserveFalsyValues?: boolean; } /** @internal */ -export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | TsConfigOnlyOption | CommandLineOptionOfListType; +export type CommandLineOption = CommandLineOptionOfCustomType | CommandLineOptionOfStringType | CommandLineOptionOfNumberType | CommandLineOptionOfBooleanType | CommandLineOptionOfObjectType | CommandLineOptionOfListType; /** @internal */ export const enum CharacterCodes { diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index b6f1d1ddedd7c..7ea7917d36853 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -370,6 +370,7 @@ function generateOptionOutput(sys: System, option: CommandLineOption, rightAlign case "string": case "number": case "boolean": + case "string | object": return getDiagnosticText(Diagnostics.type_Colon); case "list": return getDiagnosticText(Diagnostics.one_or_more_Colon); @@ -390,6 +391,9 @@ function generateOptionOutput(sys: System, option: CommandLineOption, rightAlign case "listOrElement": possibleValues = getPossibleValues(option.element); break; + case "string | object": + possibleValues = "string"; + break; case "object": possibleValues = ""; break; diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index f49eda407ffec..397021dfd0747 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -385,8 +385,11 @@ export namespace Compiler { case "list": case "listOrElement": return ts.parseListTypeOption(option, value, errors); + case "object": + case "string | object": + return ts.parseObjectTypeOption(option, value, errors)?.value; default: - return ts.parseCustomTypeOption(option as ts.CommandLineOptionOfCustomType, value, errors); + return ts.parseCustomTypeOption(option, value, errors); } } diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index b62c282ffc9fd..a1b109e775345 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -191,6 +191,9 @@ describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => { assertParseResult("errors on invalid excludeFiles", ["--excludeFiles", "**/../*", "0.ts"]); assertParseResult("parse --watchFactory", ["--watchFactory", "somefactory", "0.ts"]); assertParseResult("errors on invalid watchFactory", ["--watchFactory", "somefactory/../malicious", "0.ts"]); + assertParseResult("parse --watchFactory object", ["--watchFactory", "{\"name\":\"somefactory\",\"myconfig\":\"somethingelse\"}", "0.ts"]); + assertParseResult("errors on invalid watchFactory name", ["--watchFactory", "{\"name\":\"somefactory/../malicious\"}", "0.ts"]); + assertParseResult("errors on invalid watchFactory object", ["--watchFactory", "{\"name\":\"myplugin\"", "0.ts"]); }); }); @@ -247,6 +250,9 @@ describe("unittests:: config:: commandLineParsing:: parseBuildOptions", () => { assertParseResult("errors on invalid excludeFiles", ["--excludeFiles", "**/../*"]); assertParseResult("parse --watchFactory", ["--watchFactory", "somefactory"]); assertParseResult("errors on invalid watchFactory", ["--watchFactory", "somefactory/../malicious"]); + assertParseResult("parse --watchFactory object", ["--watchFactory", `{"name":"somefactory","myconfig":"somethingelse"}`]); + assertParseResult("errors on invalid watchFactory name", ["--watchFactory", "{\"name\":\"somefactory/../malicious\"}"]); + assertParseResult("errors on invalid watchFactory object", ["--watchFactory", "{\"name\":\"myplugin\""]); }); }); diff --git a/src/testRunner/unittests/config/showConfig.ts b/src/testRunner/unittests/config/showConfig.ts index 5b5a7bc12c4bc..8fa821007a7fa 100644 --- a/src/testRunner/unittests/config/showConfig.ts +++ b/src/testRunner/unittests/config/showConfig.ts @@ -126,6 +126,24 @@ describe("unittests:: config:: showConfig", () => { if (option.name === "project") return; let args: string[]; let optionValue: object | undefined; + if (option.type === "string | object") { + if (option.isTSConfigOnly) { + showTSConfigCorrectly( + `Shows tsconfig for single option/${option.name}WithStringValue`, + ["-p", "tsconfig.json"], + isCompilerOptions ? + { compilerOptions: { [option.name]: "someString" } } : + { watchOptions: { [option.name]: "someString" } } + ); + } + else { + showTSConfigCorrectly( + `Shows tsconfig for single option/${option.name}WithStringValue`, + [`--${option.name}`, "someString"], + /*configJson*/ undefined, + ); + } + } switch (option.type) { case "boolean": { if (option.isTSConfigOnly) { @@ -171,6 +189,7 @@ describe("unittests:: config:: showConfig", () => { } break; } + case "string | object": case "object": { args = ["-p", "tsconfig.json"]; optionValue = { [option.name]: {} }; diff --git a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts index f324350719c44..ebdd6bf455121 100644 --- a/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts +++ b/src/testRunner/unittests/config/tsconfigParsingWatchOptions.ts @@ -127,6 +127,12 @@ describe("unittests:: config:: tsconfigParsingWatchOptions:: parseConfigFileText { json: { watchOptions: { watchFactory: "somefactory/../malicious" } }, }, + { + json: { watchOptions: { watchFactory: { name: "somefactory", myconfig: "somethingelse" } } }, + }, + { + json: { watchOptions: { watchFactory: { name: "somefactory/../malicious" } } }, + }, ]); verifyWatchOptions("watch options extending passed in watch options", () => [ diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 8644f1a4019e8..70765d6690940 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -300,8 +300,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi scenario: "watchEnvironment", ...input, subScenario: `${input.subScenario} object`, - sys: () => input.sys({ watchFactory }), - // sys: () => input.sys({ watchFactory: { name: watchFactory, myconfig: "somethingelse" } as ts.PluginImport }), + sys: () => input.sys({ watchFactory: { name: watchFactory, myconfig: "somethingelse" } as ts.PluginImport }), }); } @@ -318,8 +317,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi scenario: "watchEnvironment", ...input, subScenario: `${input.subScenario} object`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", watchFactory], - // commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], }); } }); diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index 29d922f100e74..eb0ea1d37a87e 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -890,8 +890,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po scenario, ...input, subScenario: `${input.subScenario} object`, - sys: () => input.sys({ watchFactory }), - // sys: () => input.sys({ watchFactory: { name: watchFactory, myconfig: "somethingelse" } as ts.PluginImport }), + sys: () => input.sys({ watchFactory: { name: watchFactory, myconfig: "somethingelse" } as ts.PluginImport }), }); } @@ -908,8 +907,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po scenario, ...input, subScenario: `${input.subScenario} object`, - commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", watchFactory], - // commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], + commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], }); } }); diff --git a/src/testRunner/unittests/tsserver/watchEnvironment.ts b/src/testRunner/unittests/tsserver/watchEnvironment.ts index 7ab91aff123ca..81b8c906bd941 100644 --- a/src/testRunner/unittests/tsserver/watchEnvironment.ts +++ b/src/testRunner/unittests/tsserver/watchEnvironment.ts @@ -694,9 +694,8 @@ describe("unittests:: tsserver:: watchEnvironment:: watchFactory", () => { interface PluginImport extends ts.PluginImport { myconfig: "somethingelse"; } - function getWatchFactory(watchFactory: string, _useObject: boolean): PluginImport | string { - return watchFactory; - // return useObject ? { name: watchFactory, myconfig: "somethingelse" } : watchFactory; + function getWatchFactory(watchFactory: string, useObject: boolean): PluginImport | string { + return useObject ? { name: watchFactory, myconfig: "somethingelse" } : watchFactory; } function configureGlobalWatchOptions(session: TestSession, watchFactory: string, useObject: boolean) { diff --git a/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory name.js b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory name.js new file mode 100644 index 0000000000000..baf455141ed21 --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory name.js @@ -0,0 +1,9 @@ +--watchFactory {"name":"somefactory/../malicious"} +buildOptions:: +{} +WatchOptions:: +{} +Projects:: +. +Errors:: +error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory object.js b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory object.js new file mode 100644 index 0000000000000..e2c185a51913f --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/errors on invalid watchFactory object.js @@ -0,0 +1,9 @@ +--watchFactory {"name":"myplugin" +buildOptions:: +{} +WatchOptions:: +{} +Projects:: +. +Errors:: +error TS6046: Argument for 'watchFactory' option must be: string | object. diff --git a/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory object.js b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory object.js new file mode 100644 index 0000000000000..97e664854a992 --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseBuildOptions/parse --watchFactory object.js @@ -0,0 +1,13 @@ +--watchFactory {"name":"somefactory","myconfig":"somethingelse"} +buildOptions:: +{} +WatchOptions:: +{ + "watchFactory": { + "name": "somefactory", + "myconfig": "somethingelse" + } +} +Projects:: +. +Errors:: diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory name.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory name.js new file mode 100644 index 0000000000000..211bb43079c26 --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory name.js @@ -0,0 +1,9 @@ +--watchFactory {"name":"somefactory/../malicious"} 0.ts +CompilerOptions:: +{} +WatchOptions:: +{} +FileNames:: +0.ts +Errors:: +error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory object.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory object.js new file mode 100644 index 0000000000000..8ae1826e41414 --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/errors on invalid watchFactory object.js @@ -0,0 +1,9 @@ +--watchFactory {"name":"myplugin" 0.ts +CompilerOptions:: +{} +WatchOptions:: +{} +FileNames:: +0.ts +Errors:: +error TS6046: Argument for 'watchFactory' option must be: string | object. diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory object.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory object.js new file mode 100644 index 0000000000000..c6e8e235efcdc --- /dev/null +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/parse --watchFactory object.js @@ -0,0 +1,13 @@ +--watchFactory {"name":"somefactory","myconfig":"somethingelse"} 0.ts +CompilerOptions:: +{} +WatchOptions:: +{ + "watchFactory": { + "name": "somefactory", + "myconfig": "somethingelse" + } +} +FileNames:: +0.ts +Errors:: diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json index ef316c37ec59c..684a17d81ab60 100644 --- a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactory/tsconfig.json @@ -1,6 +1,4 @@ { "compilerOptions": {}, - "watchOptions": { - "watchFactory": "someString" - } + "watchOptions": {} } diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactoryWithStringValue/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactoryWithStringValue/tsconfig.json new file mode 100644 index 0000000000000..ef316c37ec59c --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/watchFactoryWithStringValue/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": {}, + "watchOptions": { + "watchFactory": "someString" + } +} diff --git a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js index a4a4be40e9fd7..fb2a1021c2fa0 100644 --- a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js +++ b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with json api.js @@ -210,3 +210,50 @@ Result: WatchOptions:: Errors:: error TS5109: 'watchFactory' name can only be a package name. + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": { + "name": "somefactory", + "myconfig": "somethingelse" + } + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{ + "watchFactory": { + "name": "somefactory", + "myconfig": "somethingelse" + } +} +Errors:: + + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": { + "name": "somefactory/../malicious" + } + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{} +Errors:: +error TS5109: 'watchFactory' name can only be a package name. + diff --git a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js index ecffdf4c90415..99a0cb9e5d076 100644 --- a/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js +++ b/tests/baselines/reference/config/tsconfigParsingWatchOptions/different options with jsonSourceFile api.js @@ -219,3 +219,53 @@ Errors:: 3 "watchFactory": "somefactory/../malicious"    ~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": { + "name": "somefactory", + "myconfig": "somethingelse" + } + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{ + "watchFactory": { + "name": "somefactory", + "myconfig": "somethingelse" + } +} +Errors:: + + +Fs:: +//// [/a.ts] + + +//// [/tsconfig.json] +{ + "watchOptions": { + "watchFactory": { + "name": "somefactory/../malicious" + } + } +} + + +configFileName:: tsconfig.json +Result: WatchOptions:: +{} +Errors:: +tsconfig.json:4:12 - error TS5109: 'watchFactory' name can only be a package name. + +4 "name": "somefactory/../malicious" +   ~~~~~~~~~~~~~~~~~~~~~~~~~~ + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js index 39c4204942a75..dca983ccb5e35 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,19 +29,19 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -64,15 +64,15 @@ Shape signatures in builder refreshed for:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/a.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined @@ -127,8 +127,8 @@ Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:32 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js index f1219d063d1dc..7320aadd67e61 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin/../malicious"}} +{"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -27,10 +27,10 @@ interface Array { length: number; [n: number]: T; } Output:: [12:00:23 AM] Starting compilation in watch mode... -tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. +tsconfig.json:1:41 - error TS5109: 'watchFactory' name can only be a package name. -1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} -   ~~~~~~~~~~~~~~~~~~~~~~~ +1 {"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} +   ~~~~~~~~~~~~~~~~~~~~~~~ [12:00:24 AM] Found 1 error. Watching for file changes. @@ -83,10 +83,10 @@ FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInf Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json [12:00:27 AM] File change detected. Starting incremental compilation... -tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. +tsconfig.json:1:41 - error TS5109: 'watchFactory' name can only be a package name. -1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} -   ~~~~~~~~~~~~~~~~~~~~~~~ +1 {"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} +   ~~~~~~~~~~~~~~~~~~~~~~~ [12:00:28 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js index 92241db67a8b3..363065bc08ed9 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -23,25 +23,25 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory {"name":"myplugin","myconfig":"somethingelse"} Output:: [12:00:23 AM] Starting compilation in watch mode... [12:00:29 AM] Found 0 errors. Watching for file changes. -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -64,15 +64,15 @@ Shape signatures in builder refreshed for:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/a.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined @@ -127,8 +127,8 @@ Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:32 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js index af294142d0cca..525c2136b4d7c 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin/../malicious +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory {"name":"myplugin/../malicious","myconfig":"somethingelse"} Output:: error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js index 1c2353fa6d021..6b354fc77091f 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,12 +29,12 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file /user/username/projects/myproject/tsconfig.json Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -109,8 +109,8 @@ Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:32 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js index 29cc38b59ffd9..eb508429143a3 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,16 +29,16 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -69,7 +69,7 @@ FsWatches:: Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined @@ -113,8 +113,8 @@ Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:32 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. @@ -177,11 +177,11 @@ Before running Timeout callback:: count: 1 2: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json [12:00:41 AM] File change detected. Starting incremental compilation... -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:46 AM] Found 0 errors. Watching for file changes. @@ -213,7 +213,7 @@ FsWatches:: Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js index 4e6465c695c70..a00adede265d0 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,15 +29,15 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules Skipped loading plugin myplugin because it did not expose a proper factory function -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -112,8 +112,8 @@ Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:32 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js index 28d67acdd3567..766580908246c 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,16 +29,16 @@ Output:: [12:00:29 AM] Found 0 errors. Watching for file changes. -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file /user/username/projects/myproject/tsconfig.json -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file /user/username/projects/myproject/tsconfig.json +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules Failed to load module 'myplugin' from /a/lib/tsc.js/../../../node_modules: Cannot find module myPlugin at /a/lib/tsc.js/../../../node_modules Couldn't find myplugin -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -113,8 +113,8 @@ Before running Timeout callback:: count: 1 1: timerToBuildInvalidatedProject After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file /user/username/projects/myproject/tsconfig.json [12:00:32 AM] File change detected. Starting incremental compilation... [12:00:38 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js index d91f539abdf5f..64c7174e900f7 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -28,30 +28,30 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file -Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file -Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file -Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -74,19 +74,19 @@ Shape signatures in builder refreshed for:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/a.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined @@ -141,9 +141,9 @@ Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Scheduling update -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Synchronizing program [12:00:31 AM] File change detected. Starting incremental compilation... diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js index 4de9ca9bc8aa3..b6f676bf7c37f 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin/../malicious"}} +{"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -38,10 +38,10 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} S FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots -tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. +tsconfig.json:1:41 - error TS5109: 'watchFactory' name can only be a package name. -1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} -   ~~~~~~~~~~~~~~~~~~~~~~~ +1 {"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} +   ~~~~~~~~~~~~~~~~~~~~~~~ [12:00:28 AM] Found 1 error. Watching for file changes. @@ -136,10 +136,10 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. +tsconfig.json:1:41 - error TS5109: 'watchFactory' name can only be a package name. -1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} -   ~~~~~~~~~~~~~~~~~~~~~~~ +1 {"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} +   ~~~~~~~~~~~~~~~~~~~~~~~ [12:00:35 AM] Found 1 error. Watching for file changes. diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js index 3cfa08a53ffa4..556cb988365c6 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -23,35 +23,35 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory {"name":"myplugin","myconfig":"somethingelse"} Output:: [12:00:23 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file -Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file -Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file -Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +Custom watchFile: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -74,19 +74,19 @@ Shape signatures in builder refreshed for:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/a.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":250,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":250,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined @@ -141,9 +141,9 @@ Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Scheduling update -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Synchronizing program [12:00:31 AM] File change detected. Starting incremental compilation... diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js index b9b25c21827dd..86283fea172bc 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin/../malicious +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory {"name":"myplugin/../malicious","myconfig":"somethingelse"} Output:: error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js index b71d313d8c278..23cb059194c90 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -28,21 +28,21 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file Custom watchFactory is ignored because of not running in environment that supports 'require'. Watches will defualt to builtin. Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -123,9 +123,9 @@ Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Scheduling update -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Synchronizing program [12:00:31 AM] File change detected. Starting incremental compilation... diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js index bd78a9bbe4adc..489c8adf666b0 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -28,26 +28,26 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -80,9 +80,9 @@ FsWatches:: Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined @@ -126,9 +126,9 @@ Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Scheduling update -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Synchronizing program [12:00:31 AM] File change detected. Starting incremental compilation... @@ -194,9 +194,9 @@ Before running Timeout callback:: count: 1 2: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Scheduling update -Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Reloading new file names and options Synchronizing program [12:00:38 AM] File change detected. Starting incremental compilation... @@ -204,7 +204,7 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file [12:00:41 AM] Found 0 errors. Watching for file changes. @@ -238,9 +238,9 @@ FsWatches:: Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} exitCode:: ExitStatus.undefined diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js index 0603355480af0..4d4694658c086 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -28,8 +28,8 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules Skipped loading plugin myplugin because it did not expose a proper factory function @@ -37,15 +37,15 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -126,9 +126,9 @@ Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Scheduling update -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Synchronizing program [12:00:31 AM] File change detected. Starting incremental compilation... diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js index 0f65303a0f1fb..d2df900cc04df 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -7,7 +7,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -28,8 +28,8 @@ Output:: [12:00:23 AM] Starting compilation in watch mode... Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Config file -Enabling watchFactory myplugin from candidate paths: /a/lib/tsc.js/../../.. +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config file +Enabling watchFactory {"name":"myplugin","myconfig":"somethingelse"} from candidate paths: /a/lib/tsc.js/../../.. Loading myplugin from /a/lib/tsc.js/../../.. (resolved to /a/lib/tsc.js/../../../node_modules) Require:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules Failed to load module 'myplugin' from /a/lib/tsc.js/../../../node_modules: Cannot find module myPlugin at /a/lib/tsc.js/../../../node_modules @@ -38,15 +38,15 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file -FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Type roots +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Type roots [12:00:28 AM] Found 0 errors. Watching for file changes. -DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory -Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Wild card directory +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Wild card directory Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] @@ -127,9 +127,9 @@ Before running Timeout callback:: count: 1 1: timerToUpdateProgram After running Timeout callback:: count: 0 Output:: -FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Scheduling update -Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Synchronizing program [12:00:31 AM] File change detected. Starting incremental compilation... diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js index 3cba2b197ef1a..ea898a13941ac 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -58,10 +61,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -71,17 +74,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" } } -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -113,17 +116,17 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -134,10 +137,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -185,7 +188,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js index 3cba2b197ef1a..ea898a13941ac 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -58,10 +61,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -71,17 +74,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" } } -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -113,17 +116,17 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -134,10 +137,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -185,7 +188,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js index 528e0903ebca8..3669b7fe608c9 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-errors-object.js @@ -29,14 +29,17 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin/../malicious" + "watchFactory": { + "name": "myplugin/../malicious", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } Info seq [hh:mm:ss:mss] Host watch options changed to {}, it will be take effect for next watches. -Info seq [hh:mm:ss:mss] Watch options supplied had errors: Supplied options: {"watchFactory":"myplugin/../malicious"} +Info seq [hh:mm:ss:mss] Watch options supplied had errors: Supplied options: {"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Diagnostics:: error TS5109: 'watchFactory' name can only be a package name. Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index dee45b582488d..6f1f4251c9474 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -80,10 +83,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -93,17 +96,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" } } -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -135,17 +138,17 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -156,10 +159,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -207,7 +210,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js index dee45b582488d..6f1f4251c9474 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -80,10 +83,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -93,17 +96,17 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" } } -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info -Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -135,17 +138,17 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -156,10 +159,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -207,7 +210,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js index c2d27ca63706b..1803d030ec3b4 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin2" + "watchFactory": { + "name": "myplugin2", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -58,10 +61,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} -Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} +Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -71,25 +74,28 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } -Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -121,19 +127,19 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -144,17 +150,17 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -196,21 +202,21 @@ After running Timeout callback:: count: 0 Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /user/username/projects/myproject/c.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -221,10 +227,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* @@ -273,7 +279,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -296,7 +301,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } -Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js index c2d27ca63706b..1803d030ec3b4 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin2" + "watchFactory": { + "name": "myplugin2", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -58,10 +61,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} -Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} +Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -71,25 +74,28 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } -Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -121,19 +127,19 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -144,17 +150,17 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -196,21 +202,21 @@ After running Timeout callback:: count: 0 Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /user/username/projects/myproject/c.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -221,10 +227,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* @@ -273,7 +279,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -296,7 +301,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 4, "type": "request" } -Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":4,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index d4a427d75a39e..19acd1c16fd3e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin2" + "watchFactory": { + "name": "myplugin2", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -102,10 +105,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} -Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} +Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -115,25 +118,28 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } -Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -165,19 +171,19 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -188,17 +194,17 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -240,21 +246,21 @@ After running Timeout callback:: count: 0 Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /user/username/projects/myproject/c.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -265,10 +271,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* @@ -317,7 +323,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 5, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -340,7 +345,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 6, "type": "request" } -Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js index d4a427d75a39e..19acd1c16fd3e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -29,13 +29,16 @@ Info seq [hh:mm:ss:mss] request: "command": "configure", "arguments": { "watchOptions": { - "watchFactory": "myplugin2" + "watchFactory": { + "name": "myplugin2", + "myconfig": "somethingelse" + } } }, "seq": 1, "type": "request" } -Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":"myplugin2"}, it will be take effect for next watches. +Info seq [hh:mm:ss:mss] Host watch options changed to {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}, it will be take effect for next watches. Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configure","request_seq":1,"success":true} Info seq [hh:mm:ss:mss] response: @@ -102,10 +105,10 @@ Info seq [hh:mm:ss:mss] request: Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} -Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} +Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ "/user/username/projects/myproject/a.ts", @@ -115,25 +118,28 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } -Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":"myplugin2"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /a/lib/lib.d.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -165,19 +171,19 @@ After request Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -188,17 +194,17 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* Info seq [hh:mm:ss:mss] Running: /user/username/projects/myproject/tsconfig.json -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info -Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":"myplugin2"} +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info +Custom myplugin2watchFile: /user/username/projects/myproject/c.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 2 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) @@ -240,21 +246,21 @@ After running Timeout callback:: count: 0 Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} myplugin2Plugin WatchedFiles:: /user/username/projects/myproject/b.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /a/lib/lib.d.ts: - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} /user/username/projects/myproject/c.ts: *new* - {"pollingInterval":500,"options":{"watchFactory":"myplugin2"}} + {"pollingInterval":500,"options":{"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}}} Change file Before running Timeout callback:: count: 0 @@ -265,10 +271,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":"myplugin2"} WatchType: Closed Script info +Info seq [hh:mm:ss:mss] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 500 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} WatchType: Closed Script info Before running Timeout callback:: count: 2 3: /user/username/projects/myproject/tsconfig.json 4: *ensureProjectForOpenFiles* @@ -317,7 +323,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 5, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":5,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: @@ -340,7 +345,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 6, "type": "request" } -Custom:: myplugin2onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":6,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js index eaac403b930fa..2d2e6351455bc 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -46,23 +46,26 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -100,13 +103,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -117,10 +120,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -176,13 +179,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Before request @@ -198,7 +201,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js index eaac403b930fa..2d2e6351455bc 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -46,23 +46,26 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -100,13 +103,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -117,10 +120,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -176,13 +179,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Before request @@ -198,7 +201,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 2, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":2,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js index 7581269a4e4ea..3f004d2bea56f 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -68,23 +68,26 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -122,13 +125,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -139,10 +142,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -198,13 +201,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Before request @@ -220,7 +223,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js index 7581269a4e4ea..3f004d2bea56f 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js @@ -8,7 +8,7 @@ export class a { prop = "hello"; foo() { return this.prop; } } export class b { prop = "hello"; foo() { return this.prop; } } //// [/user/username/projects/myproject/tsconfig.json] -{"watchOptions":{"watchFactory":"myplugin"}} +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} //// [/a/lib/lib.d.ts] /// @@ -68,23 +68,26 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json "configFilePath": "/user/username/projects/myproject/tsconfig.json" }, "watchOptions": { - "watchFactory": "myplugin" + "watchFactory": { + "name": "myplugin", + "myconfig": "somethingelse" + } } } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file +Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} -Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory -Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 500 undefined WatchType: Closed Script info Info seq [hh:mm:ss:mss] Starting updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 500 undefined WatchType: Closed Script info -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots -Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":"myplugin"} -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots +Custom watchDirectory: /user/username/projects/myproject/node_modules/@types true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Type roots Info seq [hh:mm:ss:mss] Finishing updateGraphWorker: Project: /user/username/projects/myproject/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms Info seq [hh:mm:ss:mss] Project '/user/username/projects/myproject/tsconfig.json' (Configured) Info seq [hh:mm:ss:mss] Files (3) @@ -122,13 +125,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: *new* - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: *new* - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Add a file Before running Timeout callback:: count: 0 @@ -139,10 +142,10 @@ export class a { prop = "hello"; foo() { return this.prop; } } After running Timeout callback:: count: 0 Invoke plugin watches -Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Info seq [hh:mm:ss:mss] Scheduled: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Scheduled: *ensureProjectForOpenFiles* -Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory +Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/c.ts :: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Before running Timeout callback:: count: 2 1: /user/username/projects/myproject/tsconfig.json 2: *ensureProjectForOpenFiles* @@ -198,13 +201,13 @@ FsWatches:: Plugin WatchedFiles:: /user/username/projects/myproject/tsconfig.json: - {"pollingInterval":2000,"options":{"watchFactory":"myplugin"}} + {"pollingInterval":2000,"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Plugin WatchedDirectories:Recursive:: /user/username/projects/myproject: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} /user/username/projects/myproject/node_modules/@types: - {"options":{"watchFactory":"myplugin"}} + {"options":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}}} Before request @@ -220,7 +223,6 @@ Info seq [hh:mm:ss:mss] request: "seq": 3, "type": "request" } -Custom:: onConfigurationChanged:: {"extraData":"myData"} Info seq [hh:mm:ss:mss] response: {"seq":0,"type":"response","command":"configurePlugin","request_seq":3,"success":true,"performanceData":{"updateGraphDurationMs":*}} Info seq [hh:mm:ss:mss] response: From 077804746824d1541e40484f2703f04365493497 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 7 Oct 2022 14:49:48 -0700 Subject: [PATCH 10/13] Add searchPaths option so we know where to look for watchFactory from server which follows same locations as other Plugins --- src/compiler/sys.ts | 11 ++-- src/compiler/types.ts | 5 ++ src/server/editorServices.ts | 52 +++++++++++++++---- src/server/project.ts | 22 +++----- ...on-of-host-allowLocalPluginLoads-object.js | 2 +- ...iguration-of-host-allowLocalPluginLoads.js | 2 +- ...Factory-as-configuration-of-host-object.js | 2 +- ...inOverride-allowLocalPluginLoads-object.js | 2 +- ...th-pluginOverride-allowLocalPluginLoads.js | 2 +- ...tion-of-host-with-pluginOverride-object.js | 2 +- ...nfiguration-of-host-with-pluginOverride.js | 2 +- .../watchFactory-as-configuration-of-host.js | 2 +- ...on-of-host-allowLocalPluginLoads-object.js | 5 +- ...iguration-of-host-allowLocalPluginLoads.js | 5 +- ...as-well-as-configuration-of-host-object.js | 4 +- ...inOverride-allowLocalPluginLoads-object.js | 5 +- ...th-pluginOverride-allowLocalPluginLoads.js | 5 +- ...tion-of-host-with-pluginOverride-object.js | 4 +- ...nfiguration-of-host-with-pluginOverride.js | 4 +- ...config-as-well-as-configuration-of-host.js | 4 +- ...onfig-file-allowLocalPluginLoads-object.js | 3 +- ...ry-in-config-file-allowLocalPluginLoads.js | 3 +- .../watchFactory-in-config-file-object.js | 2 +- ...inOverride-allowLocalPluginLoads-object.js | 3 +- ...th-pluginOverride-allowLocalPluginLoads.js | 3 +- ...-config-file-with-pluginOverride-object.js | 2 +- ...tory-in-config-file-with-pluginOverride.js | 2 +- .../watchFactory-in-config-file.js | 2 +- 28 files changed, 103 insertions(+), 59 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 3587cb6e3f85b..564d91d2d06bb 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -903,7 +903,7 @@ export interface ImportPluginResult { /** @internal */ export function resolveModule( pluginConfigEntry: PluginImport, - searchPaths: string[], + searchPaths: readonly string[], host: Pick, log: (message: string) => void, ): ImportPluginResult { @@ -1002,9 +1002,12 @@ export function createSystemWatchFunctions({ sysLog(`Skipped loading watchFactory ${isString(options.watchFactory) ? options.watchFactory : JSON.stringify(options.watchFactory)} because it can be named with only package name`); return setUserWatchFactory(options, /*userWatchFactory*/ undefined); } - const searchPaths = [ - combinePaths(system.getExecutingFilePath(), "../../..") - ]; + const host = options.getHost?.(); + const searchPaths = host ? + host.searchPaths : + [ + combinePaths(system.getExecutingFilePath(), "../../..") + ]; sysLog(`Enabling watchFactory ${isString(options.watchFactory) ? options.watchFactory : JSON.stringify(options.watchFactory)} from candidate paths: ${searchPaths.join(",")}`); const { resolvedModule, errorLogs, pluginConfigEntry } = resolveModule( isString(options.watchFactory) ? { name: options.watchFactory } : options.watchFactory, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6d4b4d9e23361..6b685c31a0fb4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7212,6 +7212,10 @@ export interface UserWatchFactory { watchDirectory?(fileName: string, callback: DirectoryWatcherCallback, recursive: boolean, options: WatchOptions | undefined): FileWatcher; onConfigurationChanged?(config: any): void; } +/**@internal*/ +export interface WatchOptionsFactoryHost { + searchPaths: readonly string[]; +} export interface WatchOptions { watchFile?: WatchFileKind; watchDirectory?: WatchDirectoryKind; @@ -7223,6 +7227,7 @@ export interface WatchOptions { // All the internal properties are set as non enumerable and non configurable so that they arenot enumerated when checking if options have changed /** @internal */ getResolvedWatchFactory?(): UserWatchFactory | undefined; + /** @internal */ getHost?(): WatchOptionsFactoryHost; [option: string]: CompilerOptionsValue | Function | undefined; } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 9b154a123a764..b6cfafc36f682 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -77,6 +77,7 @@ import { map, mapDefinedEntries, mapDefinedIterator, + memoize, missingFileModifiedTime, MultiMap, noop, @@ -106,6 +107,7 @@ import { returnNoopFileWatcher, returnTrue, ScriptKind, + setWatchOptionInternalProperty, SharedExtendedConfigFileWatcher, some, SourceFile, @@ -1495,7 +1497,7 @@ export class ProjectService { * * @internal */ - private watchWildcardDirectory(directory: Path, flags: WatchDirectoryFlags, configFileName: NormalizedPath, config: ParsedConfig) { + private watchWildcardDirectory(directory: Path, flags: WatchDirectoryFlags, configFileName: NormalizedPath, canonicalConfigFilePath: NormalizedPath, config: ParsedConfig) { return this.watchFactory.watchDirectory( directory, fileOrDirectory => { @@ -1554,7 +1556,7 @@ export class ProjectService { }); }, flags, - this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine!.watchOptions), + this.getWatchOptionsFromProjectWatchOptions(config.parsedCommandLine!.watchOptions, canonicalConfigFilePath), WatchType.WildcardDirectory, configFileName ); @@ -1868,7 +1870,7 @@ export class ProjectService { configFileName, (_fileName, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind), PollingInterval.High, - this.getWatchOptionsFromProjectWatchOptions(configFileExistenceInfo?.config?.parsedCommandLine?.watchOptions), + this.getWatchOptionsFromProjectWatchOptions(configFileExistenceInfo?.config?.parsedCommandLine?.watchOptions, canonicalConfigFilePath), WatchType.ConfigFile, forProject ); @@ -2424,9 +2426,9 @@ export class ProjectService { // If watch options different than older options when setting for the first time, update the config file watcher if (!oldCommandLine && !isJsonEqual( // Old options - this.getWatchOptionsFromProjectWatchOptions(/*projectOptions*/ undefined), + this.getWatchOptionsFromProjectWatchOptions(/*projectOptions*/ undefined, canonicalConfigFilePath), // New options - this.getWatchOptionsFromProjectWatchOptions(parsedCommandLine.watchOptions) + this.getWatchOptionsFromProjectWatchOptions(parsedCommandLine.watchOptions, canonicalConfigFilePath) )) { // Reset the config file watcher configFileExistenceInfo.watcher?.close(); @@ -2472,7 +2474,7 @@ export class ProjectService { config!.watchedDirectories ||= new Map(), new Map(Object.entries(config!.parsedCommandLine!.wildcardDirectories!)), // Create new directory watcher - (directory, flags) => this.watchWildcardDirectory(directory as Path, flags, configFileName, config!), + (directory, flags) => this.watchWildcardDirectory(directory as Path, flags, configFileName, forProject.canonicalConfigFilePath, config!), ); } else { @@ -3235,6 +3237,9 @@ export class ProjectService { if (args.watchOptions) { const result = convertWatchOptions(args.watchOptions); this.hostConfiguration.watchOptions = result?.watchOptions; + if (this.hostConfiguration.watchOptions?.watchFactory) { + this.setWatchOptionsFactoryHost(this.hostConfiguration.watchOptions, /*canonicalConfigFilePath*/ undefined); + } this.projectWatchOptions.clear(); this.logger.info(`Host watch options changed to ${JSON.stringify(this.hostConfiguration.watchOptions)}, it will be take effect for next watches.`); if (result?.errors?.length) { @@ -3250,12 +3255,12 @@ export class ProjectService { } /** @internal */ - getWatchOptions(project: Project) { - return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions()); + getWatchOptions(project: Project): WatchOptions | undefined { + return this.getWatchOptionsFromProjectWatchOptions(project.getWatchOptions(), isConfiguredProject(project) ? project.canonicalConfigFilePath : undefined); } /** @internal */ - private getWatchOptionsFromProjectWatchOptions(projectOptions: WatchOptions | undefined) { + private getWatchOptionsFromProjectWatchOptions(projectOptions: WatchOptions | undefined, canonicalConfigFilePath: NormalizedPath | undefined) { if (!projectOptions) return this.hostConfiguration.watchOptions; let options = this.projectWatchOptions.get(projectOptions); if (options) return options; @@ -3263,9 +3268,17 @@ export class ProjectService { { ...this.hostConfiguration.watchOptions, ...projectOptions } : projectOptions ); + this.setWatchOptionsFactoryHost(options, canonicalConfigFilePath); return options; } + /** @internal */ + private setWatchOptionsFactoryHost(options: WatchOptions, canonicalConfigFilePath: NormalizedPath | undefined) { + setWatchOptionInternalProperty(options, "getHost", memoize(() => ({ + searchPaths: this.getProjectPluginSearchPaths(canonicalConfigFilePath) + }))); + } + /** @internal */ clearWatchOptionsFromProjectWatchOptions(projectOptions: WatchOptions | undefined) { if (projectOptions) this.projectWatchOptions.delete(projectOptions); @@ -4273,6 +4286,27 @@ export class ProjectService { return false; } + /** @internal */ + getGlobalPluginSearchPaths() { + // Search any globally-specified probe paths, then our peer node_modules + return [ + ...this.pluginProbeLocations, + // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ + combinePaths(this.getExecutingFilePath(), "../../.."), + ]; + } + + /** @internal */ + getProjectPluginSearchPaths(canonicalConfigFilePath: string | undefined) { + const searchPaths = this.getGlobalPluginSearchPaths(); + if (canonicalConfigFilePath && this.allowLocalPluginLoads) { + const local = getDirectoryPath(canonicalConfigFilePath); + this.logger.info(`Local plugin loading enabled; adding ${local} to search paths`); + searchPaths.unshift(local); + } + return searchPaths; + } + /** @internal */ requestEnablePlugin(project: Project, pluginConfigEntry: PluginImport, searchPaths: string[]) { if (!this.host.importPlugin && !this.host.require) { diff --git a/src/server/project.ts b/src/server/project.ts index 5546973bcfbce..2f08d846074b8 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1786,12 +1786,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo /** @internal */ protected getGlobalPluginSearchPaths() { - // Search any globally-specified probe paths, then our peer node_modules - return [ - ...this.projectService.pluginProbeLocations, - // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ - combinePaths(this.projectService.getExecutingFilePath(), "../../.."), - ]; + return this.projectService.getProjectPluginSearchPaths(/*canonicalConfigFilePath*/ undefined); } protected enableGlobalPlugins(options: CompilerOptions): void { @@ -1804,7 +1799,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo } // Enable global plugins with synthetic configuration entries - const searchPaths = this.getGlobalPluginSearchPaths(); + const searchPaths = this.projectService.getGlobalPluginSearchPaths(); for (const globalPluginName of this.projectService.globalPlugins) { // Skip empty names from odd commandline parses if (!globalPluginName) continue; @@ -2669,6 +2664,11 @@ export class ConfiguredProject extends Project { return this.getCurrentProgram()?.forEachResolvedProjectReference(cb); } + /** @internal */ + protected getProjectPluginSearchPaths() { + return this.projectService.getProjectPluginSearchPaths(this.canonicalConfigFilePath); + } + /** @internal */ enablePluginsWithOptions(options: CompilerOptions): void { this.plugins.length = 0; @@ -2679,14 +2679,8 @@ export class ConfiguredProject extends Project { return; } - const searchPaths = this.getGlobalPluginSearchPaths(); - if (this.projectService.allowLocalPluginLoads) { - const local = getDirectoryPath(this.canonicalConfigFilePath); - this.projectService.logger.info(`Local plugin loading enabled; adding ${local} to search paths`); - searchPaths.unshift(local); - } - // Enable tsconfig-specified plugins + const searchPaths = this.getProjectPluginSearchPaths(); if (options.plugins) { for (const pluginConfigEntry of options.plugins) { this.enablePlugin(pluginConfigEntry, searchPaths); diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js index ea898a13941ac..36e79cb26636b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -62,7 +62,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js index 3cba2b197ef1a..a4bde0c5107ba 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-allowLocalPluginLoads.js @@ -59,7 +59,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js index ea898a13941ac..36e79cb26636b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-object.js @@ -62,7 +62,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index 6f1f4251c9474..d5e59af9d294a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -84,7 +84,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index dee45b582488d..404f7ce1eb842 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -81,7 +81,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js index 6f1f4251c9474..d5e59af9d294a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js @@ -84,7 +84,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js index dee45b582488d..404f7ce1eb842 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js @@ -81,7 +81,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js index 3cba2b197ef1a..a4bde0c5107ba 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host.js @@ -59,7 +59,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js index 1803d030ec3b4..63f70befccd2b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads-object.js @@ -62,7 +62,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -82,7 +82,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js index c2d27ca63706b..a90b8ec9832d8 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-allowLocalPluginLoads.js @@ -59,7 +59,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -76,7 +76,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js index 1803d030ec3b4..326abc365efb6 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-object.js @@ -62,7 +62,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -82,7 +82,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index 19acd1c16fd3e..a72fdebec362c 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -106,7 +106,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -126,7 +126,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index d4a427d75a39e..ed8ba750797fc 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -103,7 +103,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -120,7 +120,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js index 19acd1c16fd3e..59f7943492bad 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js @@ -106,7 +106,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -126,7 +126,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js index d4a427d75a39e..1a7dc2bf7b059 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js @@ -103,7 +103,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -120,7 +120,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js index c2d27ca63706b..183db597ed048 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host.js @@ -59,7 +59,7 @@ Info seq [hh:mm:ss:mss] Search path: /user/username/projects/myproject Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Config file name: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin2 from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { @@ -76,7 +76,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js index 2d2e6351455bc..0a009348244fe 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads-object.js @@ -54,7 +54,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js index eaac403b930fa..501aaa8b52f41 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-allowLocalPluginLoads.js @@ -51,7 +51,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js index 2d2e6351455bc..db7c25155b215 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-object.js @@ -54,7 +54,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js index 3f004d2bea56f..0ac9284ac76c6 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js @@ -76,7 +76,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js index 7581269a4e4ea..4e4220213aa45 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js @@ -73,7 +73,8 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths +CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js index 3f004d2bea56f..cbc8596823157 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js @@ -76,7 +76,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js index 7581269a4e4ea..21958e9716b01 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js @@ -73,7 +73,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js index eaac403b930fa..d2a06c7a9040b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file.js @@ -51,7 +51,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json } Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file -CustomRequire:: Resolving myplugin from /a/lib/tsc.js/../../../node_modules +CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory From b966bb9a816d77ecb632c49adb05ebae95cc64e2 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 6 Oct 2022 10:41:12 -0700 Subject: [PATCH 11/13] Add plugin override for watchFactory --- src/compiler/sys.ts | 7 ++++++- src/compiler/types.ts | 1 + src/server/editorServices.ts | 17 +++++++++++++++-- src/server/project.ts | 10 +--------- ...uginOverride-allowLocalPluginLoads-object.js | 2 +- ...with-pluginOverride-allowLocalPluginLoads.js | 2 +- ...ration-of-host-with-pluginOverride-object.js | 2 +- ...configuration-of-host-with-pluginOverride.js | 2 +- ...uginOverride-allowLocalPluginLoads-object.js | 4 ++-- ...with-pluginOverride-allowLocalPluginLoads.js | 4 ++-- ...ration-of-host-with-pluginOverride-object.js | 4 ++-- ...configuration-of-host-with-pluginOverride.js | 4 ++-- ...uginOverride-allowLocalPluginLoads-object.js | 2 +- ...with-pluginOverride-allowLocalPluginLoads.js | 2 +- ...in-config-file-with-pluginOverride-object.js | 2 +- ...actory-in-config-file-with-pluginOverride.js | 2 +- 16 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 564d91d2d06bb..eeaed1a003d41 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1010,7 +1010,7 @@ export function createSystemWatchFunctions({ ]; sysLog(`Enabling watchFactory ${isString(options.watchFactory) ? options.watchFactory : JSON.stringify(options.watchFactory)} from candidate paths: ${searchPaths.join(",")}`); const { resolvedModule, errorLogs, pluginConfigEntry } = resolveModule( - isString(options.watchFactory) ? { name: options.watchFactory } : options.watchFactory, + getWatchFactoryPlugin(options), searchPaths, getSystem(), sysLog @@ -1028,6 +1028,11 @@ export function createSystemWatchFunctions({ return setUserWatchFactory(options, /*userWatchFactory*/ undefined); } + function getWatchFactoryPlugin(options: WatchOptions) { + const plugin = isString(options.watchFactory) ? { name: options.watchFactory } : options.watchFactory!; + return options.getHost?.().getPluginWithConfigOverride(plugin) || plugin; + } + function setUserWatchFactory(options: WatchOptions, userWatchFactory: UserWatchFactory | undefined) { setWatchOptionInternalProperty(options, "getResolvedWatchFactory", userWatchFactory ? () => userWatchFactory : returnUndefined); return userWatchFactory; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6b685c31a0fb4..c0f0d4e34d9f5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7215,6 +7215,7 @@ export interface UserWatchFactory { /**@internal*/ export interface WatchOptionsFactoryHost { searchPaths: readonly string[]; + getPluginWithConfigOverride(plugin: PluginImport): PluginImport; } export interface WatchOptions { watchFile?: WatchFileKind; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index b6cfafc36f682..8ca8811e9b11a 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -972,7 +972,7 @@ export class ProjectService { public readonly pluginProbeLocations: readonly string[]; public readonly allowLocalPluginLoads: boolean; /** @internal */ - currentPluginConfigOverrides: Map | undefined; + private currentPluginConfigOverrides: Map | undefined; public readonly typesMapLocation: string | undefined; @@ -3275,7 +3275,8 @@ export class ProjectService { /** @internal */ private setWatchOptionsFactoryHost(options: WatchOptions, canonicalConfigFilePath: NormalizedPath | undefined) { setWatchOptionInternalProperty(options, "getHost", memoize(() => ({ - searchPaths: this.getProjectPluginSearchPaths(canonicalConfigFilePath) + searchPaths: this.getProjectPluginSearchPaths(canonicalConfigFilePath), + getPluginWithConfigOverride: plugin => this.getPluginWithConfigOverride(plugin), }))); } @@ -4307,6 +4308,18 @@ export class ProjectService { return searchPaths; } + /** @internal */ + getPluginWithConfigOverride(pluginConfigEntry: PluginImport) { + const configurationOverride = this.currentPluginConfigOverrides?.get(pluginConfigEntry.name); + if (configurationOverride) { + // Preserve the name property since it's immutable + const pluginName = pluginConfigEntry.name; + pluginConfigEntry = configurationOverride; + pluginConfigEntry.name = pluginName; + } + return pluginConfigEntry; + } + /** @internal */ requestEnablePlugin(project: Project, pluginConfigEntry: PluginImport, searchPaths: string[]) { if (!this.host.importPlugin && !this.host.require) { diff --git a/src/server/project.ts b/src/server/project.ts index 2f08d846074b8..33cc686faf95e 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1821,15 +1821,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo */ endEnablePlugin({ pluginConfigEntry, resolvedModule, errorLogs }: BeginEnablePluginResult) { if (resolvedModule) { - const configurationOverride = this.projectService.currentPluginConfigOverrides?.get(pluginConfigEntry.name); - if (configurationOverride) { - // Preserve the name property since it's immutable - const pluginName = pluginConfigEntry.name; - pluginConfigEntry = configurationOverride; - pluginConfigEntry.name = pluginName; - } - - this.enableProxy(resolvedModule, pluginConfigEntry); + this.enableProxy(resolvedModule, this.projectService.getPluginWithConfigOverride(pluginConfigEntry)); } else { forEach(errorLogs, message => this.projectService.logger.info(message)); diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index d5e59af9d294a..f24019ab6f786 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -85,7 +85,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index 404f7ce1eb842..3126d8ecc3136 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -82,7 +82,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js index d5e59af9d294a..f24019ab6f786 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride-object.js @@ -85,7 +85,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js index 404f7ce1eb842..3126d8ecc3136 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-as-configuration-of-host-with-pluginOverride.js @@ -82,7 +82,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js index a72fdebec362c..1d647c4f0b8fa 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads-object.js @@ -107,7 +107,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Require:: Module myplugin2 created with config: {"init2":"initialConfig2","name":"myplugin2"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ @@ -128,7 +128,7 @@ Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/project Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules -Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js index ed8ba750797fc..aa970505adb3f 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-allowLocalPluginLoads.js @@ -104,7 +104,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Require:: Module myplugin2 created with config: {"init2":"initialConfig2","name":"myplugin2"} and options: {"watchFactory":"myplugin2"} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ @@ -122,7 +122,7 @@ Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/project Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js index 59f7943492bad..30c56e20e583e 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride-object.js @@ -107,7 +107,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} +Require:: Module myplugin2 created with config: {"init2":"initialConfig2","name":"myplugin2"} and options: {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ @@ -127,7 +127,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin2","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js index 1a7dc2bf7b059..b995c8af7b01b 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-as-well-as-configuration-of-host-with-pluginOverride.js @@ -104,7 +104,7 @@ Info seq [hh:mm:ss:mss] For info: /user/username/projects/myproject/a.ts :: Con Info seq [hh:mm:ss:mss] Creating configuration project /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin2 from /a/pluginprobe1/node_modules -Require:: Module myplugin2 created with config: {"name":"myplugin2"} and options: {"watchFactory":"myplugin2"} +Require:: Module myplugin2 created with config: {"init2":"initialConfig2","name":"myplugin2"} and options: {"watchFactory":"myplugin2"} Custom myplugin2watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json : { "rootNames": [ @@ -121,7 +121,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin2"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js index 0ac9284ac76c6..4cfb466240d87 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads-object.js @@ -78,7 +78,7 @@ Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/project Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules -Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js index 4e4220213aa45..ddf990f11eef3 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-allowLocalPluginLoads.js @@ -75,7 +75,7 @@ Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/project Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] Local plugin loading enabled; adding /user/username/projects/myproject to search paths CustomRequire:: Resolving myplugin from /user/username/projects/myproject/node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js index cbc8596823157..3d5535d9371cb 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride-object.js @@ -77,7 +77,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"somethingelse"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} diff --git a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js index 21958e9716b01..cd5ebd315564a 100644 --- a/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js +++ b/tests/baselines/reference/tsserver/watchEnvironment/watchFactory-in-config-file-with-pluginOverride.js @@ -74,7 +74,7 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/tsconfig.json Info seq [hh:mm:ss:mss] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Project: /user/username/projects/myproject/tsconfig.json WatchType: Config file CustomRequire:: Resolving myplugin from /a/pluginprobe1/node_modules -Require:: Module myplugin created with config: {"name":"myplugin"} and options: {"watchFactory":"myplugin"} +Require:: Module myplugin created with config: {"init":"initialConfig","name":"myplugin"} and options: {"watchFactory":"myplugin"} Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFactory":"myplugin"} Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {"watchFactory":"myplugin"} Config: /user/username/projects/myproject/tsconfig.json WatchType: Wild card directory Custom watchDirectory: /user/username/projects/myproject true {"watchFactory":"myplugin"} From 774b5d2a33e448596e953307ff678170a824542d Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 2 Mar 2023 15:09:20 -0800 Subject: [PATCH 12/13] Instead of passing complete typescript, pass in selected --- src/compiler/sys.ts | 3 +-- src/compiler/types.ts | 14 ++++++++++++-- tests/baselines/reference/api/tsserverlibrary.d.ts | 6 +++++- tests/baselines/reference/api/typescript.d.ts | 6 +++++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index eeaed1a003d41..c142e5278732c 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { AssertionLevel, closeFileWatcher, @@ -1016,7 +1015,7 @@ export function createSystemWatchFunctions({ sysLog ); if (typeof resolvedModule === "function") { - return setUserWatchFactory(options, resolvedModule({ typescript: ts, options, config: pluginConfigEntry })); + return setUserWatchFactory(options, resolvedModule({ typescript: { sys, FileWatcherEventKind }, options, config: pluginConfigEntry })); } else if (!resolvedModule) { forEach(errorLogs, sysLog); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c0f0d4e34d9f5..e7883c7c88862 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,4 +1,3 @@ -import * as ts from "./_namespaces/ts"; import { BaseNodeFactory, CreateSourceFileOptions, @@ -6,6 +5,7 @@ import { EmitHelperFactory, FileWatcher, FileWatcherCallback, + FileWatcherEventKind, GetCanonicalFileName, MapLike, ModeAwareCache, @@ -19,6 +19,7 @@ import { Pattern, ProgramBuildInfo, SymlinkCache, + System, ThisContainer, } from "./_namespaces/ts"; @@ -7206,7 +7207,16 @@ export interface CompilerOptions { [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } -export type UserWatchFactoryModule = (mod: { typescript: typeof ts, options: WatchOptions, config: any }) => UserWatchFactory; +export interface TypeScriptSubsetForWatchFactory { + sys: System; + FileWatcherEventKind: typeof FileWatcherEventKind; +} + +export type UserWatchFactoryModule = (mod: { + typescript: TypeScriptSubsetForWatchFactory; + options: WatchOptions; + config: any; +}) => UserWatchFactory; export interface UserWatchFactory { watchFile?(fileName: string, callback: FileWatcherCallback, pollingInterval: number, options: WatchOptions | undefined): FileWatcher; watchDirectory?(fileName: string, callback: DirectoryWatcherCallback, recursive: boolean, options: WatchOptions | undefined): FileWatcher; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 5484b36bd15f8..b7625bea52c12 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -7227,8 +7227,12 @@ declare namespace ts { useDefineForClassFields?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } + interface TypeScriptSubsetForWatchFactory { + sys: System; + FileWatcherEventKind: typeof FileWatcherEventKind; + } type UserWatchFactoryModule = (mod: { - typescript: typeof ts; + typescript: TypeScriptSubsetForWatchFactory; options: WatchOptions; config: any; }) => UserWatchFactory; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 5b55b7eae3ed0..afeadf318eab9 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3214,8 +3214,12 @@ declare namespace ts { useDefineForClassFields?: boolean; [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined; } + interface TypeScriptSubsetForWatchFactory { + sys: System; + FileWatcherEventKind: typeof FileWatcherEventKind; + } type UserWatchFactoryModule = (mod: { - typescript: typeof ts; + typescript: TypeScriptSubsetForWatchFactory; options: WatchOptions; config: any; }) => UserWatchFactory; From 9031ac6bb3a10e4983b2bdf00f39246b03431728 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 10 Mar 2023 11:49:22 -0800 Subject: [PATCH 13/13] Add allowPlugins on commandline which is needed to resolve watchFactory --- src/compiler/commandLineParser.ts | 57 +++++- src/compiler/diagnosticMessages.json | 8 + src/compiler/tsbuildPublic.ts | 3 +- src/compiler/types.ts | 1 + src/compiler/watch.ts | 12 +- src/compiler/watchPublic.ts | 8 +- src/executeCommandLine/executeCommandLine.ts | 4 +- .../unittests/reuseProgramStructure.ts | 2 +- .../unittests/tsbuild/outputPaths.ts | 2 +- .../tsbuildWatch/watchEnvironment.ts | 52 +++-- .../unittests/tsc/cancellationToken.ts | 7 +- .../unittests/tscWatch/incremental.ts | 4 +- .../unittests/tscWatch/watchEnvironment.ts | 52 +++-- .../reference/api/tsserverlibrary.d.ts | 4 +- tests/baselines/reference/api/typescript.d.ts | 4 +- .../allowPlugins/tsconfig.json | 5 + .../allowPlugins-is-in-tsconfig-object.js | 118 +++++++++++ .../allowPlugins-is-in-tsconfig.js | 118 +++++++++++ .../watchFactory/in-config-file-object.js | 6 +- .../in-config-file-with-error-object.js | 6 +- .../watchFactory/in-config-file-with-error.js | 6 +- .../watchFactory/in-config-file.js | 6 +- .../through-commandline-object.js | 6 +- .../through-commandline-with-error-object.js | 2 +- .../through-commandline-with-error.js | 2 +- .../watchFactory/through-commandline.js | 6 +- ...-host-does-not-implement-require-object.js | 6 +- .../when-host-does-not-implement-require.js | 6 +- ...in-does-not-implements-watchFile-object.js | 8 +- ...en-plugin-does-not-implements-watchFile.js | 8 +- ...n-doesnt-return-factory-function-object.js | 6 +- ...n-plugin-doesnt-return-factory-function.js | 6 +- .../when-plugin-not-found-object.js | 6 +- .../watchFactory/when-plugin-not-found.js | 6 +- .../without-allowPlugins-object.js | 108 ++++++++++ .../watchFactory/without-allowPlugins.js | 108 ++++++++++ .../allowPlugins-is-in-tsconfig-object.js | 189 ++++++++++++++++++ .../allowPlugins-is-in-tsconfig.js | 189 ++++++++++++++++++ .../watchFactory/in-config-file-object.js | 10 +- .../in-config-file-with-error-object.js | 10 +- .../watchFactory/in-config-file-with-error.js | 10 +- .../watchFactory/in-config-file.js | 10 +- .../through-commandline-object.js | 10 +- .../through-commandline-with-error-object.js | 2 +- .../through-commandline-with-error.js | 2 +- .../watchFactory/through-commandline.js | 10 +- ...-host-does-not-implement-require-object.js | 10 +- .../when-host-does-not-implement-require.js | 10 +- ...in-does-not-implements-watchFile-object.js | 14 +- ...en-plugin-does-not-implements-watchFile.js | 14 +- ...n-doesnt-return-factory-function-object.js | 10 +- ...n-plugin-doesnt-return-factory-function.js | 10 +- .../when-plugin-not-found-object.js | 10 +- .../watchFactory/when-plugin-not-found.js | 10 +- .../without-allowPlugins-object.js | 179 +++++++++++++++++ .../watchFactory/without-allowPlugins.js | 179 +++++++++++++++++ 56 files changed, 1487 insertions(+), 170 deletions(-) create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowPlugins/tsconfig.json create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js create mode 100644 tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js create mode 100644 tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins.js diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d64e08712da14..3e233f4928598 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -62,9 +62,11 @@ import { getSupportedExtensions, getSupportedExtensionsWithJsonIfResolveJsonModule, getTextOfPropertyName, + getTsConfigObjectLiteralExpression, getTsConfigPropArrayElementValue, hasExtension, hasProperty, + identity, ImportsNotUsedAsValues, isArray, isArrayLiteralExpression, @@ -527,6 +529,14 @@ export const commonOptionsWithBuild: CommandLineOption[] = [ description: Diagnostics.Set_the_language_of_the_messaging_from_TypeScript_This_does_not_affect_emit, defaultValueDescription: Diagnostics.Platform_specific }, + { + name: "allowPlugins", + type: "boolean", + category: Diagnostics.Command_line_Options, + isCommandLineOnly: true, + description: Diagnostics.Allow_running_plugins, + defaultValueDescription: false, + }, ]; /** @internal */ @@ -1821,6 +1831,10 @@ export function parseCommandLineWorker( const errors: Diagnostic[] = []; parseStrings(commandLine); + if (options.watch && watchOptions?.watchFactory && !options.allowPlugins) { + errors.push(createCompilerDiagnostic(Diagnostics.Option_watchFactory_cannot_be_specified_without_passing_allowPlugins_on_command_line)); + watchOptions.watchFactory = undefined; + } return { options, watchOptions, @@ -2098,6 +2112,7 @@ export function getParsedCommandLineOfConfigFile( extendedConfigCache?: Map, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[], + checkAllowPlugins?: boolean, ): ParsedCommandLine | undefined { const configFileText = tryReadFile(configFileName, fileName => host.readFile(fileName)); if (!isString(configFileText)) { @@ -2119,7 +2134,8 @@ export function getParsedCommandLineOfConfigFile( /*resolutionStack*/ undefined, extraFileExtensions, extendedConfigCache, - watchOptionsToExtend + watchOptionsToExtend, + checkAllowPlugins, ); } @@ -2854,9 +2870,20 @@ export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, bas * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ -export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map, existingWatchOptions?: WatchOptions): ParsedCommandLine { +export function parseJsonSourceFileConfigFileContent( + sourceFile: TsConfigSourceFile, + host: ParseConfigHost, + basePath: string, + existingOptions?: CompilerOptions, + configFileName?: string, + resolutionStack?: Path[], + extraFileExtensions?: readonly FileExtensionInfo[], + extendedConfigCache?: Map, + existingWatchOptions?: WatchOptions, + checkAllowPlugins?: boolean, +): ParsedCommandLine { tracing?.push(tracing.Phase.Parse, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName }); - const result = parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache); + const result = parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, checkAllowPlugins); tracing?.pop(); return result; } @@ -2900,7 +2927,8 @@ function parseJsonConfigFileContentWorker( configFileName?: string, resolutionStack: Path[] = [], extraFileExtensions: readonly FileExtensionInfo[] = [], - extendedConfigCache?: Map + extendedConfigCache?: Map, + checkAllowPlugins?: boolean, ): ParsedCommandLine { Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined)); const errors: Diagnostic[] = []; @@ -2912,6 +2940,21 @@ function parseJsonConfigFileContentWorker( extend(existingWatchOptions || {}, parsedConfig.watchOptions || {}) : undefined; + if (options.watch && watchOptions?.watchFactory && checkAllowPlugins && !options.allowPlugins) { + const watchFactoryNameProp = forEachPropertyAssignment( + getTsConfigObjectLiteralExpression(sourceFile), + "watchOptions", + prop => isObjectLiteralExpression(prop.initializer) ? + forEachPropertyAssignment(prop.initializer, "watchFactory", watchFactoryProp => isObjectLiteralExpression(watchFactoryProp.initializer) ? + forEachPropertyAssignment(watchFactoryProp.initializer, "name", identity) || watchFactoryProp : + watchFactoryProp + ) : + undefined + ); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, watchFactoryNameProp?.name, Diagnostics.Option_watchFactory_cannot_be_specified_without_passing_allowPlugins_on_command_line)); + watchOptions.watchFactory = undefined; + } + options.configFilePath = configFileName && normalizeSlashes(configFileName); const configFileSpecs = getConfigFileSpecs(); if (sourceFile) sourceFile.configFileSpecs = configFileSpecs; @@ -3535,7 +3578,11 @@ export function convertJsonOption( convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression as ArrayLiteralExpression | undefined, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile); } - else if (!isString(opt.type)) { + if (opt.isCommandLineOnly) { + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name)); + return; + } + if (!isString(opt.type)) { return convertJsonOptionOfCustomType(opt as CommandLineOptionOfCustomType, value as string, errors, valueExpression, sourceFile); } const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile); diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 3666f73db9036..8260eb8636139 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4337,6 +4337,10 @@ "category": "Error", "code": 5109 }, + "Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line.": { + "category": "Error", + "code": 5110 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", @@ -6107,6 +6111,10 @@ "category": "Message", "code": 6804 }, + "Allow running plugins.": { + "category": "Message", + "code": 6805 + }, "one of:": { "category": "Message", diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 95668468d36f0..b0b45c00aafae 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -161,6 +161,7 @@ export interface BuildOptions { /** @internal */ locale?: string; /** @internal */ generateCpuProfile?: string; /** @internal */ generateTrace?: string; + /** @internal */ allowPlugins?: boolean; [option: string]: CompilerOptionsValue | undefined; } @@ -567,7 +568,7 @@ function parseConfigFile(state: SolutionBuilderState diagnostic = d; - parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache, baseWatchOptions); + parsed = getParsedCommandLineOfConfigFile(configFileName, baseCompilerOptions, parseConfigFileHost, extendedConfigCache, baseWatchOptions, /*extraFileExtensions*/ undefined, state.hostWithWatch.checkAllowPlugins); parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = noop; } configFileCache.set(configFilePath, parsed || diagnostic!); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e7883c7c88862..caa029b0d65fc 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7158,6 +7158,7 @@ export interface CompilerOptions { */ pathsBasePath?: string; /** @internal */ plugins?: PluginImport[]; + /** @internal */ allowPlugins?: boolean; preserveConstEnums?: boolean; noImplicitOverride?: boolean; preserveSymlinks?: boolean; diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 682430f0776f0..1dc381bb71599 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -213,10 +213,18 @@ export function createWatchStatusReporter(system: System, pretty?: boolean): Wat * * @internal */ -export function parseConfigFileWithSystem(configFileName: string, optionsToExtend: CompilerOptions, extendedConfigCache: Map | undefined, watchOptionsToExtend: WatchOptions | undefined, system: System, reportDiagnostic: DiagnosticReporter): ParsedCommandLine | undefined { +export function parseConfigFileWithSystem( + configFileName: string, + optionsToExtend: CompilerOptions, + extendedConfigCache: Map | undefined, + watchOptionsToExtend: WatchOptions | undefined, + system: System, + reportDiagnostic: DiagnosticReporter, + checkAllowPlugins: boolean, +): ParsedCommandLine | undefined { const host: ParseConfigFileHost = system as any; host.onUnRecoverableConfigFileDiagnostic = diagnostic => reportUnrecoverableDiagnostic(system, reportDiagnostic, diagnostic); - const result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend); + const result = getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache, watchOptionsToExtend, /*extraFileExtensions*/ undefined, checkAllowPlugins); host.onUnRecoverableConfigFileDiagnostic = undefined!; // TODO: GH#18217 return result; } diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index fec0b5e34611b..332dc64b7d246 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -161,6 +161,7 @@ export interface WatchHost { setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; /** If provided, will be used to reset existing delayed compilation */ clearTimeout?(timeoutId: any): void; + /** @internal */ checkAllowPlugins?: boolean; } export interface ProgramHost { /** @@ -902,7 +903,8 @@ export function createWatchProgram(host: WatchCompiler parseConfigFileHost, extendedConfigCache ||= new Map(), watchOptionsToExtend, - extraFileExtensions + extraFileExtensions, + host.checkAllowPlugins, )!); // TODO: GH#18217 } @@ -962,7 +964,9 @@ export function createWatchProgram(host: WatchCompiler /*optionsToExtend*/ undefined, parseConfigFileHost, extendedConfigCache ||= new Map(), - watchOptionsToExtend + watchOptionsToExtend, + host.extraFileExtensions, + host.checkAllowPlugins, ); parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = onUnRecoverableConfigFileDiagnostic; return parsedCommandLine; diff --git a/src/executeCommandLine/executeCommandLine.ts b/src/executeCommandLine/executeCommandLine.ts index 7ea7917d36853..5608376411d7e 100644 --- a/src/executeCommandLine/executeCommandLine.ts +++ b/src/executeCommandLine/executeCommandLine.ts @@ -645,7 +645,7 @@ function executeCommandLineWorker( ); if (configFileName) { const extendedConfigCache = new Map(); - const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys, reportDiagnostic)!; // TODO: GH#18217 + const configParseResult = parseConfigFileWithSystem(configFileName, commandLineOptions, extendedConfigCache, commandLine.watchOptions, sys, reportDiagnostic, /*checkAllowPlugins*/ true)!; // TODO: GH#18217 if (commandLineOptions.showConfig) { if (configParseResult.errors.length !== 0) { reportDiagnostic = updateReportDiagnostic( @@ -847,6 +847,7 @@ function performBuild( ); const solutionPerformance = enableSolutionPerformance(sys, buildOptions); updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance); + buildHost.checkAllowPlugins = true; const onWatchStatusChange = buildHost.onWatchStatusChange; let reportBuildStatistics = false; buildHost.onWatchStatusChange = (d, newLine, options, errorCount) => { @@ -979,6 +980,7 @@ function updateWatchCompilationHost( cb: ExecuteCommandLineCallbacks, watchCompilerHost: WatchCompilerHost, ) { + watchCompilerHost.checkAllowPlugins = true; updateCreateProgram(sys, watchCompilerHost, /*isBuildMode*/ false); const emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate!; // TODO: GH#18217 watchCompilerHost.afterProgramCreate = builderProgram => { diff --git a/src/testRunner/unittests/reuseProgramStructure.ts b/src/testRunner/unittests/reuseProgramStructure.ts index e987263cd81c3..d1d46a01f3e35 100644 --- a/src/testRunner/unittests/reuseProgramStructure.ts +++ b/src/testRunner/unittests/reuseProgramStructure.ts @@ -586,7 +586,7 @@ describe("unittests:: Reuse program structure:: isProgramUptoDate", () => { configFileName, system })).getCurrentProgram().getProgram(); - const { fileNames, options } = ts.parseConfigFileWithSystem(configFileName, {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, ts.notImplemented)!; // TODO: GH#18217 + const { fileNames, options } = ts.parseConfigFileWithSystem(configFileName, {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, ts.notImplemented, /*checkAllowPlugins*/ true)!; // TODO: GH#18217 verifyProgramIsUptoDate(program, fileNames, options); } diff --git a/src/testRunner/unittests/tsbuild/outputPaths.ts b/src/testRunner/unittests/tsbuild/outputPaths.ts index 9623743ed4de3..261d373df98d9 100644 --- a/src/testRunner/unittests/tsbuild/outputPaths.ts +++ b/src/testRunner/unittests/tsbuild/outputPaths.ts @@ -32,7 +32,7 @@ describe("unittests:: tsbuild - output file paths", () => { assert.deepEqual( ts.getOutputFileNames( - ts.parseConfigFileWithSystem("/src/tsconfig.json", {}, /*extendedConfigCache*/ undefined, {}, sys, ts.noop)!, + ts.parseConfigFileWithSystem("/src/tsconfig.json", {}, /*extendedConfigCache*/ undefined, {}, sys, ts.noop, /*checkAllowPlugins*/ true)!, "/src/src/index.ts", /*ignoreCase*/ false ), diff --git a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts index 70765d6690940..80ee8b8f1af22 100644 --- a/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tsbuildWatch/watchEnvironment.ts @@ -128,7 +128,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi describe("watchFactory", () => { verifyWatchFactory({ subScenario: `watchFactory/in config file`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--allowPlugins"], sys: createSystemWithFactory, edits: [ { @@ -146,7 +146,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi verifyWatchFactory({ subScenario: `watchFactory/in config file with error`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--allowPlugins"], sys: createSystemWithFactory, edits: [ { @@ -186,7 +186,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi verifyWatchFactory({ subScenario: `watchFactory/when plugin not found`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--allowPlugins"], sys: watchOptions => { const system = createSystem(watchOptions); system.require = (initialPath, moduleName) => { @@ -209,8 +209,8 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi verifyWatchFactory({ subScenario: `watchFactory/when plugin does not implements watchFile`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], - sys: watchOptions => createSystemWithFactory(watchOptions, /*excludeWatchFile*/ true), + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--allowPlugins"], + sys: watchOptions => createSystemWithFactory(watchOptions, /*compilerOptions*/ undefined, /*excludeWatchFile*/ true), edits: [ { caption: "Change file", @@ -232,7 +232,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi verifyWatchFactory({ subScenario: `watchFactory/when plugin doesnt return factory function`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--allowPlugins"], sys: watchOptions => { const system = createSystem(watchOptions); system.require = (initialPath, moduleName) => { @@ -255,7 +255,7 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi verifyWatchFactory({ subScenario: `watchFactory/when host does not implement require`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--allowPlugins"], sys: createSystem, edits: [ { @@ -266,10 +266,36 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi ] }, "myplugin"); - function createSystem(watchOptions?: ts.WatchOptions) { + verifyWatchFactory({ + subScenario: `watchFactory/without allowPlugins`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: () => createSystemWithFactory({ watchFactory: "myplugin" }), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/allowPlugins is in tsconfig`, + commandLineArgs: ["-b", "-w", "--extendedDiagnostics"], + sys: watchOptions => createSystemWithFactory(watchOptions, { allowPlugins: true }), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + function createSystem(watchOptions?: ts.WatchOptions, compilerOptions?: ts.CompilerOptions) { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ watchOptions }) + content: JSON.stringify({ watchOptions, compilerOptions }) }; const aTs: File = { path: `/user/username/projects/myproject/a.ts`, @@ -283,8 +309,8 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi return createWatchFactorySystem(createWatchedSystem([aTs, bTs, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" })); } - function createSystemWithFactory(watchOptions?: ts.WatchOptions, excludeWatchFile?: boolean) { - return implementRequireForWatchFactorySystem(createSystem(watchOptions), !!excludeWatchFile); + function createSystemWithFactory(watchOptions?: ts.WatchOptions, compilerOptions?: ts.CompilerOptions, excludeWatchFile?: boolean) { + return implementRequireForWatchFactorySystem(createSystem(watchOptions, compilerOptions), !!excludeWatchFile); } function verifyWatchFactory( @@ -311,13 +337,13 @@ describe("unittests:: tsbuildWatch:: watchEnvironment:: tsbuild:: watchMode:: wi verifyTscWatch({ scenario: "watchEnvironment", ...input, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", watchFactory], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", watchFactory, "--allowPlugins"], }); verifyTscWatch({ scenario: "watchEnvironment", ...input, subScenario: `${input.subScenario} object`, - commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], + commandLineArgs: ["-b", "-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" }), "--allowPlugins"], }); } }); diff --git a/src/testRunner/unittests/tsc/cancellationToken.ts b/src/testRunner/unittests/tsc/cancellationToken.ts index 04eeb68ebbad0..fdb399e0252bd 100644 --- a/src/testRunner/unittests/tsc/cancellationToken.ts +++ b/src/testRunner/unittests/tsc/cancellationToken.ts @@ -61,10 +61,11 @@ describe("unittests:: tsc:: builder cancellationToken", () => { const parsedConfig = ts.parseConfigFileWithSystem( "tsconfig.json", {}, - /*extendedConfigCache*/ undefined, - /*watchOptionsToExtend*/ undefined, + /*extendedConfigCache*/ undefined, + /*watchOptionsToExtend*/ undefined, sys, - reportDiagnostic + reportDiagnostic, + /*checkAllowPlugins*/ true, )!; const host = ts.createIncrementalCompilerHost(parsedConfig.options, sys); let programs: CommandLineProgram[] = ts.emptyArray; diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index bc73995f46282..7888a4277ba04 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -154,7 +154,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { it("verify that state is read correctly", () => { const system = createWatchedSystem([libFile, file1, fileModified, config], { currentDirectory: project }); const reportDiagnostic = ts.createDiagnosticReporter(system); - const parsedConfig = ts.parseConfigFileWithSystem("tsconfig.json", {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, reportDiagnostic)!; + const parsedConfig = ts.parseConfigFileWithSystem("tsconfig.json", {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, reportDiagnostic, /*checkAllowPlugins*/ true)!; ts.performIncrementalCompilation({ rootNames: parsedConfig.fileNames, options: parsedConfig.options, @@ -164,7 +164,7 @@ describe("unittests:: tsc-watch:: emit file --incremental", () => { system }); - const command = ts.parseConfigFileWithSystem("tsconfig.json", {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, ts.noop)!; + const command = ts.parseConfigFileWithSystem("tsconfig.json", {}, /*extendedConfigCache*/ undefined, /*watchOptionsToExtend*/ undefined, system, ts.noop, /*checkAllowPlugins*/ true)!; const builderProgram = ts.createIncrementalProgram({ rootNames: command.fileNames, options: command.options, diff --git a/src/testRunner/unittests/tscWatch/watchEnvironment.ts b/src/testRunner/unittests/tscWatch/watchEnvironment.ts index eb0ea1d37a87e..a8978ab548d5a 100644 --- a/src/testRunner/unittests/tscWatch/watchEnvironment.ts +++ b/src/testRunner/unittests/tscWatch/watchEnvironment.ts @@ -718,7 +718,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po describe("watchFactory", () => { verifyWatchFactory({ subScenario: `watchFactory/in config file`, - commandLineArgs: ["-w", "--extendedDiagnostics"], + commandLineArgs: ["-w", "--extendedDiagnostics", "--allowPlugins"], sys: createSystemWithFactory, edits: [ { @@ -736,7 +736,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po verifyWatchFactory({ subScenario: `watchFactory/in config file with error`, - commandLineArgs: ["-w", "--extendedDiagnostics"], + commandLineArgs: ["-w", "--extendedDiagnostics", "--allowPlugins"], sys: createSystemWithFactory, edits: [ { @@ -776,7 +776,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po verifyWatchFactory({ subScenario: `watchFactory/when plugin not found`, - commandLineArgs: ["-w", "--extendedDiagnostics"], + commandLineArgs: ["-w", "--extendedDiagnostics", "--allowPlugins"], sys: watchOptions => { const system = createSystem(watchOptions); system.require = (initialPath, moduleName) => { @@ -799,8 +799,8 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po verifyWatchFactory({ subScenario: `watchFactory/when plugin does not implements watchFile`, - commandLineArgs: ["-w", "--extendedDiagnostics"], - sys: watchOptions => createSystemWithFactory(watchOptions, /*excludeWatchFile*/ true), + commandLineArgs: ["-w", "--extendedDiagnostics", "--allowPlugins"], + sys: watchOptions => createSystemWithFactory(watchOptions, /*compilerOptions*/ undefined, /*excludeWatchFile*/ true), edits: [ { caption: "Change file", @@ -822,7 +822,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po verifyWatchFactory({ subScenario: `watchFactory/when plugin doesnt return factory function`, - commandLineArgs: ["-w", "--extendedDiagnostics"], + commandLineArgs: ["-w", "--extendedDiagnostics", "--allowPlugins"], sys: watchOptions => { const system = createSystem(watchOptions); system.require = (initialPath, moduleName) => { @@ -845,7 +845,7 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po verifyWatchFactory({ subScenario: `watchFactory/when host does not implement require`, - commandLineArgs: ["-w", "--extendedDiagnostics"], + commandLineArgs: ["-w", "--extendedDiagnostics", "--allowPlugins"], sys: createSystem, edits: [ { @@ -856,10 +856,36 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po ] }, "myplugin"); - function createSystem(watchOptions?: ts.WatchOptions) { + verifyWatchFactory({ + subScenario: `watchFactory/without allowPlugins`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: () => createSystemWithFactory({ watchFactory: "myplugin" }), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + verifyWatchFactory({ + subScenario: `watchFactory/allowPlugins is in tsconfig`, + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: watchOptions => createSystemWithFactory(watchOptions, { allowPlugins: true }), + edits: [ + { + caption: "Change file", + edit: sys => sys.appendFile(`/user/username/projects/myproject/b.ts`, "export function foo() { }"), + timeouts: sys => sys.runQueuedTimeoutCallbacks(), + }, + ] + }, "myplugin"); + + function createSystem(watchOptions?: ts.WatchOptions, compilerOptions?: ts.CompilerOptions) { const configFile: File = { path: `/user/username/projects/myproject/tsconfig.json`, - content: JSON.stringify({ watchOptions }) + content: JSON.stringify({ watchOptions, compilerOptions }) }; const aTs: File = { path: `/user/username/projects/myproject/a.ts`, @@ -873,8 +899,8 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po return createWatchFactorySystem(createWatchedSystem([aTs, bTs, configFile, libFile], { currentDirectory: "/user/username/projects/myproject" })); } - function createSystemWithFactory(watchOptions?: ts.WatchOptions, excludeWatchFile?: boolean) { - return implementRequireForWatchFactorySystem(createSystem(watchOptions), !!excludeWatchFile); + function createSystemWithFactory(watchOptions?: ts.WatchOptions, compilerOptions?: ts.CompilerOptions, excludeWatchFile?: boolean) { + return implementRequireForWatchFactorySystem(createSystem(watchOptions, compilerOptions), !!excludeWatchFile); } function verifyWatchFactory( @@ -901,13 +927,13 @@ describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different po verifyTscWatch({ scenario, ...input, - commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", watchFactory], + commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", watchFactory, "--allowPlugins"], }); verifyTscWatch({ scenario, ...input, subScenario: `${input.subScenario} object`, - commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" })], + commandLineArgs: ["-w", "--extendedDiagnostics", "--watchFactory", JSON.stringify({ name: watchFactory, myconfig: "somethingelse" }), "--allowPlugins"], }); } }); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index b7625bea52c12..864fd0ad78316 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -9141,7 +9141,7 @@ declare namespace ts { /** * Reads the config file, reports errors if any and exits if the config file cannot be found */ - function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions | undefined, host: ParseConfigFileHost, extendedConfigCache?: Map, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined; + function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions | undefined, host: ParseConfigFileHost, extendedConfigCache?: Map, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[], checkAllowPlugins?: boolean): ParsedCommandLine | undefined; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -9183,7 +9183,7 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map, existingWatchOptions?: WatchOptions): ParsedCommandLine; + function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map, existingWatchOptions?: WatchOptions, checkAllowPlugins?: boolean): ParsedCommandLine; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index afeadf318eab9..4167b0e63c089 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -5128,7 +5128,7 @@ declare namespace ts { /** * Reads the config file, reports errors if any and exits if the config file cannot be found */ - function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions | undefined, host: ParseConfigFileHost, extendedConfigCache?: Map, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined; + function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions | undefined, host: ParseConfigFileHost, extendedConfigCache?: Map, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[], checkAllowPlugins?: boolean): ParsedCommandLine | undefined; /** * Read tsconfig.json file * @param fileName The path to the config file @@ -5170,7 +5170,7 @@ declare namespace ts { * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map, existingWatchOptions?: WatchOptions): ParsedCommandLine; + function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map, existingWatchOptions?: WatchOptions, checkAllowPlugins?: boolean): ParsedCommandLine; function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions; errors: Diagnostic[]; diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowPlugins/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowPlugins/tsconfig.json new file mode 100644 index 0000000000000..6e51943502d7d --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowPlugins/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "allowPlugins": true + } +} diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js new file mode 100644 index 0000000000000..abadd6496be9f --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js @@ -0,0 +1,118 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +tsconfig.json:1:100 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +tsconfig.json:1:34 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~ + +[12:00:24 AM] Found 2 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +[12:00:27 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:100 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +tsconfig.json:1:34 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~ + +[12:00:28 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js new file mode 100644 index 0000000000000..7cbb8a22c1aa2 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js @@ -0,0 +1,118 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +tsconfig.json:1:64 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +[12:00:24 AM] Found 2 errors. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +[12:00:27 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:64 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js index dca983ccb5e35..c6cffd0505c8e 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -45,7 +45,7 @@ Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"n Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -136,7 +136,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js index 7320aadd67e61..a8e94ccfedbcb 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -42,7 +42,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} S Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -93,7 +93,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js index f1219d063d1dc..51f9c8e85f3a4 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file-with-error.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -42,7 +42,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} S Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -93,7 +93,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js index 39c4204942a75..7581ad5133b43 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/in-config-file.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -45,7 +45,7 @@ Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"my Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -136,7 +136,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js index 363065bc08ed9..0061f33fe3c51 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory {"name":"myplugin","myconfig":"somethingelse"} +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory {"name":"myplugin","myconfig":"somethingelse"} --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -45,7 +45,7 @@ Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"n Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -136,7 +136,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js index 525c2136b4d7c..b001646297e2f 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory {"name":"myplugin/../malicious","myconfig":"somethingelse"} +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory {"name":"myplugin/../malicious","myconfig":"somethingelse"} --allowPlugins Output:: error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js index af294142d0cca..27736fbbd7da0 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline-with-error.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin/../malicious +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin/../malicious --allowPlugins Output:: error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js index 92241db67a8b3..a657d8ee58464 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/through-commandline.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin +/a/lib/tsc.js -b -w --extendedDiagnostics --watchFactory myplugin --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -45,7 +45,7 @@ Custom watchFile: /user/username/projects/myproject/b.ts 250 {"watchFactory":"my Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -136,7 +136,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js index 6b354fc77091f..6a3a05031bb50 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -38,7 +38,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -118,7 +118,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js index 1c2353fa6d021..c23b964949afa 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -38,7 +38,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -118,7 +118,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js index eb508429143a3..c0875bb5a7ee1 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -42,7 +42,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -122,7 +122,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -187,7 +187,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js index 29cc38b59ffd9..a82db309f4512 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -42,7 +42,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -122,7 +122,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -187,7 +187,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js index a00adede265d0..74f57bb66aa87 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -41,7 +41,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -121,7 +121,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js index 4e6465c695c70..5dcff669a6366 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -41,7 +41,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -121,7 +121,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js index 766580908246c..f0c43c5c263e6 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -42,7 +42,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -122,7 +122,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js index 28d67acdd3567..e3f3462695255 100644 --- a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/when-plugin-not-found.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -b -w --extendedDiagnostics +/a/lib/tsc.js -b -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -42,7 +42,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"wa Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -122,7 +122,7 @@ Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.t Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js new file mode 100644 index 0000000000000..5dd855ddd5b20 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js @@ -0,0 +1,108 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:24 AM] Found 1 error. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +[12:00:27 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins.js b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins.js new file mode 100644 index 0000000000000..5dd855ddd5b20 --- /dev/null +++ b/tests/baselines/reference/tsbuildWatch/watchEnvironment/watchFactory/without-allowPlugins.js @@ -0,0 +1,108 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -b -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:24 AM] Found 1 error. Watching for file changes. + +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file /user/username/projects/myproject/tsconfig.json +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToBuildInvalidatedProject +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file /user/username/projects/myproject/tsconfig.json +[12:00:27 AM] File change detected. Starting incremental compilation... + +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +No cached semantic diagnostics in the builder:: + +No shapes updated in the builder:: + +exitCode:: ExitStatus.undefined + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js new file mode 100644 index 0000000000000..ce902dce96e2c --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig-object.js @@ -0,0 +1,189 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +tsconfig.json:1:34 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~ + +tsconfig.json:1:100 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 2 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +tsconfig.json:1:34 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~ + +tsconfig.json:1:100 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +[12:00:35 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js new file mode 100644 index 0000000000000..804232b163ae7 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/allowPlugins-is-in-tsconfig.js @@ -0,0 +1,189 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +tsconfig.json:1:64 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 2 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +tsconfig.json:1:64 - error TS6266: Option 'allowPlugins' can only be specified on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"},"compilerOptions":{"allowPlugins":true}} +   ~~~~~~~~~~~~~~ + +[12:00:35 AM] Found 2 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js index 64c7174e900f7..cd7e5eff59e8c 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -37,7 +37,7 @@ Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFa Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file @@ -55,7 +55,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -149,13 +149,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js index b6f676bf7c37f..118552ac68deb 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -32,7 +32,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file @@ -50,7 +50,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -135,7 +135,7 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} tsconfig.json:1:41 - error TS5109: 'watchFactory' name can only be a package name. 1 {"watchOptions":{"watchFactory":{"name":"myplugin/../malicious","myconfig":"somethingelse"}}} @@ -146,7 +146,7 @@ CreatingProgramWith:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js index 4de9ca9bc8aa3..0ef4517da3b4a 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file-with-error.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -32,7 +32,7 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file @@ -50,7 +50,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -135,7 +135,7 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} tsconfig.json:1:33 - error TS5109: 'watchFactory' name can only be a package name. 1 {"watchOptions":{"watchFactory":"myplugin/../malicious"}} @@ -146,7 +146,7 @@ CreatingProgramWith:: Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js index d91f539abdf5f..6eb3c85cd063a 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/in-config-file.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -37,7 +37,7 @@ Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFa Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file @@ -55,7 +55,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -149,13 +149,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js index 556cb988365c6..c8a2808a85912 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics --watchFactory {"name":"myplugin","myconfig":"somethingelse"} +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory {"name":"myplugin","myconfig":"somethingelse"} --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -37,7 +37,7 @@ Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFa Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file @@ -55,7 +55,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -149,13 +149,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js index 86283fea172bc..7f546dddc7404 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics --watchFactory {"name":"myplugin/../malicious","myconfig":"somethingelse"} +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory {"name":"myplugin/../malicious","myconfig":"somethingelse"} --allowPlugins Output:: error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js index b9b25c21827dd..d0af41748424a 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline-with-error.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin/../malicious +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin/../malicious --allowPlugins Output:: error TS5109: 'watchFactory' name can only be a package name. diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js index 3cfa08a53ffa4..962863958da89 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/through-commandline.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin +/a/lib/tsc.js -w --extendedDiagnostics --watchFactory myplugin --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -37,7 +37,7 @@ Custom watchFile: /user/username/projects/myproject/tsconfig.json 2000 {"watchFa Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file Custom watchFile: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file @@ -55,7 +55,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -149,13 +149,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js index 23cb059194c90..6f35cfe8b6e8f 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -33,7 +33,7 @@ Custom watchFactory is ignored because of not running in environment that suppor Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file @@ -46,7 +46,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -131,13 +131,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js index b71d313d8c278..f5eab72f79521 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-host-does-not-implement-require.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -33,7 +33,7 @@ Custom watchFactory is ignored because of not running in environment that suppor Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file @@ -46,7 +46,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -131,13 +131,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js index 489c8adf666b0..2bdc3dd66b3e0 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -36,7 +36,7 @@ Require:: Module myplugin created with config: {"name":"myplugin","myconfig":"so Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file @@ -51,7 +51,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -134,13 +134,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts @@ -203,14 +203,14 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file [12:00:41 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js index bd78a9bbe4adc..92303e0bc92bc 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-does-not-implements-watchFile.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -36,7 +36,7 @@ Require:: Module myplugin created with config: {"name":"myplugin"} and options: Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file @@ -51,7 +51,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -134,13 +134,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts @@ -203,14 +203,14 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/c.ts 250 {"watchFactory":"myplugin"} Source file [12:00:41 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts","/user/username/projects/myproject/c.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js index 4d4694658c086..f37c2b12aff42 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -36,7 +36,7 @@ Skipped loading plugin myplugin because it did not expose a proper factory funct Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file @@ -49,7 +49,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -134,13 +134,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js index 0603355480af0..0d975ba18f444 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-doesnt-return-factory-function.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -36,7 +36,7 @@ Skipped loading plugin myplugin because it did not expose a proper factory funct Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file @@ -49,7 +49,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -134,13 +134,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js index d2df900cc04df..786b6f584c390 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found-object.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -37,7 +37,7 @@ Couldn't find myplugin Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":{"name":"myplugin","myconfig":"somethingelse"}} Source file @@ -50,7 +50,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -135,13 +135,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js index 0f65303a0f1fb..553485e3aa33a 100644 --- a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/when-plugin-not-found.js @@ -23,7 +23,7 @@ interface String { charAt: any; } interface Array { length: number; [n: number]: T; } -/a/lib/tsc.js -w --extendedDiagnostics +/a/lib/tsc.js -w --extendedDiagnostics --allowPlugins Output:: [12:00:23 AM] Starting compilation in watch mode... @@ -37,7 +37,7 @@ Couldn't find myplugin Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {"watchFactory":"myplugin"} Source file FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {"watchFactory":"myplugin"} Source file @@ -50,7 +50,7 @@ Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/mypr Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Not Program files:: /a/lib/lib.d.ts @@ -135,13 +135,13 @@ Synchronizing program CreatingProgramWith:: roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] - options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} + options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} [12:00:35 AM] Found 0 errors. Watching for file changes. Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] -Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program options: {"watch":true,"extendedDiagnostics":true,"allowPlugins":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} Program structureReused: Completely Program files:: /a/lib/lib.d.ts diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js new file mode 100644 index 0000000000000..6d993c66f8747 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins-object.js @@ -0,0 +1,179 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:35 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + + diff --git a/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins.js b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins.js new file mode 100644 index 0000000000000..6d993c66f8747 --- /dev/null +++ b/tests/baselines/reference/tscWatch/watchEnvironment/watchFactory/without-allowPlugins.js @@ -0,0 +1,179 @@ +currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false +Input:: +//// [/user/username/projects/myproject/a.ts] +export class a { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } } + +//// [/user/username/projects/myproject/tsconfig.json] +{"watchOptions":{"watchFactory":"myplugin"}} + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 {} Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/a.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 {} Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 {} Type roots +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:28 AM] Found 1 error. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 {} Wild card directory + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/a.ts (used version) +/user/username/projects/myproject/b.ts (used version) + +PolledWatches:: +/user/username/projects/myproject/node_modules/@types: *new* + {"pollingInterval":500} + +FsWatches:: +/user/username/projects/myproject/tsconfig.json: *new* + {} +/user/username/projects/myproject/a.ts: *new* + {} +/user/username/projects/myproject/b.ts: *new* + {} +/a/lib/lib.d.ts: *new* + {} + +FsWatchesRecursive:: +/user/username/projects/myproject: *new* + {} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +var a = /** @class */ (function () { + function a() { + this.prop = "hello"; + } + a.prototype.foo = function () { return this.prop; }; + return a; +}()); +exports.a = a; + + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; + + + +Change:: Change file + +Input:: +//// [/user/username/projects/myproject/b.ts] +export class b { prop = "hello"; foo() { return this.prop; } }export function foo() { } + + +Before running Timeout callback:: count: 1 +1: timerToUpdateProgram +After running Timeout callback:: count: 0 +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/b.ts 1:: WatchInfo: /user/username/projects/myproject/b.ts 250 {} Source file +Synchronizing program +[12:00:31 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] + options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +tsconfig.json:1:18 - error TS5110: Option 'watchFactory' cannot be specified without passing '--allowPlugins' on command line. + +1 {"watchOptions":{"watchFactory":"myplugin"}} +   ~~~~~~~~~~~~~~ + +[12:00:35 AM] Found 1 error. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/b.ts"] +Program options: {"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Completely +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/a.ts +/user/username/projects/myproject/b.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/b.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/b.ts (computed .d.ts) + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/b.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.foo = exports.b = void 0; +var b = /** @class */ (function () { + function b() { + this.prop = "hello"; + } + b.prototype.foo = function () { return this.prop; }; + return b; +}()); +exports.b = b; +function foo() { } +exports.foo = foo; + +