@@ -194,11 +194,19 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
194
194
assert ( ! ! artifact , `Bad release: ${ JSON . stringify ( release ) } ` ) ;
195
195
196
196
const dest = path . join ( config . globalStoragePath , "rust-analyzer.vsix" ) ;
197
- await download ( {
198
- url : artifact . browser_download_url ,
199
- dest,
200
- progressTitle : "Downloading rust-analyzer extension" ,
201
- } ) ;
197
+
198
+ await performDownloadWithRetryDialog ( async ( ) => {
199
+ // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
200
+ await fs . unlink ( dest ) . catch ( err => {
201
+ if ( err . code !== "ENOENT" ) throw err ;
202
+ } ) ;
203
+
204
+ await download ( {
205
+ url : artifact . browser_download_url ,
206
+ dest,
207
+ progressTitle : "Downloading rust-analyzer extension" ,
208
+ } ) ;
209
+ } , state ) ;
202
210
203
211
await vscode . commands . executeCommand ( "workbench.extensions.installExtension" , vscode . Uri . file ( dest ) ) ;
204
212
await fs . unlink ( dest ) ;
@@ -317,18 +325,20 @@ async function getServer(config: Config, state: PersistentState): Promise<string
317
325
const artifact = release . assets . find ( artifact => artifact . name === `rust-analyzer-${ platform } .gz` ) ;
318
326
assert ( ! ! artifact , `Bad release: ${ JSON . stringify ( release ) } ` ) ;
319
327
320
- // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
321
- await fs . unlink ( dest ) . catch ( err => {
322
- if ( err . code !== "ENOENT" ) throw err ;
323
- } ) ;
324
-
325
- await download ( {
326
- url : artifact . browser_download_url ,
327
- dest,
328
- progressTitle : "Downloading rust-analyzer server" ,
329
- gunzip : true ,
330
- mode : 0o755
331
- } ) ;
328
+ await performDownloadWithRetryDialog ( async ( ) => {
329
+ // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
330
+ await fs . unlink ( dest ) . catch ( err => {
331
+ if ( err . code !== "ENOENT" ) throw err ;
332
+ } ) ;
333
+
334
+ await download ( {
335
+ url : artifact . browser_download_url ,
336
+ dest,
337
+ progressTitle : "Downloading rust-analyzer server" ,
338
+ gunzip : true ,
339
+ mode : 0o755
340
+ } ) ;
341
+ } , state ) ;
332
342
333
343
// Patching executable if that's NixOS.
334
344
if ( await fs . stat ( "/etc/nixos" ) . then ( _ => true ) . catch ( _ => false ) ) {
@@ -372,15 +382,15 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
372
382
password : true ,
373
383
prompt : `
374
384
This dialog allows to store a Github authorization token.
375
- The usage of an authorization token allows will increase the rate
385
+ The usage of an authorization token will increase the rate
376
386
limit on the use of Github APIs and can thereby prevent getting
377
387
throttled.
378
- Auth tokens can be obtained at https://github.com/settings/tokens` ,
388
+ Auth tokens can be created at https://github.com/settings/tokens` ,
379
389
} ;
380
390
381
391
const newToken = await vscode . window . showInputBox ( githubTokenOptions ) ;
382
392
if ( newToken ) {
383
393
log . info ( "Storing new github token" ) ;
384
394
await state . updateGithubToken ( newToken ) ;
385
395
}
386
- }
396
+ }
0 commit comments