diff --git a/src/annotations/annotationProvider.ts b/src/annotations/annotationProvider.ts index 6854c55..6feceac 100644 --- a/src/annotations/annotationProvider.ts +++ b/src/annotations/annotationProvider.ts @@ -74,7 +74,7 @@ export abstract class AnnotationProviderBase implements Disposable { protected additionalDecorations: { decoration: TextEditorDecorationType; ranges: Range[] }[] | undefined; - async clear() { + clear() { this.status = undefined; if (this.editor === undefined) return; @@ -110,10 +110,10 @@ export abstract class AnnotationProviderBase implements Disposable { decoration: TextEditorDecorationType; highlightDecoration: TextEditorDecorationType | undefined; } - ) => Promise) + ) => void) | undefined; - async reset(changes?: { + reset(changes?: { decoration: TextEditorDecorationType; highlightDecoration: TextEditorDecorationType | undefined; }) { diff --git a/src/annotations/blameAnnotationProvider.ts b/src/annotations/blameAnnotationProvider.ts index 37d4bef..8e38cf8 100644 --- a/src/annotations/blameAnnotationProvider.ts +++ b/src/annotations/blameAnnotationProvider.ts @@ -41,7 +41,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase } } - async clear() { + clear() { this._hoverProviderDisposable && this._hoverProviderDisposable.dispose(); super.clear(); } @@ -56,7 +56,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase : Container.git.getBlameForFile(this._uri); } - super.onReset(changes); + return super.onReset(changes); } async selection(shaOrLine?: string | number, blame?: GitBlame) { diff --git a/src/annotations/fileAnnotationController.ts b/src/annotations/fileAnnotationController.ts index 4adc8d6..3dea2d7 100644 --- a/src/annotations/fileAnnotationController.ts +++ b/src/annotations/fileAnnotationController.ts @@ -77,7 +77,7 @@ export class FileAnnotationController implements Disposable { } dispose() { - this.clearAll(); + void this.clearAll(); Decorations.blameAnnotation && Decorations.blameAnnotation.dispose(); Decorations.blameHighlight && Decorations.blameHighlight.dispose(); @@ -155,21 +155,21 @@ export class FileAnnotationController implements Disposable { if (initializing || configuration.changed(e, configuration.name('blame')('toggleMode').value)) { this._toggleModes.set(FileAnnotationType.Blame, cfg.blame.toggleMode); if (!initializing && cfg.blame.toggleMode === AnnotationsToggleMode.File) { - this.clearAll(); + void this.clearAll(); } } if (initializing || configuration.changed(e, configuration.name('heatmap')('toggleMode').value)) { this._toggleModes.set(FileAnnotationType.Heatmap, cfg.heatmap.toggleMode); if (!initializing && cfg.heatmap.toggleMode === AnnotationsToggleMode.File) { - this.clearAll(); + void this.clearAll(); } } if (initializing || configuration.changed(e, configuration.name('recentChanges')('toggleMode').value)) { this._toggleModes.set(FileAnnotationType.RecentChanges, cfg.recentChanges.toggleMode); if (!initializing && cfg.recentChanges.toggleMode === AnnotationsToggleMode.File) { - this.clearAll(); + void this.clearAll(); } } @@ -198,7 +198,7 @@ export class FileAnnotationController implements Disposable { }); } else { - this.show(provider.editor, FileAnnotationType.Heatmap); + void this.show(provider.editor, FileAnnotationType.Heatmap); } } } @@ -219,11 +219,11 @@ export class FileAnnotationController implements Disposable { const provider = this.getProvider(editor); if (provider === undefined) { setCommandContext(CommandContext.AnnotationStatus, undefined); - this.detachKeyboardHook(); + void this.detachKeyboardHook(); } else { setCommandContext(CommandContext.AnnotationStatus, provider.status); - this.attachKeyboardHook(); + void this.attachKeyboardHook(); } } @@ -234,14 +234,14 @@ export class FileAnnotationController implements Disposable { const editor = window.activeTextEditor; if (editor === undefined) return; - this.clear(editor, AnnotationClearReason.BlameabilityChanged); + void this.clear(editor, AnnotationClearReason.BlameabilityChanged); } private onDirtyStateChanged(e: DocumentDirtyStateChangeEvent) { for (const [key, p] of this._annotationProviders) { if (!e.document.is(p.document)) continue; - this.clearCore(key, AnnotationClearReason.DocumentChanged); + void this.clearCore(key, AnnotationClearReason.DocumentChanged); } } @@ -251,7 +251,7 @@ export class FileAnnotationController implements Disposable { for (const [key, p] of this._annotationProviders) { if (p.document !== document) continue; - this.clearCore(key, AnnotationClearReason.DocumentClosed); + void this.clearCore(key, AnnotationClearReason.DocumentClosed); } } @@ -266,12 +266,12 @@ export class FileAnnotationController implements Disposable { ); if (fuzzyProvider == null) return; - this.clearCore(fuzzyProvider.correlationKey, AnnotationClearReason.ColumnChanged); + void this.clearCore(fuzzyProvider.correlationKey, AnnotationClearReason.ColumnChanged); return; } - provider.restore(e.textEditor); + void provider.restore(e.textEditor); } private onVisibleTextEditorsChanged(editors: TextEditor[]) { @@ -280,7 +280,7 @@ export class FileAnnotationController implements Disposable { provider = this.getProvider(e); if (provider === undefined) continue; - provider.restore(e); + void provider.restore(e); } } @@ -344,7 +344,7 @@ export class FileAnnotationController implements Disposable { for (const e of window.visibleTextEditors) { if (e === editor) continue; - this.show(e, type); + void this.show(e, type); } } } @@ -495,7 +495,7 @@ export class FileAnnotationController implements Disposable { } // Allows pressing escape to exit the annotations - this.attachKeyboardHook(); + await this.attachKeyboardHook(); const trackedDocument = await Container.tracker.getOrAdd(editor.document); diff --git a/src/annotations/gutterBlameAnnotationProvider.ts b/src/annotations/gutterBlameAnnotationProvider.ts index 4467844..ad50483 100644 --- a/src/annotations/gutterBlameAnnotationProvider.ts +++ b/src/annotations/gutterBlameAnnotationProvider.ts @@ -146,7 +146,7 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase { Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute gutter blame annotations`); this.registerHoverProviders(Container.config.hovers.annotations); - this.selection(shaOrLine, blame); + void this.selection(shaOrLine, blame); return true; } diff --git a/src/annotations/heatmapBlameAnnotationProvider.ts b/src/annotations/heatmapBlameAnnotationProvider.ts index 306b4f3..20ee13a 100644 --- a/src/annotations/heatmapBlameAnnotationProvider.ts +++ b/src/annotations/heatmapBlameAnnotationProvider.ts @@ -59,7 +59,7 @@ export class HeatmapBlameAnnotationProvider extends BlameAnnotationProviderBase Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute heatmap annotations`); this.registerHoverProviders(Container.config.hovers.annotations); - this.selection(shaOrLine, blame); + void this.selection(shaOrLine, blame); return true; } } diff --git a/src/annotations/lineAnnotationController.ts b/src/annotations/lineAnnotationController.ts index 4d0e395..1441d21 100644 --- a/src/annotations/lineAnnotationController.ts +++ b/src/annotations/lineAnnotationController.ts @@ -64,7 +64,7 @@ export class LineAnnotationController implements Disposable { } } - this.refresh(window.activeTextEditor); + void this.refresh(window.activeTextEditor); } private _suspended?: 'debugging' | 'user'; @@ -107,7 +107,7 @@ export class LineAnnotationController implements Disposable { private onActiveLinesChanged(e: LinesChangeEvent) { if (!e.pending && e.lines !== undefined) { - this.refresh(e.editor); + void this.refresh(e.editor); return; } @@ -121,7 +121,7 @@ export class LineAnnotationController implements Disposable { } if (this.suspend('debugging')) { - this.refresh(window.activeTextEditor); + void this.refresh(window.activeTextEditor); } } @@ -132,15 +132,15 @@ export class LineAnnotationController implements Disposable { } if (this.resume('debugging')) { - this.refresh(window.activeTextEditor); + void this.refresh(window.activeTextEditor); } } private onFileAnnotationsToggled() { - this.refresh(window.activeTextEditor); + void this.refresh(window.activeTextEditor); } - async clear(editor: TextEditor | undefined) { + clear(editor: TextEditor | undefined) { if (this._editor !== editor && this._editor !== undefined) { this.clearAnnotations(this._editor); } diff --git a/src/commands/diffDirectory.ts b/src/commands/diffDirectory.ts index 001aa24..0b63857 100644 --- a/src/commands/diffDirectory.ts +++ b/src/commands/diffDirectory.ts @@ -92,7 +92,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand { if (args.ref1 === undefined) return undefined; } - Container.git.openDirectoryDiff(repoPath, args.ref1, args.ref2); + await Container.git.openDirectoryDiff(repoPath, args.ref1, args.ref2); return undefined; } catch (ex) { diff --git a/src/commands/externalDiff.ts b/src/commands/externalDiff.ts index e8c17f9..7db88dd 100644 --- a/src/commands/externalDiff.ts +++ b/src/commands/externalDiff.ts @@ -128,7 +128,7 @@ export class ExternalDiffCommand extends Command { } for (const file of args.files) { - Container.git.openDiffTool(repoPath, file.uri, file.staged, tool); + void Container.git.openDiffTool(repoPath, file.uri, file.staged, tool); } return undefined; diff --git a/src/extension.ts b/src/extension.ts index cd5f67c..d61b9db 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -38,7 +38,7 @@ export async function activate(context: ExtensionContext) { Logger.log(`GitLens(v${gitlensVersion}) was NOT activated -- "git.enabled": false`); setCommandContext(CommandContext.Enabled, enabled); - Messages.showGitDisabledErrorMessage(); + void Messages.showGitDisabledErrorMessage(); return; } @@ -92,8 +92,8 @@ export async function activate(context: ExtensionContext) { // Telemetry.setContext(telemetryContext); notifyOnUnsupportedGitVersion(gitVersion); - showWelcomePage(gitlensVersion, previousVersion); - Messages.showKeyBindingsInfoMessage(); + void showWelcomePage(gitlensVersion, previousVersion); + void Messages.showKeyBindingsInfoMessage(); context.globalState.update(GlobalState.GitLensVersion, gitlensVersion); @@ -502,7 +502,7 @@ function notifyOnUnsupportedGitVersion(version: string) { if (GitService.compareGitVersion('2.2.0') !== -1) return; // If git is less than v2.2.0 - Messages.showGitVersionUnsupportedErrorMessage(version); + void Messages.showGitVersionUnsupportedErrorMessage(version); } async function showWelcomePage(version: string, previousVersion: string | undefined) { diff --git a/src/quickpicks/commitFileQuickPick.ts b/src/quickpicks/commitFileQuickPick.ts index 1c14d61..a8df7ae 100644 --- a/src/quickpicks/commitFileQuickPick.ts +++ b/src/quickpicks/commitFileQuickPick.ts @@ -412,7 +412,7 @@ export class CommitFileQuickPick { } ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`, ignoreFocusOut: getQuickPickIgnoreFocusOut(), onDidSelectItem: (item: QuickPickItem) => { - scope.setKeyCommand('right', item as KeyCommand); + void scope.setKeyCommand('right', item as KeyCommand); } } as QuickPickOptions); diff --git a/src/quickpicks/commitQuickPick.ts b/src/quickpicks/commitQuickPick.ts index 11a79e8..f2dac4a 100644 --- a/src/quickpicks/commitQuickPick.ts +++ b/src/quickpicks/commitQuickPick.ts @@ -405,7 +405,7 @@ export class CommitQuickPick { }${commit.formattedDate} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`, ignoreFocusOut: getQuickPickIgnoreFocusOut(), onDidSelectItem: (item: QuickPickItem) => { - scope.setKeyCommand('right', item); + void scope.setKeyCommand('right', item); if (typeof item.onDidSelect === 'function') { item.onDidSelect(); } diff --git a/src/quickpicks/commonQuickPicks.ts b/src/quickpicks/commonQuickPicks.ts index 4f43a9b..85b2247 100644 --- a/src/quickpicks/commonQuickPicks.ts +++ b/src/quickpicks/commonQuickPicks.ts @@ -24,7 +24,7 @@ export function getQuickPickIgnoreFocusOut() { export function showQuickPickProgress(message: string, mapping?: KeyMapping): CancellationTokenSource { const cancellation = new CancellationTokenSource(); - _showQuickPickProgress(message, cancellation, mapping); + void _showQuickPickProgress(message, cancellation, mapping); return cancellation; } diff --git a/src/quickpicks/repoStatusQuickPick.ts b/src/quickpicks/repoStatusQuickPick.ts index 66c69d3..f7bfacf 100644 --- a/src/quickpicks/repoStatusQuickPick.ts +++ b/src/quickpicks/repoStatusQuickPick.ts @@ -467,7 +467,7 @@ export class RepoStatusQuickPick { }`, ignoreFocusOut: getQuickPickIgnoreFocusOut(), onDidSelectItem: (item: QuickPickItem) => { - scope.setKeyCommand('right', item); + void scope.setKeyCommand('right', item); } } as QuickPickOptions); diff --git a/src/statusbar/statusBarController.ts b/src/statusbar/statusBarController.ts index 0e23013..09230f8 100644 --- a/src/statusbar/statusBarController.ts +++ b/src/statusbar/statusBarController.ts @@ -124,7 +124,7 @@ export class StatusBarController implements Disposable { } } - async clearBlame() { + clearBlame() { if (this._blameStatusBarItem !== undefined) { this._blameStatusBarItem.hide(); } diff --git a/src/trackers/activeEditorTracker.ts b/src/trackers/activeEditorTracker.ts index bcc0b81..5123e08 100644 --- a/src/trackers/activeEditorTracker.ts +++ b/src/trackers/activeEditorTracker.ts @@ -17,12 +17,12 @@ export class ActiveEditorTracker implements Disposable { } async awaitClose(timeout: number = 500): Promise { - this.close(); + void this.close(); return this.wait(timeout); } async awaitNext(timeout: number = 500): Promise { - this.next(); + void this.next(); return this.wait(timeout); } diff --git a/src/trackers/documentTracker.ts b/src/trackers/documentTracker.ts index b366d49..212bf54 100644 --- a/src/trackers/documentTracker.ts +++ b/src/trackers/documentTracker.ts @@ -174,7 +174,7 @@ export class DocumentTracker implements Disposable { private onTextDocumentSaved(document: TextDocument) { let doc = this._documentMap.get(document); if (doc !== undefined) { - doc.update({ forceBlameChange: true }); + void doc.update({ forceBlameChange: true }); return; } diff --git a/src/trackers/gitLineTracker.ts b/src/trackers/gitLineTracker.ts index 3015e26..8746266 100644 --- a/src/trackers/gitLineTracker.ts +++ b/src/trackers/gitLineTracker.ts @@ -31,7 +31,7 @@ export class GitLineTracker extends LineTracker { updated = await this.updateState(e.lines, e.editor); } - super.fireLinesChanged(updated ? e : { ...e, lines: undefined }); + return super.fireLinesChanged(updated ? e : { ...e, lines: undefined }); } private onBlameStateChanged(e: DocumentBlameStateChangeEvent) { @@ -56,14 +56,14 @@ export class GitLineTracker extends LineTracker { private _suspended = false; - private async resume(options: { force?: boolean } = {}) { + private resume(options: { force?: boolean } = {}) { if (!options.force && !this._suspended) return; this._suspended = false; this.trigger('editor'); } - private async suspend(options: { force?: boolean } = {}) { + private suspend(options: { force?: boolean } = {}) { if (!options.force && this._suspended) return; this._suspended = true; diff --git a/src/trackers/lineTracker.ts b/src/trackers/lineTracker.ts index ae9538b..92d8506 100644 --- a/src/trackers/lineTracker.ts +++ b/src/trackers/lineTracker.ts @@ -122,7 +122,7 @@ export class LineTracker implements Disposable { this._linesChangedDebounced.cancel(); } - this.fireLinesChanged(e); + void this.fireLinesChanged(e); }); return; @@ -137,7 +137,7 @@ export class LineTracker implements Disposable { return; } - this.fireLinesChanged(e); + void this.fireLinesChanged(e); }, 250, { track: true } @@ -146,7 +146,7 @@ export class LineTracker implements Disposable { // If we have no pending moves, then fire an immediate pending event, and defer the real event if (!this._linesChangedDebounced.pending!()) { - this.fireLinesChanged({ ...e, pending: true }); + void this.fireLinesChanged({ ...e, pending: true }); } this._linesChangedDebounced(e); diff --git a/src/trackers/trackedDocument.ts b/src/trackers/trackedDocument.ts index d6a1ce4..38207d6 100644 --- a/src/trackers/trackedDocument.ts +++ b/src/trackers/trackedDocument.ts @@ -72,7 +72,7 @@ export class TrackedDocument implements Disposable { // Reset any cached state this.reset('repository'); - this.update(); + void this.update(); } private _forceDirtyStateChangeOnNextDocumentChange: boolean = false; @@ -150,7 +150,7 @@ export class TrackedDocument implements Disposable { this._blameFailed = true; if (wasBlameable && isActiveDocument(this._document)) { - this.update({ forceBlameChange: true }); + void this.update({ forceBlameChange: true }); } } diff --git a/src/views/gitExplorer.ts b/src/views/gitExplorer.ts index 71db866..64c507c 100644 --- a/src/views/gitExplorer.ts +++ b/src/views/gitExplorer.ts @@ -111,7 +111,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider e.document && Container.git.isTrackable(e.document.uri))) { this.clearRoot(); - this.refresh(RefreshReason.VisibleEditorsChanged); + void this.refresh(RefreshReason.VisibleEditorsChanged); } } @@ -349,7 +352,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider e.document && Container.git.isTrackable(e.document.uri))) { this.clearRoot(); - this.refresh(RefreshReason.VisibleEditorsChanged); + void this.refresh(RefreshReason.VisibleEditorsChanged); } } diff --git a/src/views/nodes/activeRepositoryNode.ts b/src/views/nodes/activeRepositoryNode.ts index 0a8e20d..71b7ad2 100644 --- a/src/views/nodes/activeRepositoryNode.ts +++ b/src/views/nodes/activeRepositoryNode.ts @@ -20,7 +20,7 @@ export class ActiveRepositoryNode extends ExplorerNode { window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveEditorChanged, 500), this) ); - this.onActiveEditorChanged(window.activeTextEditor); + void this.onActiveEditorChanged(window.activeTextEditor); } dispose() { diff --git a/src/views/resultsExplorer.ts b/src/views/resultsExplorer.ts index 9653bea..315305f 100644 --- a/src/views/resultsExplorer.ts +++ b/src/views/resultsExplorer.ts @@ -70,7 +70,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab setCommandContext(CommandContext.ResultsExplorerKeepResults, this.keepResults); Container.context.subscriptions.push(configuration.onDidChange(this.onConfigurationChanged, this)); - this.onConfigurationChanged(configuration.initializingChangeEvent); + void this.onConfigurationChanged(configuration.initializingChangeEvent); } dispose() { @@ -106,7 +106,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab } if (!initializing && this._roots.length !== 0) { - this.refresh(RefreshReason.ConfigurationChanged); + void this.refresh(RefreshReason.ConfigurationChanged); } } @@ -191,7 +191,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab } showComparisonInResults(repoPath: string, ref1: string | NamedRef, ref2: string | NamedRef) { - this.showResults( + void this.showResults( this.addResults( new ComparisonResultsNode( repoPath, @@ -204,7 +204,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab } showCommitInResults(commit: GitLogCommit) { - this.showResults(this.addResults(new CommitResultsNode(commit, this))); + void this.showResults(this.addResults(new CommitResultsNode(commit, this))); } showCommitsInResults( @@ -244,7 +244,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab })} for ${resultsLabel.label}${repository}`; }; - this.showResults( + void this.showResults( this.addResults( new CommitsResultsNode( results.repoPath, @@ -282,7 +282,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab this._roots.forEach(r => r.dispose()); this._roots = []; - this.refresh(); + void this.refresh(); } private clearResultsNode(node: ExplorerNode) { @@ -293,7 +293,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab node.dispose(); - this.refresh(); + void this.refresh(); } private setFilesLayout(layout: ExplorerFilesLayout) { diff --git a/src/webviews/webviewEditor.ts b/src/webviews/webviewEditor.ts index b96e883..785111a 100644 --- a/src/webviews/webviewEditor.ts +++ b/src/webviews/webviewEditor.ts @@ -64,7 +64,7 @@ export abstract class WebviewEditor implements Disposable { break; default: - this.show(); + void this.show(); break; } } diff --git a/tslint.json b/tslint.json index 00f211e..51f12fa 100644 --- a/tslint.json +++ b/tslint.json @@ -17,6 +17,7 @@ "no-default-export": true, "no-duplicate-variable": true, "no-eval": true, + "no-floating-promises": true, "no-inferrable-types": [true, "ignore-params", "ignore-properties"], "no-internal-module": true, "no-irregular-whitespace": true,