Skip to content

Commit ece5547

Browse files
committed
fix(sdks): update for VSCode 1.66 (#4330)
* fix(sdks): update for VSCode 1.66 * fix: re-add version detection and fix it for Windows and Linux (cherry picked from commit 39f6b0f)
1 parent 5d4d2f2 commit ece5547

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,26 @@ const moduleWrapper = tsserver => {
6161
//
6262
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6363
//
64-
// Update Oct 8 2021: VSCode changed their format in 1.61.
64+
// Update 2021-10-08: VSCode changed their format in 1.61.
6565
// Before | ^zip:/c:/foo/bar.zip/package.json
6666
// After | ^/zip//c:/foo/bar.zip/package.json
6767
//
68+
// Update 2022-04-06: VSCode changed the format in 1.66.
69+
// Before | ^/zip//c:/foo/bar.zip/package.json
70+
// After | ^/zip/c:/foo/bar.zip/package.json
71+
//
6872
case `vscode <1.61`: {
6973
str = `^zip:${str}`;
7074
} break;
7175

72-
case `vscode`: {
76+
case `vscode <1.66`: {
7377
str = `^/zip/${str}`;
7478
} break;
7579

80+
case `vscode`: {
81+
str = `^/zip${str}`;
82+
} break;
83+
7684
// To make "go to definition" work,
7785
// We have to resolve the actual file system path from virtual path
7886
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@@ -162,8 +170,12 @@ const moduleWrapper = tsserver => {
162170
typeof parsedMessage.arguments.hostInfo === `string`
163171
) {
164172
hostInfo = parsedMessage.arguments.hostInfo;
165-
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
166-
hostInfo += ` <1.61`;
173+
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
174+
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) {
175+
hostInfo += ` <1.61`;
176+
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) {
177+
hostInfo += ` <1.66`;
178+
}
167179
}
168180
}
169181

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,26 @@ const moduleWrapper = tsserver => {
6161
//
6262
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6363
//
64-
// Update Oct 8 2021: VSCode changed their format in 1.61.
64+
// Update 2021-10-08: VSCode changed their format in 1.61.
6565
// Before | ^zip:/c:/foo/bar.zip/package.json
6666
// After | ^/zip//c:/foo/bar.zip/package.json
6767
//
68+
// Update 2022-04-06: VSCode changed the format in 1.66.
69+
// Before | ^/zip//c:/foo/bar.zip/package.json
70+
// After | ^/zip/c:/foo/bar.zip/package.json
71+
//
6872
case `vscode <1.61`: {
6973
str = `^zip:${str}`;
7074
} break;
7175

72-
case `vscode`: {
76+
case `vscode <1.66`: {
7377
str = `^/zip/${str}`;
7478
} break;
7579

80+
case `vscode`: {
81+
str = `^/zip${str}`;
82+
} break;
83+
7684
// To make "go to definition" work,
7785
// We have to resolve the actual file system path from virtual path
7886
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@@ -162,8 +170,12 @@ const moduleWrapper = tsserver => {
162170
typeof parsedMessage.arguments.hostInfo === `string`
163171
) {
164172
hostInfo = parsedMessage.arguments.hostInfo;
165-
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\/1\.([1-5][0-9]|60)\./)) {
166-
hostInfo += ` <1.61`;
173+
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
174+
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) {
175+
hostInfo += ` <1.61`;
176+
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) {
177+
hostInfo += ` <1.66`;
178+
}
167179
}
168180
}
169181

.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: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,26 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
9898
//
9999
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
100100
//
101-
// Update Oct 8 2021: VSCode changed their format in 1.61.
101+
// Update 2021-10-08: VSCode changed their format in 1.61.
102102
// Before | ^zip:/c:/foo/bar.zip/package.json
103103
// After | ^/zip//c:/foo/bar.zip/package.json
104104
//
105+
// Update 2022-04-06: VSCode changed the format in 1.66.
106+
// Before | ^/zip//c:/foo/bar.zip/package.json
107+
// After | ^/zip/c:/foo/bar.zip/package.json
108+
//
105109
case \`vscode <1.61\`: {
106110
str = \`^zip:\${str}\`;
107111
} break;
108112
109-
case \`vscode\`: {
113+
case \`vscode <1.66\`: {
110114
str = \`^/zip/\${str}\`;
111115
} break;
112116
117+
case \`vscode\`: {
118+
str = \`^/zip\${str}\`;
119+
} break;
120+
113121
// To make "go to definition" work,
114122
// We have to resolve the actual file system path from virtual path
115123
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@@ -199,8 +207,12 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
199207
typeof parsedMessage.arguments.hostInfo === \`string\`
200208
) {
201209
hostInfo = parsedMessage.arguments.hostInfo;
202-
if (hostInfo === \`vscode\` && process.env.VSCODE_IPC_HOOK && process.env.VSCODE_IPC_HOOK.match(/Code\\/1\\.([1-5][0-9]|60)\\./)) {
203-
hostInfo += \` <1.61\`;
210+
if (hostInfo === \`vscode\` && process.env.VSCODE_IPC_HOOK) {
211+
if (/(\\/|-)1\\.([1-5][0-9]|60)\\./.test(process.env.VSCODE_IPC_HOOK)) {
212+
hostInfo += \` <1.61\`;
213+
} else if (/(\\/|-)1\\.(6[1-5])\\./.test(process.env.VSCODE_IPC_HOOK)) {
214+
hostInfo += \` <1.66\`;
215+
}
204216
}
205217
}
206218

0 commit comments

Comments
 (0)