From 5997d37317b183ecd12786bb45b2af247915500e Mon Sep 17 00:00:00 2001 From: Keen Yee Liau Date: Mon, 21 Oct 2019 12:58:53 -0700 Subject: [PATCH] Prioritize loading plugin from probeLocations over peer node_modules This commit reoroders the loading sequence of a tsserver plugin. It should first check `pluginProbeLocations` before checking peer node_modules. PR closes https://github.com/microsoft/TypeScript/issues/34616 --- src/server/project.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/project.ts b/src/server/project.ts index c98e7660b3838..28f9166064d34 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1359,9 +1359,12 @@ namespace ts.server { return; } - // Search our peer node_modules, then any globally-specified probe paths - // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ - const searchPaths = [combinePaths(this.projectService.getExecutingFilePath(), "../../.."), ...this.projectService.pluginProbeLocations]; + // Search any globally-specified probe paths, then our peer node_modules + const searchPaths = [ + ...this.projectService.pluginProbeLocations, + // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ + combinePaths(this.projectService.getExecutingFilePath(), "../../.."), + ]; if (this.projectService.globalPlugins) { // Enable global plugins with synthetic configuration entries