From 5aa0a79dacf1269ffdc0809c6d9211d41f45d5f3 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 2 May 2018 15:37:22 -0700 Subject: [PATCH] Use 'firstDefined' in 'enablePlugin' (#23825) --- src/server/project.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/project.ts b/src/server/project.ts index 4a5ca9bffaf..52ccd1be6a1 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1092,14 +1092,14 @@ namespace ts.server { this.projectService.logger.info(message); }; - for (const searchPath of searchPaths) { - const resolvedModule = Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log); - if (resolvedModule) { - this.enableProxy(resolvedModule, pluginConfigEntry); - return; - } + const resolvedModule = firstDefined(searchPaths, searchPath => + Project.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log)); + if (resolvedModule) { + this.enableProxy(resolvedModule, pluginConfigEntry); + } + else { + this.projectService.logger.info(`Couldn't find ${pluginConfigEntry.name}`); } - this.projectService.logger.info(`Couldn't find ${pluginConfigEntry.name}`); } private enableProxy(pluginModuleFactory: PluginModuleFactory, configEntry: PluginImport) {