Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/main.ts')
| -rw-r--r-- | editors/code/src/main.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index a06fc09fc8..e2a9c4c737 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -345,7 +345,20 @@ async function getServer(config: Config, state: PersistentState): Promise<string } const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; const dest = vscode.Uri.joinPath(config.globalStorageUri, `rust-analyzer-${platform}${ext}`); - const exists = await vscode.workspace.fs.stat(dest).then(() => true, () => false); + const bundled = vscode.Uri.joinPath(config.installUri, "server", `rust-analyzer${ext}`); + const bundledExists = await vscode.workspace.fs.stat(bundled).then(() => true, () => false); + let exists = await vscode.workspace.fs.stat(dest).then(() => true, () => false); + if (bundledExists) { + await state.updateServerVersion(config.package.version); + if (!await isNixOs()) { + return bundled.fsPath; + } + if (!exists) { + await vscode.workspace.fs.copy(bundled, dest); + await patchelf(dest); + exists = true; + } + } if (!exists) { await state.updateServerVersion(undefined); } |