aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorMatthias Einwag <[email protected]>2020-09-23 16:27:25 +0100
committerMatthias Einwag <[email protected]>2020-09-23 16:27:25 +0100
commitdf4d59512e496ff010c8710e8ea8e2db4a7f4822 (patch)
treea6416fd927a9294d05743d47dce3c3413e1de6c7 /editors/code
parentd38f759c631039d11cb490692b5e07b00324ff10 (diff)
Remane function
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/main.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 0ee5280cc..f865639a1 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -177,7 +177,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
177 if (!shouldCheckForNewNightly) return; 177 if (!shouldCheckForNewNightly) return;
178 } 178 }
179 179
180 const release = await performDownloadWithRetryDialog(state, async () => { 180 const release = await downloadWithRetryDialog(state, async () => {
181 return await fetchRelease("nightly", state.githubToken); 181 return await fetchRelease("nightly", state.githubToken);
182 }).catch((e) => { 182 }).catch((e) => {
183 log.error(e); 183 log.error(e);
@@ -199,7 +199,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
199 199
200 const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); 200 const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix");
201 201
202 await performDownloadWithRetryDialog(state, async () => { 202 await downloadWithRetryDialog(state, async () => {
203 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. 203 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
204 await fs.unlink(dest).catch(err => { 204 await fs.unlink(dest).catch(err => {
205 if (err.code !== "ENOENT") throw err; 205 if (err.code !== "ENOENT") throw err;
@@ -323,13 +323,13 @@ async function getServer(config: Config, state: PersistentState): Promise<string
323 } 323 }
324 324
325 const releaseTag = config.package.releaseTag; 325 const releaseTag = config.package.releaseTag;
326 const release = await performDownloadWithRetryDialog(state, async () => { 326 const release = await downloadWithRetryDialog(state, async () => {
327 return await fetchRelease(releaseTag, state.githubToken); 327 return await fetchRelease(releaseTag, state.githubToken);
328 }); 328 });
329 const artifact = release.assets.find(artifact => artifact.name === `rust-analyzer-${platform}.gz`); 329 const artifact = release.assets.find(artifact => artifact.name === `rust-analyzer-${platform}.gz`);
330 assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); 330 assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
331 331
332 await performDownloadWithRetryDialog(state, async () => { 332 await downloadWithRetryDialog(state, async () => {
333 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. 333 // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error.
334 await fs.unlink(dest).catch(err => { 334 await fs.unlink(dest).catch(err => {
335 if (err.code !== "ENOENT") throw err; 335 if (err.code !== "ENOENT") throw err;
@@ -353,7 +353,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
353 return dest; 353 return dest;
354} 354}
355 355
356async function performDownloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> { 356async function downloadWithRetryDialog<T>(state: PersistentState, downloadFunc: () => Promise<T>): Promise<T> {
357 while (true) { 357 while (true) {
358 try { 358 try {
359 return await downloadFunc(); 359 return await downloadFunc();