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
This commit is contained in:
Keen Yee Liau 2019-10-23 11:28:44 -07:00 committed by Ryan Cavanaugh
parent 6f04f526d4
commit f689982c9f

View File

@ -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