microsoft/TypeScript

tsserver should prioritize pluginProbeLocations over peer node_modules

kyliau opened this issue · 1 comments

TypeScript Version:
3.7.0-dev.20191018

Search Terms:
tsserver plugin pluginProbeLocations

Code

// 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];

Expected behavior:
If pluginProbeLocations are provided, tsserver should always prioritize that, and use peer node_modules as fallback.

Actual behavior:
pluginProbeLocations has no effect if tsserver finds the module in peer node_modules.

From tsserver logs:
In this case, pluginProbeLocations=/Users/aioiyuuko/.vscode/extensions/angular.ng-template-0.900.0-next.2/server/node_modules/@angular/language-service
However, the path is not respected, and instead the plugin was loaded from peer node_module.

Info 9    [9:31:48.985] Enabling plugin @angular/language-service from candidate paths: /Users/aioiyuuko/workspaces/pxn/anduin/node_modules/typescript/lib/tsserverlibrary.js/../../..,/Users/aioiyuuko/.vscode/extensions/angular.ng-template-0.900.0-next.2/server/node_modules/@angular/language-service
Info 10   [9:31:48.985] Loading @angular/language-service from /Users/aioiyuuko/workspaces/pxn/anduin/node_modules/typescript/lib/tsserverlibrary.js/../../.. (resolved to /Users/aioiyuuko/workspaces/pxn/anduin/node_modules/node_modules)
Info 11   [9:31:49.111] Plugin validation succeded

Makes sense. Would take a PR to swap the order of these