mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Prepare Code extension for bundling
This commit is contained in:
parent
9f1a3ae5ab
commit
262a698875
4 changed files with 19 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue