Quellcode durchsuchen

Removes needless closures on setTimeout

main
Eric Amodio vor 1 Jahr
Ursprung
Commit
a8ad820342
9 geänderte Dateien mit 10 neuen und 16 gelöschten Zeilen
  1. +1
    -1
      src/commands/gitCommands.ts
  2. +1
    -1
      src/container.ts
  3. +1
    -3
      src/env/node/git/localGitProvider.ts
  4. +3
    -3
      src/extension.ts
  5. +1
    -1
      src/plus/subscription/serverConnection.ts
  6. +1
    -1
      src/plus/subscription/subscriptionService.ts
  7. +0
    -4
      src/system/function.ts
  8. +1
    -1
      src/webviews/webviewBase.ts
  9. +1
    -1
      src/webviews/webviewViewBase.ts

+ 1
- 1
src/commands/gitCommands.ts Datei anzeigen

@ -178,7 +178,7 @@ export class GitCommandsCommand extends Command {
): Promise<QuickPickStep<QuickPickItem> | QuickInputStep | CustomStep | undefined> {
const stepOrTimeout = await Promise.race([
stepPromise,
new Promise<typeof showLoadingSymbol>(resolve => setTimeout(() => resolve(showLoadingSymbol), 250)),
new Promise<typeof showLoadingSymbol>(resolve => setTimeout(resolve, 250, showLoadingSymbol)),
]);
if (stepOrTimeout !== showLoadingSymbol) {

+ 1
- 1
src/container.ts Datei anzeigen

@ -653,7 +653,7 @@ export class Container {
on: true,
};
// Make sure to delay the execution by a bit so that the configuration changes get propagated first
setTimeout(() => executeCommand(command!, commandArgs), 50);
setTimeout(executeCommand, 50, command, commandArgs);
}
}

+ 1
- 3
src/env/node/git/localGitProvider.ts Datei anzeigen

@ -331,9 +331,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
const location = await any<GitLocation>(findGitPromise, findGitFromSCMPromise);
// Save the found git path, but let things settle first to not impact startup performance
setTimeout(() => {
void this.container.storage.storeWorkspace('gitPath', location.path);
}, 1000);
setTimeout(() => void this.container.storage.storeWorkspace('gitPath', location.path), 1000);
if (scope != null) {
scope.exitDetails = ` ${GlyphChars.Dot} Git (${location.version}) found in ${

+ 3
- 3
src/extension.ts Datei anzeigen

@ -65,7 +65,7 @@ export async function activate(context: ExtensionContext): Promise
sw.stop({ message: ' was NOT activated because GitLens is also enabled' });
// If we don't use a setTimeout here this notification will get lost for some reason
setTimeout(() => void showInsidersErrorMessage(), 0);
setTimeout(showInsidersErrorMessage, 0);
return undefined;
}
@ -86,7 +86,7 @@ export async function activate(context: ExtensionContext): Promise
});
// If we don't use a setTimeout here this notification will get lost for some reason
setTimeout(() => void showPreReleaseExpiredErrorMessage(gitlensVersion, insiders), 0);
setTimeout(showPreReleaseExpiredErrorMessage, 0, gitlensVersion, insiders);
return undefined;
}
@ -213,7 +213,7 @@ export async function activate(context: ExtensionContext): Promise
endTime,
);
setTimeout(() => uninstallDeprecatedAuthentication(), 25000);
setTimeout(uninstallDeprecatedAuthentication, 25000);
return Promise.resolve(api);
}

+ 1
- 1
src/plus/subscription/serverConnection.ts Datei anzeigen

@ -138,7 +138,7 @@ export class ServerConnection implements Disposable {
new Promise<string>((_, reject) =>
this._cancellationSource?.token.onCancellationRequested(() => reject('Cancelled')),
),
new Promise<string>((_, reject) => setTimeout(() => reject('Cancelled'), 120000)),
new Promise<string>((_, reject) => setTimeout(reject, 120000, 'Cancelled')),
]).finally(() => {
this._cancellationSource?.cancel();
this._cancellationSource?.dispose();

+ 1
- 1
src/plus/subscription/subscriptionService.ts Datei anzeigen

@ -532,7 +532,7 @@ export class SubscriptionService implements Disposable {
const validating = this.checkInAndValidateCore(session);
const result = await Promise.race([
validating,
new Promise<boolean>(resolve => setTimeout(() => resolve(true), 3000)),
new Promise<boolean>(resolve => setTimeout(resolve, 3000, true)),
]);
if (result) {

+ 0
- 4
src/system/function.ts Datei anzeigen

@ -173,7 +173,3 @@ export async function sequentialize unknown>(
export function szudzikPairing(x: number, y: number): number {
return x >= y ? x * x + x + y : x + y * y;
}
export async function wait(ms: number) {
await new Promise(resolve => setTimeout(resolve, ms));
}

+ 1
- 1
src/webviews/webviewBase.ts Datei anzeigen

@ -363,7 +363,7 @@ export abstract class WebviewBase implements Disposable {
// It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang
return Promise.race<boolean>([
this._panel.webview.postMessage(message),
new Promise<boolean>(resolve => setTimeout(() => resolve(false), 5000)),
new Promise<boolean>(resolve => setTimeout(resolve, 5000, false)),
]);
}
}

+ 1
- 1
src/webviews/webviewViewBase.ts Datei anzeigen

@ -337,7 +337,7 @@ export abstract class WebviewViewBase implements
// It looks like there is a bug where `postMessage` can sometimes just hang infinitely. Not sure why, but ensure we don't hang
return Promise.race<boolean>([
this._view.webview.postMessage(message),
new Promise<boolean>(resolve => setTimeout(() => resolve(false), 5000)),
new Promise<boolean>(resolve => setTimeout(resolve, 5000, false)),
]);
}
}

Laden…
Abbrechen
Speichern