|
|
|
@ -61,14 +61,18 @@ const moduleWrapper = tsserver => { |
|
|
|
|
//
|
|
|
|
|
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
|
|
|
|
|
//
|
|
|
|
|
// Update 2021-10-08: VSCode changed their format in 1.61.
|
|
|
|
|
// 2021-10-08: VSCode changed the format in 1.61.
|
|
|
|
|
// Before | ^zip:/c:/foo/bar.zip/package.json
|
|
|
|
|
// After | ^/zip//c:/foo/bar.zip/package.json
|
|
|
|
|
//
|
|
|
|
|
// Update 2022-04-06: VSCode changed the format in 1.66.
|
|
|
|
|
// 2022-04-06: VSCode changed the format in 1.66.
|
|
|
|
|
// Before | ^/zip//c:/foo/bar.zip/package.json
|
|
|
|
|
// After | ^/zip/c:/foo/bar.zip/package.json
|
|
|
|
|
//
|
|
|
|
|
// 2022-05-06: VSCode changed the format in 1.68
|
|
|
|
|
// Before | ^/zip/c:/foo/bar.zip/package.json
|
|
|
|
|
// After | ^/zip//c:/foo/bar.zip/package.json
|
|
|
|
|
//
|
|
|
|
|
case `vscode <1.61`: { |
|
|
|
|
str = `^zip:${str}`; |
|
|
|
|
} break; |
|
|
|
@ -77,10 +81,14 @@ const moduleWrapper = tsserver => { |
|
|
|
|
str = `^/zip/${str}`; |
|
|
|
|
} break; |
|
|
|
|
|
|
|
|
|
case `vscode`: { |
|
|
|
|
case `vscode <1.68`: { |
|
|
|
|
str = `^/zip${str}`; |
|
|
|
|
} break; |
|
|
|
|
|
|
|
|
|
case `vscode`: { |
|
|
|
|
str = `^/zip/${str}`; |
|
|
|
|
} break; |
|
|
|
|
|
|
|
|
|
// To make "go to definition" work,
|
|
|
|
|
// We have to resolve the actual file system path from virtual path
|
|
|
|
|
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
|
|
|
|
@ -127,9 +135,7 @@ const moduleWrapper = tsserver => { |
|
|
|
|
|
|
|
|
|
case `vscode`: |
|
|
|
|
default: { |
|
|
|
|
return process.platform === `win32` |
|
|
|
|
? str.replace(/^\^?(zip:|\/zip)\/+/, ``) |
|
|
|
|
: str.replace(/^\^?(zip:|\/zip)\/+/, `/`); |
|
|
|
|
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`) |
|
|
|
|
} break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -169,10 +175,19 @@ const moduleWrapper = tsserver => { |
|
|
|
|
) { |
|
|
|
|
hostInfo = parsedMessage.arguments.hostInfo; |
|
|
|
|
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) { |
|
|
|
|
if (/(\/|-)1\.([1-5][0-9]|60)\./.test(process.env.VSCODE_IPC_HOOK)) { |
|
|
|
|
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match( |
|
|
|
|
// The RegExp from https://semver.org/ but without the caret at the start
|
|
|
|
|
/(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-]+)*))?$/ |
|
|
|
|
) ?? []).map(Number) |
|
|
|
|
|
|
|
|
|
if (major === 1) { |
|
|
|
|
if (minor < 61) { |
|
|
|
|
hostInfo += ` <1.61`; |
|
|
|
|
} else if (/(\/|-)1\.(6[1-5])\./.test(process.env.VSCODE_IPC_HOOK)) { |
|
|
|
|
} else if (minor < 66) { |
|
|
|
|
hostInfo += ` <1.66`; |
|
|
|
|
} else if (minor < 68) { |
|
|
|
|
hostInfo += ` <1.68`; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|