Skip to content

Commit e221ad7

Browse files
committed
fix(sdks): update for VSCode 1.68
1 parent b0d142b commit e221ad7

File tree

4 files changed

+77
-30
lines changed

4 files changed

+77
-30
lines changed

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

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,18 @@ const moduleWrapper = tsserver => {
6161
//
6262
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6363
//
64-
// Update 2021-10-08: VSCode changed their format in 1.61.
64+
// 2021-10-08: VSCode changed the 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.
68+
// 2022-04-06: VSCode changed the format in 1.66.
6969
// Before | ^/zip//c:/foo/bar.zip/package.json
7070
// After | ^/zip/c:/foo/bar.zip/package.json
7171
//
72+
// 2022-05-06: VSCode changed the format in 1.68
73+
// Before | ^/zip/c:/foo/bar.zip/package.json
74+
// After | ^/zip//c:/foo/bar.zip/package.json
75+
//
7276
case `vscode <1.61`: {
7377
str = `^zip:${str}`;
7478
} break;
@@ -77,10 +81,14 @@ const moduleWrapper = tsserver => {
7781
str = `^/zip/${str}`;
7882
} break;
7983

80-
case `vscode`: {
84+
case `vscode <1.68`: {
8185
str = `^/zip${str}`;
8286
} break;
8387

88+
case `vscode`: {
89+
str = `^/zip/${str}`;
90+
} break;
91+
8492
// To make "go to definition" work,
8593
// We have to resolve the actual file system path from virtual path
8694
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@@ -127,9 +135,7 @@ const moduleWrapper = tsserver => {
127135

128136
case `vscode`:
129137
default: {
130-
return process.platform === `win32`
131-
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
132-
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
138+
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
133139
} break;
134140
}
135141
}
@@ -169,10 +175,19 @@ const moduleWrapper = tsserver => {
169175
) {
170176
hostInfo = parsedMessage.arguments.hostInfo;
171177
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
172-
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) {
173-
hostInfo += ` <1.61`;
174-
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) {
175-
hostInfo += ` <1.66`;
178+
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
179+
// The RegExp from https://semver.org/ but without the caret at the start
180+
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
181+
) ?? []).map(Number)
182+
183+
if (major === 1) {
184+
if (minor < 61) {
185+
hostInfo += ` <1.61`;
186+
} else if (minor < 66) {
187+
hostInfo += ` <1.66`;
188+
} else if (minor < 68) {
189+
hostInfo += ` <1.68`;
190+
}
176191
}
177192
}
178193
}

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

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,18 @@ const moduleWrapper = tsserver => {
6161
//
6262
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
6363
//
64-
// Update 2021-10-08: VSCode changed their format in 1.61.
64+
// 2021-10-08: VSCode changed the 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.
68+
// 2022-04-06: VSCode changed the format in 1.66.
6969
// Before | ^/zip//c:/foo/bar.zip/package.json
7070
// After | ^/zip/c:/foo/bar.zip/package.json
7171
//
72+
// 2022-05-06: VSCode changed the format in 1.68
73+
// Before | ^/zip/c:/foo/bar.zip/package.json
74+
// After | ^/zip//c:/foo/bar.zip/package.json
75+
//
7276
case `vscode <1.61`: {
7377
str = `^zip:${str}`;
7478
} break;
@@ -77,10 +81,14 @@ const moduleWrapper = tsserver => {
7781
str = `^/zip/${str}`;
7882
} break;
7983

80-
case `vscode`: {
84+
case `vscode <1.68`: {
8185
str = `^/zip${str}`;
8286
} break;
8387

88+
case `vscode`: {
89+
str = `^/zip/${str}`;
90+
} break;
91+
8492
// To make "go to definition" work,
8593
// We have to resolve the actual file system path from virtual path
8694
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@@ -127,9 +135,7 @@ const moduleWrapper = tsserver => {
127135

128136
case `vscode`:
129137
default: {
130-
return process.platform === `win32`
131-
? str.replace(/^\^?(zip:|\/zip)\/+/, ``)
132-
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`);
138+
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
133139
} break;
134140
}
135141
}
@@ -169,10 +175,19 @@ const moduleWrapper = tsserver => {
169175
) {
170176
hostInfo = parsedMessage.arguments.hostInfo;
171177
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
172-
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) {
173-
hostInfo += ` <1.61`;
174-
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) {
175-
hostInfo += ` <1.66`;
178+
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
179+
// The RegExp from https://semver.org/ but without the caret at the start
180+
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
181+
) ?? []).map(Number)
182+
183+
if (major === 1) {
184+
if (minor < 61) {
185+
hostInfo += ` <1.61`;
186+
} else if (minor < 66) {
187+
hostInfo += ` <1.66`;
188+
} else if (minor < 68) {
189+
hostInfo += ` <1.68`;
190+
}
176191
}
177192
}
178193
}

.yarn/versions/0d403b34.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: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,18 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
8888
//
8989
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
9090
//
91-
// Update 2021-10-08: VSCode changed their format in 1.61.
91+
// 2021-10-08: VSCode changed the format in 1.61.
9292
// Before | ^zip:/c:/foo/bar.zip/package.json
9393
// After | ^/zip//c:/foo/bar.zip/package.json
9494
//
95-
// Update 2022-04-06: VSCode changed the format in 1.66.
95+
// 2022-04-06: VSCode changed the format in 1.66.
9696
// Before | ^/zip//c:/foo/bar.zip/package.json
9797
// After | ^/zip/c:/foo/bar.zip/package.json
9898
//
99+
// 2022-05-06: VSCode changed the format in 1.68
100+
// Before | ^/zip/c:/foo/bar.zip/package.json
101+
// After | ^/zip//c:/foo/bar.zip/package.json
102+
//
99103
case \`vscode <1.61\`: {
100104
str = \`^zip:\${str}\`;
101105
} break;
@@ -104,10 +108,14 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
104108
str = \`^/zip/\${str}\`;
105109
} break;
106110
107-
case \`vscode\`: {
111+
case \`vscode <1.68\`: {
108112
str = \`^/zip\${str}\`;
109113
} break;
110114
115+
case \`vscode\`: {
116+
str = \`^/zip/\${str}\`;
117+
} break;
118+
111119
// To make "go to definition" work,
112120
// We have to resolve the actual file system path from virtual path
113121
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
@@ -154,9 +162,7 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
154162
155163
case \`vscode\`:
156164
default: {
157-
return process.platform === \`win32\`
158-
? str.replace(/^\\^?(zip:|\\/zip)\\/+/, \`\`)
159-
: str.replace(/^\\^?(zip:|\\/zip)\\/+/, \`/\`);
165+
return str.replace(/^\\^?(zip:|\\/zip(\\/ts-nul-authority)?)\\/+/, process.platform === \`win32\` ? \`\` : \`/\`)
160166
} break;
161167
}
162168
}
@@ -196,10 +202,19 @@ export const generateTypescriptBaseWrapper: GenerateBaseWrapper = async (pnpApi:
196202
) {
197203
hostInfo = parsedMessage.arguments.hostInfo;
198204
if (hostInfo === \`vscode\` && process.env.VSCODE_IPC_HOOK) {
199-
if (/(\\/|-)1\\.([1-5][0-9]|60)\\./.test(process.env.VSCODE_IPC_HOOK)) {
200-
hostInfo += \` <1.61\`;
201-
} else if (/(\\/|-)1\\.(6[1-5])\\./.test(process.env.VSCODE_IPC_HOOK)) {
202-
hostInfo += \` <1.66\`;
205+
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
206+
// The RegExp from https://semver.org/ but without the caret at the start
207+
/(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/
208+
) ?? []).map(Number)
209+
210+
if (major === 1) {
211+
if (minor < 61) {
212+
hostInfo += \` <1.61\`;
213+
} else if (minor < 66) {
214+
hostInfo += \` <1.66\`;
215+
} else if (minor < 68) {
216+
hostInfo += \` <1.68\`;
217+
}
203218
}
204219
}
205220
}

0 commit comments

Comments
 (0)