Skip to content

Commit 3c05f84

Browse files
committed
Handles all floating promises
1 parent dd82de0 commit 3c05f84

25 files changed

+76
-72
lines changed

src/annotations/annotationProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export abstract class AnnotationProviderBase implements Disposable {
7474

7575
protected additionalDecorations: { decoration: TextEditorDecorationType; ranges: Range[] }[] | undefined;
7676

77-
async clear() {
77+
clear() {
7878
this.status = undefined;
7979
if (this.editor === undefined) return;
8080

@@ -110,10 +110,10 @@ export abstract class AnnotationProviderBase implements Disposable {
110110
decoration: TextEditorDecorationType;
111111
highlightDecoration: TextEditorDecorationType | undefined;
112112
}
113-
) => Promise<void>)
113+
) => void)
114114
| undefined;
115115

116-
async reset(changes?: {
116+
reset(changes?: {
117117
decoration: TextEditorDecorationType;
118118
highlightDecoration: TextEditorDecorationType | undefined;
119119
}) {

src/annotations/blameAnnotationProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
4141
}
4242
}
4343

44-
async clear() {
44+
clear() {
4545
this._hoverProviderDisposable && this._hoverProviderDisposable.dispose();
4646
super.clear();
4747
}
@@ -56,7 +56,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
5656
: Container.git.getBlameForFile(this._uri);
5757
}
5858

59-
super.onReset(changes);
59+
return super.onReset(changes);
6060
}
6161

6262
async selection(shaOrLine?: string | number, blame?: GitBlame) {

src/annotations/fileAnnotationController.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class FileAnnotationController implements Disposable {
7777
}
7878

7979
dispose() {
80-
this.clearAll();
80+
void this.clearAll();
8181

8282
Decorations.blameAnnotation && Decorations.blameAnnotation.dispose();
8383
Decorations.blameHighlight && Decorations.blameHighlight.dispose();
@@ -155,21 +155,21 @@ export class FileAnnotationController implements Disposable {
155155
if (initializing || configuration.changed(e, configuration.name('blame')('toggleMode').value)) {
156156
this._toggleModes.set(FileAnnotationType.Blame, cfg.blame.toggleMode);
157157
if (!initializing && cfg.blame.toggleMode === AnnotationsToggleMode.File) {
158-
this.clearAll();
158+
void this.clearAll();
159159
}
160160
}
161161

162162
if (initializing || configuration.changed(e, configuration.name('heatmap')('toggleMode').value)) {
163163
this._toggleModes.set(FileAnnotationType.Heatmap, cfg.heatmap.toggleMode);
164164
if (!initializing && cfg.heatmap.toggleMode === AnnotationsToggleMode.File) {
165-
this.clearAll();
165+
void this.clearAll();
166166
}
167167
}
168168

169169
if (initializing || configuration.changed(e, configuration.name('recentChanges')('toggleMode').value)) {
170170
this._toggleModes.set(FileAnnotationType.RecentChanges, cfg.recentChanges.toggleMode);
171171
if (!initializing && cfg.recentChanges.toggleMode === AnnotationsToggleMode.File) {
172-
this.clearAll();
172+
void this.clearAll();
173173
}
174174
}
175175

@@ -198,7 +198,7 @@ export class FileAnnotationController implements Disposable {
198198
});
199199
}
200200
else {
201-
this.show(provider.editor, FileAnnotationType.Heatmap);
201+
void this.show(provider.editor, FileAnnotationType.Heatmap);
202202
}
203203
}
204204
}
@@ -219,11 +219,11 @@ export class FileAnnotationController implements Disposable {
219219
const provider = this.getProvider(editor);
220220
if (provider === undefined) {
221221
setCommandContext(CommandContext.AnnotationStatus, undefined);
222-
this.detachKeyboardHook();
222+
void this.detachKeyboardHook();
223223
}
224224
else {
225225
setCommandContext(CommandContext.AnnotationStatus, provider.status);
226-
this.attachKeyboardHook();
226+
void this.attachKeyboardHook();
227227
}
228228
}
229229

