From e2cc27bec226eabaf52bd05d4ea3b44db115e463 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 22 May 2017 13:30:16 -0700 Subject: [PATCH] Update LKG --- lib/tsserver.js | 16 +++++++++++++--- lib/tsserverlibrary.d.ts | 4 ++++ lib/tsserverlibrary.js | 9 ++++++++- lib/typescript.d.ts | 1 + lib/typescriptServices.d.ts | 1 + 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/lib/tsserver.js b/lib/tsserver.js index 5f4effd9e22..347501f7049 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -74779,6 +74779,11 @@ var ts; return; } var searchPaths = [ts.combinePaths(host.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations); + if (this.projectService.allowLocalPluginLoads) { + var local = ts.getDirectoryPath(this.canonicalConfigFilePath); + this.projectService.logger.info("Local plugin loading enabled; adding " + local + " to search paths"); + searchPaths.unshift(local); + } if (options.plugins) { for (var _i = 0, _a = options.plugins; _i < _a.length; _i++) { var pluginConfigEntry = _a[_i]; @@ -75163,6 +75168,7 @@ var ts; this.eventHandler = opts.eventHandler; this.globalPlugins = opts.globalPlugins || server.emptyArray; this.pluginProbeLocations = opts.pluginProbeLocations || server.emptyArray; + this.allowLocalPluginLoads = !!opts.allowLocalPluginLoads; ts.Debug.assert(!!this.host.createHash, "'ServerHost.createHash' is required for ProjectService"); this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); this.directoryWatchers = new DirectoryWatchers(this); @@ -76743,7 +76749,8 @@ var ts; throttleWaitMilliseconds: throttleWaitMilliseconds, eventHandler: this.eventHandler, globalPlugins: opts.globalPlugins, - pluginProbeLocations: opts.pluginProbeLocations + pluginProbeLocations: opts.pluginProbeLocations, + allowLocalPluginLoads: opts.allowLocalPluginLoads }; this.projectService = new server.ProjectService(settings); this.gcTimer = new server.GcTimer(this.host, 7000, this.logger); @@ -78995,7 +79002,8 @@ var ts; logger: logger, canUseEvents: canUseEvents, globalPlugins: options.globalPlugins, - pluginProbeLocations: options.pluginProbeLocations + pluginProbeLocations: options.pluginProbeLocations, + allowLocalPluginLoads: options.allowLocalPluginLoads }) || this; if (telemetryEnabled && typingsInstaller) { typingsInstaller.setTelemetrySender(_this); @@ -79269,6 +79277,7 @@ var ts; var typingSafeListLocation = server.findArgument("--typingSafeListLocation"); var globalPlugins = (server.findArgument("--globalPlugins") || "").split(","); var pluginProbeLocations = (server.findArgument("--pluginProbeLocations") || "").split(","); + var allowLocalPluginLoads = server.hasArgument("--allowLocalPluginLoads"); var useSingleInferredProject = server.hasArgument("--useSingleInferredProject"); var disableAutomaticTypingAcquisition = server.hasArgument("--disableAutomaticTypingAcquisition"); var telemetryEnabled = server.hasArgument(server.Arguments.EnableTelemetry); @@ -79284,7 +79293,8 @@ var ts; telemetryEnabled: telemetryEnabled, logger: logger, globalPlugins: globalPlugins, - pluginProbeLocations: pluginProbeLocations + pluginProbeLocations: pluginProbeLocations, + allowLocalPluginLoads: allowLocalPluginLoads }; var ioSession = new IOSession(options); process.on("uncaughtException", function (err) { diff --git a/lib/tsserverlibrary.d.ts b/lib/tsserverlibrary.d.ts index a002578c086..4a85548039c 100644 --- a/lib/tsserverlibrary.d.ts +++ b/lib/tsserverlibrary.d.ts @@ -482,6 +482,7 @@ declare namespace ts { type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; + name?: DeclarationName; } interface NamedDeclaration extends Declaration { name?: DeclarationName; @@ -4470,6 +4471,7 @@ declare namespace ts.server { throttleWaitMilliseconds?: number; globalPlugins?: string[]; pluginProbeLocations?: string[]; + allowLocalPluginLoads?: boolean; } class Session implements EventSender { private readonly gcTimer; @@ -5048,6 +5050,7 @@ declare namespace ts.server { throttleWaitMilliseconds?: number; globalPlugins?: string[]; pluginProbeLocations?: string[]; + allowLocalPluginLoads?: boolean; } class ProjectService { readonly typingsCache: TypingsCache; @@ -5077,6 +5080,7 @@ declare namespace ts.server { private readonly eventHandler?; readonly globalPlugins: ReadonlyArray; readonly pluginProbeLocations: ReadonlyArray; + readonly allowLocalPluginLoads: boolean; constructor(opts: ProjectServiceOptions); ensureInferredProjectsUpToDate_TestOnly(): void; getCompilerOptionsForInferredProjects(): CompilerOptions; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 9ea92256e2b..19e5a45656b 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -73059,7 +73059,8 @@ var ts; throttleWaitMilliseconds: throttleWaitMilliseconds, eventHandler: this.eventHandler, globalPlugins: opts.globalPlugins, - pluginProbeLocations: opts.pluginProbeLocations + pluginProbeLocations: opts.pluginProbeLocations, + allowLocalPluginLoads: opts.allowLocalPluginLoads }; this.projectService = new server.ProjectService(settings); this.gcTimer = new server.GcTimer(this.host, 7000, this.logger); @@ -76584,6 +76585,11 @@ var ts; return; } var searchPaths = [ts.combinePaths(host.getExecutingFilePath(), "../../..")].concat(this.projectService.pluginProbeLocations); + if (this.projectService.allowLocalPluginLoads) { + var local = ts.getDirectoryPath(this.canonicalConfigFilePath); + this.projectService.logger.info("Local plugin loading enabled; adding " + local + " to search paths"); + searchPaths.unshift(local); + } if (options.plugins) { for (var _i = 0, _a = options.plugins; _i < _a.length; _i++) { var pluginConfigEntry = _a[_i]; @@ -76968,6 +76974,7 @@ var ts; this.eventHandler = opts.eventHandler; this.globalPlugins = opts.globalPlugins || server.emptyArray; this.pluginProbeLocations = opts.pluginProbeLocations || server.emptyArray; + this.allowLocalPluginLoads = !!opts.allowLocalPluginLoads; ts.Debug.assert(!!this.host.createHash, "'ServerHost.createHash' is required for ProjectService"); this.toCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); this.directoryWatchers = new DirectoryWatchers(this); diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index 75b1947e355..adeba7e8b85 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -491,6 +491,7 @@ declare namespace ts { type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; + name?: DeclarationName; } interface NamedDeclaration extends Declaration { name?: DeclarationName; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 22a06d46f97..5703ece7971 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -491,6 +491,7 @@ declare namespace ts { type DeclarationName = Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | BindingPattern; interface Declaration extends Node { _declarationBrand: any; + name?: DeclarationName; } interface NamedDeclaration extends Declaration { name?: DeclarationName;