Skip to content

Commit

Permalink
Prioritize loading plugin from probeLocations over peer node_modules
Browse files Browse the repository at this point in the history
This commit reoroders the loading sequence of a tsserver plugin. It
should first check `pluginProbeLocations` before checking peer
node_modules.

PR closes #34616
  • Loading branch information
Keen Yee Liau authored and RyanCavanaugh committed Oct 23, 2019
1 parent 6f04f52 commit f689982
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f689982

Please sign in to comment.