From 3f4e1516e0a956e1e0d46d9caf2a1f896fb77aaa Mon Sep 17 00:00:00 2001 From: merceyz Date: Tue, 17 Aug 2021 15:02:18 +0200 Subject: [PATCH] fix: preserve path in references that doesn't target a package root --- src/server/project.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/project.ts b/src/server/project.ts index c92938ddf10ea..74ef968ff10cc 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -2254,7 +2254,9 @@ namespace ts.server { const getPnpPath = (path: string) => { try { const targetLocator = pnpApi.findPackageLocator(`${path}/`); - return pnpApi.resolveToUnqualified(targetLocator.name, `${basePath}/`); + const {packageLocation} = pnpApi.getPackageInformation(targetLocator); + const request = combinePaths(targetLocator.name, getRelativePathFromDirectory(packageLocation, path, false)); + return pnpApi.resolveToUnqualified(request, `${basePath}/`); } catch { // something went wrong with the resolution, try not to fail return path;