aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json12
-rw-r--r--editors/code/src/main.ts2
-rw-r--r--editors/code/src/net.ts9
3 files changed, 8 insertions, 15 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 2225cf1dd..ee54638f1 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -349,6 +349,7 @@
349 "default": {}, 349 "default": {},
350 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`" 350 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`"
351 }, 351 },
352 "$generated-start": false,
352 "rust-analyzer.assist.importMergeBehavior": { 353 "rust-analyzer.assist.importMergeBehavior": {
353 "markdownDescription": "The strategy to use when inserting new imports or merging imports.", 354 "markdownDescription": "The strategy to use when inserting new imports or merging imports.",
354 "default": "full", 355 "default": "full",
@@ -390,7 +391,7 @@
390 "type": "boolean" 391 "type": "boolean"
391 }, 392 },
392 "rust-analyzer.cargo.allFeatures": { 393 "rust-analyzer.cargo.allFeatures": {
393 "markdownDescription": "Activate all available features.", 394 "markdownDescription": "Activate all available features (`--all-features`).",
394 "default": false, 395 "default": false,
395 "type": "boolean" 396 "type": "boolean"
396 }, 397 },
@@ -431,7 +432,7 @@
431 "type": "boolean" 432 "type": "boolean"
432 }, 433 },
433 "rust-analyzer.checkOnSave.allFeatures": { 434 "rust-analyzer.checkOnSave.allFeatures": {
434 "markdownDescription": "Check with all features (will be passed as `--all-features`). Defaults to `#rust-analyzer.cargo.allFeatures#`.", 435 "markdownDescription": "Check with all features (`--all-features`). Defaults to `#rust-analyzer.cargo.allFeatures#`.",
435 "default": null, 436 "default": null,
436 "type": [ 437 "type": [
437 "null", 438 "null",
@@ -439,7 +440,7 @@
439 ] 440 ]
440 }, 441 },
441 "rust-analyzer.checkOnSave.allTargets": { 442 "rust-analyzer.checkOnSave.allTargets": {
442 "markdownDescription": "Check all targets and tests (will be passed as `--all-targets`).", 443 "markdownDescription": "Check all targets and tests (`--all-targets`).",
443 "default": true, 444 "default": true,
444 "type": "boolean" 445 "type": "boolean"
445 }, 446 },
@@ -650,7 +651,7 @@
650 } 651 }
651 }, 652 },
652 "rust-analyzer.lruCapacity": { 653 "rust-analyzer.lruCapacity": {
653 "markdownDescription": "Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.", 654 "markdownDescription": "Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.",
654 "default": null, 655 "default": null,
655 "type": [ 656 "type": [
656 "null", 657 "null",
@@ -718,7 +719,8 @@
718 "items": { 719 "items": {
719 "type": "string" 720 "type": "string"
720 } 721 }
721 } 722 },
723 "$generated-end": false
722 } 724 }
723 }, 725 },
724 "problemPatterns": [ 726 "problemPatterns": [
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 1edb7713d..1900d900a 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -208,7 +208,6 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
208 url: artifact.browser_download_url, 208 url: artifact.browser_download_url,
209 dest, 209 dest,
210 progressTitle: "Downloading rust-analyzer extension", 210 progressTitle: "Downloading rust-analyzer extension",
211 overwrite: true,
212 }); 211 });
213 }); 212 });
214 213
@@ -340,7 +339,6 @@ async function getServer(config: Config, state: PersistentState): Promise<string
340 progressTitle: "Downloading rust-analyzer server", 339 progressTitle: "Downloading rust-analyzer server",
341 gunzip: true, 340 gunzip: true,
342 mode: 0o755, 341 mode: 0o755,
343 overwrite: true,
344 }); 342 });
345 }); 343 });
346 344
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index 3e50d352c..d39dc1baf 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -73,23 +73,16 @@ interface DownloadOpts {
73 dest: string; 73 dest: string;
74 mode?: number; 74 mode?: number;
75 gunzip?: boolean; 75 gunzip?: boolean;
76 overwrite?: boolean;
77} 76}
78 77
79export async function download(opts: DownloadOpts) { 78export async function download(opts: DownloadOpts) {
80 // Put artifact into a temporary file (in the same dir for simplicity) 79 // Put artifact into a temporary file (in the same dir for simplicity)
81 // to prevent partially downloaded files when user kills vscode 80 // to prevent partially downloaded files when user kills vscode
81 // This also avoids overwriting running executables
82 const dest = path.parse(opts.dest); 82 const dest = path.parse(opts.dest);
83 const randomHex = crypto.randomBytes(5).toString("hex"); 83 const randomHex = crypto.randomBytes(5).toString("hex");
84 const tempFile = path.join(dest.dir, `${dest.name}${randomHex}`); 84 const tempFile = path.join(dest.dir, `${dest.name}${randomHex}`);
85 85
86 if (opts.overwrite) {
87 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
88 await fs.promises.unlink(opts.dest).catch(err => {
89 if (err.code !== "ENOENT") throw err;
90 });
91 }
92
93 await vscode.window.withProgress( 86 await vscode.window.withProgress(
94 { 87 {
95 location: vscode.ProgressLocation.Notification, 88 location: vscode.ProgressLocation.Notification,