Skip to content

Commit 803af17

Browse files
committed
fix(sdks): update for VSCode 1.66
1 parent 2efb4d4 commit 803af17

File tree

4 files changed

+9
-38
lines changed

4 files changed

+9
-38
lines changed

.yarn/sdks/typescript/lib/tsserver.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const moduleWrapper = tsserver => {
1818
const pnpApi = require(`pnpapi`);
1919

2020
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
21+
const isPortal = str => str.startsWith("portal:/");
2122
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
2223

2324
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
@@ -44,7 +45,7 @@ const moduleWrapper = tsserver => {
4445
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
4546
if (resolved) {
4647
const locator = pnpApi.findPackageLocator(resolved);
47-
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
48+
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
4849
str = resolved;
4950
}
5051
}
@@ -60,16 +61,8 @@ const moduleWrapper = tsserver => {
6061
//
6162
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6263
//
63-
// Update Oct 8 2021: VSCode changed their format in 1.61.
64-
// Before | ^zip:/c:/foo/bar.zip/package.json
65-
// After | ^/zip//c:/foo/bar.zip/package.json
66-
//
67-
case `vscode <1.61`: {
68-
str = `^zip:${str}`;
69-
} break;
70-
7164
case `vscode`: {
72-
str = `^/zip/${str}`;
65+
str = `^/zip${str}`;
7366
} break;
7467

7568
// To make "go to definition" work,
@@ -159,9 +152,6 @@ const moduleWrapper = tsserver => {
159152
typeof parsedMessage.arguments.hostInfo === `string`
160153
) {
161154
hostInfo = parsedMessage.arguments.hostInfo;
162-
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
163-
hostInfo += ` <1.61`;
164-
}
165155
}
166156

167157
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {

.yarn/sdks/typescript/lib/tsserverlibrary.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const moduleWrapper = tsserver => {
1818
const pnpApi = require(`pnpapi`);
1919

2020
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
21+
const isPortal = str => str.startsWith("portal:/");
2122
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
2223

2324
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
@@ -44,7 +45,7 @@ const moduleWrapper = tsserver => {
4445
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
4546
if (resolved) {
4647
const locator = pnpApi.findPackageLocator(resolved);
47-
if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) {
48+
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
4849
str = resolved;
4950
}
5051
}
@@ -60,16 +61,8 @@ const moduleWrapper = tsserver => {
6061
//
6162
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6263
//
63-
// Update Oct 8 2021: VSCode changed their format in 1.61.
64-
// Before | ^zip:/c:/foo/bar.zip/package.json
65-
// After | ^/zip//c:/foo/bar.zip/package.json
66-
//
67-
case `vscode <1.61`: {
68-
str = `^zip:${str}`;
69-
} break;
70-
7164
case `vscode`: {
72-
str = `^/zip/${str}`;
65+
str = `^/zip${str}`;
7366
} break;
7467

7568
// To make "go to definition" work,
@@ -159,9 +152,6 @@ const moduleWrapper = tsserver => {
159152
typeof parsedMessage.arguments.hostInfo === `string`
160153
) {
161154
hostInfo = parsedMessage.arguments.hostInfo;
162-
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
163-
hostInfo += ` <1.61`;
164-
}
165155
}
166156

167157
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {

.yarn/versions/4a257e90.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
releases:
2+
"@yarnpkg/sdks": patch

packages/yarnpkg-sdks/sources/sdks/base.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,8 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
8888
//
8989
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
9090
//
91-
// Update Oct 8 2021: VSCode changed their format in 1.61.
92-
// Before | ^zip:/c:/foo/bar.zip/package.json
93-
// After | ^/zip//c:/foo/bar.zip/package.json
94-
//
95-
case \`vscode <1.61\`: {
96-
str = \`^zip:\${str}\`;
97-
} break;
98-
9991
case \`vscode\`: {
100-
str = \`^/zip/\${str}\`;
92+
str = \`^/zip\${str}\`;
10193
} break;
10294
10395
// To make "go to definition" work,
@@ -187,9 +179,6 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
187179
typeof parsedMessage.arguments.hostInfo === \`string\`
188180
) {
189181
hostInfo = parsedMessage.arguments.hostInfo;
190-
if (hostInfo === \`vscode\` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\\/1\\.([1-5][0-9]|60)\\./)) {
191-
hostInfo += \` <1.61\`;
192-
}
193182
}
194183
195184
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {

0 commit comments

Comments
 (0)