@@ -234,14 +234,14 @@ export class FileAnnotationController implements Disposable {
234234
const editor = window.activeTextEditor;
235235
if (editor === undefined) return;
236236

237-
this.clear(editor, AnnotationClearReason.BlameabilityChanged);
237+
void this.clear(editor, AnnotationClearReason.BlameabilityChanged);
238238
}
239239

240240
private onDirtyStateChanged(e: DocumentDirtyStateChangeEvent<GitDocumentState>) {
241241
for (const [key, p] of this._annotationProviders) {
242242
if (!e.document.is(p.document)) continue;
243243

244-
this.clearCore(key, AnnotationClearReason.DocumentChanged);
244+
void this.clearCore(key, AnnotationClearReason.DocumentChanged);
245245
}
246246
}
247247

@@ -251,7 +251,7 @@ export class FileAnnotationController implements Disposable {
251251
for (const [key, p] of this._annotationProviders) {
252252
if (p.document !== document) continue;
253253

254-
this.clearCore(key, AnnotationClearReason.DocumentClosed);
254+
void this.clearCore(key, AnnotationClearReason.DocumentClosed);
255255
}
256256
}
257257

@@ -266,12 +266,12 @@ export class FileAnnotationController implements Disposable {
266266
);
267267
if (fuzzyProvider == null) return;
268268

269-
this.clearCore(fuzzyProvider.correlationKey, AnnotationClearReason.ColumnChanged);
269+
void this.clearCore(fuzzyProvider.correlationKey, AnnotationClearReason.ColumnChanged);
270270

271271
return;
272272
}
273273

274-
provider.restore(e.textEditor);
274+
void provider.restore(e.textEditor);
275275
}
276276

277277
private onVisibleTextEditorsChanged(editors: TextEditor[]) {
@@ -280,7 +280,7 @@ export class FileAnnotationController implements Disposable {
280280
provider = this.getProvider(e);
281281
if (provider === undefined) continue;
282282

283-
provider.restore(e);
283+
void provider.restore(e);
284284
}
285285
}
286286

@@ -344,7 +344,7 @@ export class FileAnnotationController implements Disposable {
344344
for (const e of window.visibleTextEditors) {
345345
if (e === editor) continue;
346346

347-
this.show(e, type);
347+
void this.show(e, type);
348348
}
349349
}
350350
}
@@ -495,7 +495,7 @@ export class FileAnnotationController implements Disposable {
495495
}
496496

497497
// Allows pressing escape to exit the annotations
498-
this.attachKeyboardHook();
498+
await this.attachKeyboardHook();
499499

500500
const trackedDocument = await Container.tracker.getOrAdd(editor.document);
501501

src/annotations/gutterBlameAnnotationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
146146
Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute gutter blame annotations`);
147147

148148
this.registerHoverProviders(Container.config.hovers.annotations);
149-
this.selection(shaOrLine, blame);
149+
void this.selection(shaOrLine, blame);
150150
return true;
151151
}
152152

src/annotations/heatmapBlameAnnotationProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class HeatmapBlameAnnotationProvider extends BlameAnnotationProviderBase
5959
Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute heatmap annotations`);
6060

6161
this.registerHoverProviders(Container.config.hovers.annotations);
62-
this.selection(shaOrLine, blame);
62+
void this.selection(shaOrLine, blame);
6363
return true;
6464
}
6565
}

src/annotations/lineAnnotationController.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class LineAnnotationController implements Disposable {
6464
}
6565
}
6666

67-
this.refresh(window.activeTextEditor);
67+
void this.refresh(window.activeTextEditor);
6868
}
6969

7070
private _suspended?: 'debugging' | 'user';
@@ -107,7 +107,7 @@ export class LineAnnotationController implements Disposable {
107107

108108
private onActiveLinesChanged(e: LinesChangeEvent) {
109109
if (!e.pending && e.lines !== undefined) {
110-
this.refresh(e.editor);
110+
void this.refresh(e.editor);
111111

112112
return;
113113
}
@@ -121,7 +121,7 @@ export class LineAnnotationController implements Disposable {
121121
}
122122

123123
if (this.suspend('debugging')) {
124-
this.refresh(window.activeTextEditor);
124+
void this.refresh(window.activeTextEditor);
125125
}
126126
}
127127

@@ -132,15 +132,15 @@ export class LineAnnotationController implements Disposable {
132132
}
133133

134134
if (this.resume('debugging')) {
135-
this.refresh(window.activeTextEditor);
135+
void this.refresh(window.activeTextEditor);
136136
}
137137
}
138138

139139
private onFileAnnotationsToggled() {
140-
this.refresh(window.activeTextEditor);
140+
void this.refresh(window.activeTextEditor);
141141
}
142142

143-
async clear(editor: TextEditor | undefined) {
143+
clear(editor: TextEditor | undefined) {
144144
if (this._editor !== editor && this._editor !== undefined) {
145145
this.clearAnnotations(this._editor);
146146
}

src/commands/diffDirectory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
9292
if (args.ref1 === undefined) return undefined;
9393
}
9494

95-
Container.git.openDirectoryDiff(repoPath, args.ref1, args.ref2);
95+
await Container.git.openDirectoryDiff(repoPath, args.ref1, args.ref2);
9696
return undefined;
9797
}
9898
catch (ex) {

src/commands/externalDiff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class ExternalDiffCommand extends Command {
128128
}
129129

130130
for (const file of args.files) {
131-
Container.git.openDiffTool(repoPath, file.uri, file.staged, tool);
131+
void Container.git.openDiffTool(repoPath, file.uri, file.staged, tool);
132132
}
133133

134134
return undefined;

src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export async function activate(context: ExtensionContext) {
3838
Logger.log(`GitLens(v${gitlensVersion}) was NOT activated -- "git.enabled": false`);
3939
setCommandContext(CommandContext.Enabled, enabled);
4040

41-
Messages.showGitDisabledErrorMessage();
41+
void Messages.showGitDisabledErrorMessage();
4242

4343
return;
4444
}
@@ -92,8 +92,8 @@ export async function activate(context: ExtensionContext) {
9292
// Telemetry.setContext(telemetryContext);
9393

9494
notifyOnUnsupportedGitVersion(gitVersion);
95-
showWelcomePage(gitlensVersion, previousVersion);
96-
Messages.showKeyBindingsInfoMessage();
95+
void showWelcomePage(gitlensVersion, previousVersion);
96+
void Messages.showKeyBindingsInfoMessage();
9797

9898
context.globalState.update(GlobalState.GitLensVersion, gitlensVersion);
9999

@@ -502,7 +502,7 @@ function notifyOnUnsupportedGitVersion(version: string) {
502502
if (GitService.compareGitVersion('2.2.0') !== -1) return;
503503

504504
// If git is less than v2.2.0
505-
Messages.showGitVersionUnsupportedErrorMessage(version);
505+
void Messages.showGitVersionUnsupportedErrorMessage(version);
506506
}
507507

508508
async function showWelcomePage(version: string, previousVersion: string | undefined) {

src/quickpicks/commitFileQuickPick.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export class CommitFileQuickPick {
412412
} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`,
413413
ignoreFocusOut: getQuickPickIgnoreFocusOut(),
414414
onDidSelectItem: (item: QuickPickItem) => {
415-
scope.setKeyCommand('right', item as KeyCommand);
415+
void scope.setKeyCommand('right', item as KeyCommand);
416416
}
417417
} as QuickPickOptions);
418418

0 commit comments

Comments
 (0)