Browse Source

Handles all floating promises

main
Eric Amodio 6 years ago
parent
commit
3c05f841e9
25 changed files with 76 additions and 72 deletions
  1. +3
    -3
      src/annotations/annotationProvider.ts
  2. +2
    -2
      src/annotations/blameAnnotationProvider.ts
  3. +15
    -15
      src/annotations/fileAnnotationController.ts
  4. +1
    -1
      src/annotations/gutterBlameAnnotationProvider.ts
  5. +1
    -1
      src/annotations/heatmapBlameAnnotationProvider.ts
  6. +6
    -6
      src/annotations/lineAnnotationController.ts
  7. +1
    -1
      src/commands/diffDirectory.ts
  8. +1
    -1
      src/commands/externalDiff.ts
  9. +4
    -4
      src/extension.ts
  10. +1
    -1
      src/quickpicks/commitFileQuickPick.ts
  11. +1
    -1
      src/quickpicks/commitQuickPick.ts
  12. +1
    -1
      src/quickpicks/commonQuickPicks.ts
  13. +1
    -1
      src/quickpicks/repoStatusQuickPick.ts
  14. +1
    -1
      src/statusbar/statusBarController.ts
  15. +2
    -2
      src/trackers/activeEditorTracker.ts
  16. +1
    -1
      src/trackers/documentTracker.ts
  17. +3
    -3
      src/trackers/gitLineTracker.ts
  18. +3
    -3
      src/trackers/lineTracker.ts
  19. +2
    -2
      src/trackers/trackedDocument.ts
  20. +10
    -7
      src/views/gitExplorer.ts
  21. +6
    -6
      src/views/historyExplorer.ts
  22. +1
    -1
      src/views/nodes/activeRepositoryNode.ts
  23. +7
    -7
      src/views/resultsExplorer.ts
  24. +1
    -1
      src/webviews/webviewEditor.ts
  25. +1
    -0
      tslint.json

+ 3
- 3
src/annotations/annotationProvider.ts View File

@ -74,7 +74,7 @@ export abstract class AnnotationProviderBase implements Disposable {
protected additionalDecorations: { decoration: TextEditorDecorationType; ranges: Range[] }[] | undefined; protected additionalDecorations: { decoration: TextEditorDecorationType; ranges: Range[] }[] | undefined;
async clear() {
clear() {
this.status = undefined; this.status = undefined;
if (this.editor === undefined) return; if (this.editor === undefined) return;
@ -110,10 +110,10 @@ export abstract class AnnotationProviderBase implements Disposable {
decoration: TextEditorDecorationType; decoration: TextEditorDecorationType;
highlightDecoration: TextEditorDecorationType | undefined; highlightDecoration: TextEditorDecorationType | undefined;
} }
) => Promise<void>)
) => void)
| undefined; | undefined;
async reset(changes?: {
reset(changes?: {
decoration: TextEditorDecorationType; decoration: TextEditorDecorationType;
highlightDecoration: TextEditorDecorationType | undefined; highlightDecoration: TextEditorDecorationType | undefined;
}) { }) {

+ 2
- 2
src/annotations/blameAnnotationProvider.ts View File

@ -41,7 +41,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
} }
} }
async clear() {
clear() {
this._hoverProviderDisposable && this._hoverProviderDisposable.dispose(); this._hoverProviderDisposable && this._hoverProviderDisposable.dispose();
super.clear(); super.clear();
} }
@ -56,7 +56,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
: Container.git.getBlameForFile(this._uri); : Container.git.getBlameForFile(this._uri);
} }
super.onReset(changes);
return super.onReset(changes);
} }
async selection(shaOrLine?: string | number, blame?: GitBlame) { async selection(shaOrLine?: string | number, blame?: GitBlame) {

+ 15
- 15
src/annotations/fileAnnotationController.ts View File

@ -77,7 +77,7 @@ export class FileAnnotationController implements Disposable {
} }
dispose() { dispose() {
this.clearAll();
void this.clearAll();
Decorations.blameAnnotation && Decorations.blameAnnotation.dispose(); Decorations.blameAnnotation && Decorations.blameAnnotation.dispose();
Decorations.blameHighlight && Decorations.blameHighlight.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)) { if (initializing || configuration.changed(e, configuration.name('blame')('toggleMode').value)) {
this._toggleModes.set(FileAnnotationType.Blame, cfg.blame.toggleMode); this._toggleModes.set(FileAnnotationType.Blame, cfg.blame.toggleMode);
if (!initializing && cfg.blame.toggleMode === AnnotationsToggleMode.File) { if (!initializing && cfg.blame.toggleMode === AnnotationsToggleMode.File) {
this.clearAll();
void this.clearAll();
} }
} }
if (initializing || configuration.changed(e, configuration.name('heatmap')('toggleMode').value)) { if (initializing || configuration.changed(e, configuration.name('heatmap')('toggleMode').value)) {
this._toggleModes.set(FileAnnotationType.Heatmap, cfg.heatmap.toggleMode); this._toggleModes.set(FileAnnotationType.Heatmap, cfg.heatmap.toggleMode);
if (!initializing && cfg.heatmap.toggleMode === AnnotationsToggleMode.File) { if (!initializing && cfg.heatmap.toggleMode === AnnotationsToggleMode.File) {
this.clearAll();
void this.clearAll();
} }
} }
if (initializing || configuration.changed(e, configuration.name('recentChanges')('toggleMode').value)) { if (initializing || configuration.changed(e, configuration.name('recentChanges')('toggleMode').value)) {
this._toggleModes.set(FileAnnotationType.RecentChanges, cfg.recentChanges.toggleMode); this._toggleModes.set(FileAnnotationType.RecentChanges, cfg.recentChanges.toggleMode);
if (!initializing && cfg.recentChanges.toggleMode === AnnotationsToggleMode.File) { if (!initializing && cfg.recentChanges.toggleMode === AnnotationsToggleMode.File) {
this.clearAll();
void this.clearAll();
} }
} }
@ -198,7 +198,7 @@ export class FileAnnotationController implements Disposable {
}); });
} }
else { 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); const provider = this.getProvider(editor);
if (provider === undefined) { if (provider === undefined) {
setCommandContext(CommandContext.AnnotationStatus, undefined); setCommandContext(CommandContext.AnnotationStatus, undefined);
this.detachKeyboardHook();
void this.detachKeyboardHook();
} }
else { else {
setCommandContext(CommandContext.AnnotationStatus, provider.status); setCommandContext(CommandContext.AnnotationStatus, provider.status);
this.attachKeyboardHook();
void this.attachKeyboardHook();
} }
} }
@ -234,14 +234,14 @@ export class FileAnnotationController implements Disposable {
const editor = window.activeTextEditor; const editor = window.activeTextEditor;
if (editor === undefined) return; if (editor === undefined) return;
this.clear(editor, AnnotationClearReason.BlameabilityChanged);
void this.clear(editor, AnnotationClearReason.BlameabilityChanged);
} }
private onDirtyStateChanged(e: DocumentDirtyStateChangeEvent<GitDocumentState>) { private onDirtyStateChanged(e: DocumentDirtyStateChangeEvent<GitDocumentState>) {
for (const [key, p] of this._annotationProviders) { for (const [key, p] of this._annotationProviders) {
if (!e.document.is(p.document)) continue; 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) { for (const [key, p] of this._annotationProviders) {
if (p.document !== document) continue; 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; if (fuzzyProvider == null) return;
this.clearCore(fuzzyProvider.correlationKey, AnnotationClearReason.ColumnChanged);
void this.clearCore(fuzzyProvider.correlationKey, AnnotationClearReason.ColumnChanged);
return; return;
} }
provider.restore(e.textEditor);
void provider.restore(e.textEditor);
} }
private onVisibleTextEditorsChanged(editors: TextEditor[]) { private onVisibleTextEditorsChanged(editors: TextEditor[]) {
@ -280,7 +280,7 @@ export class FileAnnotationController implements Disposable {
provider = this.getProvider(e); provider = this.getProvider(e);
if (provider === undefined) continue; 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) { for (const e of window.visibleTextEditors) {
if (e === editor) continue; 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 // Allows pressing escape to exit the annotations
this.attachKeyboardHook();
await this.attachKeyboardHook();
const trackedDocument = await Container.tracker.getOrAdd(editor.document); const trackedDocument = await Container.tracker.getOrAdd(editor.document);

+ 1
- 1
src/annotations/gutterBlameAnnotationProvider.ts View File

@ -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`); Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute gutter blame annotations`);
this.registerHoverProviders(Container.config.hovers.annotations); this.registerHoverProviders(Container.config.hovers.annotations);
this.selection(shaOrLine, blame);
void this.selection(shaOrLine, blame);
return true; return true;
} }

+ 1
- 1
src/annotations/heatmapBlameAnnotationProvider.ts View File

@ -59,7 +59,7 @@ export class HeatmapBlameAnnotationProvider extends BlameAnnotationProviderBase
Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute heatmap annotations`); Logger.log(`${duration[0] * 1000 + Math.floor(duration[1] / 1000000)} ms to compute heatmap annotations`);
this.registerHoverProviders(Container.config.hovers.annotations); this.registerHoverProviders(Container.config.hovers.annotations);
this.selection(shaOrLine, blame);
void this.selection(shaOrLine, blame);
return true; return true;
} }
} }

+ 6
- 6
src/annotations/lineAnnotationController.ts View File

@ -64,7 +64,7 @@ export class LineAnnotationController implements Disposable {
} }
} }
this.refresh(window.activeTextEditor);
void this.refresh(window.activeTextEditor);
} }
private _suspended?: 'debugging' | 'user'; private _suspended?: 'debugging' | 'user';
@ -107,7 +107,7 @@ export class LineAnnotationController implements Disposable {
private onActiveLinesChanged(e: LinesChangeEvent) { private onActiveLinesChanged(e: LinesChangeEvent) {
if (!e.pending && e.lines !== undefined) { if (!e.pending && e.lines !== undefined) {
this.refresh(e.editor);
void this.refresh(e.editor);
return; return;
} }
@ -121,7 +121,7 @@ export class LineAnnotationController implements Disposable {
} }
if (this.suspend('debugging')) { 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')) { if (this.resume('debugging')) {
this.refresh(window.activeTextEditor);
void this.refresh(window.activeTextEditor);
} }
} }
private onFileAnnotationsToggled() { 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) { if (this._editor !== editor && this._editor !== undefined) {
this.clearAnnotations(this._editor); this.clearAnnotations(this._editor);
} }

+ 1
- 1
src/commands/diffDirectory.ts View File

@ -92,7 +92,7 @@ export class DiffDirectoryCommand extends ActiveEditorCommand {
if (args.ref1 === undefined) return undefined; 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; return undefined;
} }
catch (ex) { catch (ex) {

+ 1
- 1
src/commands/externalDiff.ts View File

@ -128,7 +128,7 @@ export class ExternalDiffCommand extends Command {
} }
for (const file of args.files) { 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; return undefined;

+ 4
- 4
src/extension.ts View File

@ -38,7 +38,7 @@ export async function activate(context: ExtensionContext) {
Logger.log(`GitLens(v${gitlensVersion}) was NOT activated -- "git.enabled": false`); Logger.log(`GitLens(v${gitlensVersion}) was NOT activated -- "git.enabled": false`);
setCommandContext(CommandContext.Enabled, enabled); setCommandContext(CommandContext.Enabled, enabled);
Messages.showGitDisabledErrorMessage();
void Messages.showGitDisabledErrorMessage();
return; return;
} }
@ -92,8 +92,8 @@ export async function activate(context: ExtensionContext) {
// Telemetry.setContext(telemetryContext); // Telemetry.setContext(telemetryContext);
notifyOnUnsupportedGitVersion(gitVersion); notifyOnUnsupportedGitVersion(gitVersion);
showWelcomePage(gitlensVersion, previousVersion);
Messages.showKeyBindingsInfoMessage();
void showWelcomePage(gitlensVersion, previousVersion);
void Messages.showKeyBindingsInfoMessage();
context.globalState.update(GlobalState.GitLensVersion, gitlensVersion); context.globalState.update(GlobalState.GitLensVersion, gitlensVersion);
@ -502,7 +502,7 @@ function notifyOnUnsupportedGitVersion(version: string) {
if (GitService.compareGitVersion('2.2.0') !== -1) return; if (GitService.compareGitVersion('2.2.0') !== -1) return;
// If git is less than v2.2.0 // If git is less than v2.2.0
Messages.showGitVersionUnsupportedErrorMessage(version);
void Messages.showGitVersionUnsupportedErrorMessage(version);
} }
async function showWelcomePage(version: string, previousVersion: string | undefined) { async function showWelcomePage(version: string, previousVersion: string | undefined) {

+ 1
- 1
src/quickpicks/commitFileQuickPick.ts View File

@ -412,7 +412,7 @@ export class CommitFileQuickPick {
} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`, } ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(), ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => { onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item as KeyCommand);
void scope.setKeyCommand('right', item as KeyCommand);
} }
} as QuickPickOptions); } as QuickPickOptions);

+ 1
- 1
src/quickpicks/commitQuickPick.ts View File

@ -405,7 +405,7 @@ export class CommitQuickPick {
}${commit.formattedDate} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`, }${commit.formattedDate} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${commit.getShortMessage()}`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(), ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => { onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item);
void scope.setKeyCommand('right', item);
if (typeof item.onDidSelect === 'function') { if (typeof item.onDidSelect === 'function') {
item.onDidSelect(); item.onDidSelect();
} }

+ 1
- 1
src/quickpicks/commonQuickPicks.ts View File

@ -24,7 +24,7 @@ export function getQuickPickIgnoreFocusOut() {
export function showQuickPickProgress(message: string, mapping?: KeyMapping): CancellationTokenSource { export function showQuickPickProgress(message: string, mapping?: KeyMapping): CancellationTokenSource {
const cancellation = new CancellationTokenSource(); const cancellation = new CancellationTokenSource();
_showQuickPickProgress(message, cancellation, mapping);
void _showQuickPickProgress(message, cancellation, mapping);
return cancellation; return cancellation;
} }

+ 1
- 1
src/quickpicks/repoStatusQuickPick.ts View File

@ -467,7 +467,7 @@ export class RepoStatusQuickPick {
}`, }`,
ignoreFocusOut: getQuickPickIgnoreFocusOut(), ignoreFocusOut: getQuickPickIgnoreFocusOut(),
onDidSelectItem: (item: QuickPickItem) => { onDidSelectItem: (item: QuickPickItem) => {
scope.setKeyCommand('right', item);
void scope.setKeyCommand('right', item);
} }
} as QuickPickOptions); } as QuickPickOptions);

+ 1
- 1
src/statusbar/statusBarController.ts View File

@ -124,7 +124,7 @@ export class StatusBarController implements Disposable {
} }
} }
async clearBlame() {
clearBlame() {
if (this._blameStatusBarItem !== undefined) { if (this._blameStatusBarItem !== undefined) {
this._blameStatusBarItem.hide(); this._blameStatusBarItem.hide();
} }

+ 2
- 2
src/trackers/activeEditorTracker.ts View File

@ -17,12 +17,12 @@ export class ActiveEditorTracker implements Disposable {
} }
async awaitClose(timeout: number = 500): Promise<TextEditor | undefined> { async awaitClose(timeout: number = 500): Promise<TextEditor | undefined> {
this.close();
void this.close();
return this.wait(timeout); return this.wait(timeout);
} }
async awaitNext(timeout: number = 500): Promise<TextEditor | undefined> { async awaitNext(timeout: number = 500): Promise<TextEditor | undefined> {
this.next();
void this.next();
return this.wait(timeout); return this.wait(timeout);
} }

+ 1
- 1
src/trackers/documentTracker.ts View File

@ -174,7 +174,7 @@ export class DocumentTracker implements Disposable {
private onTextDocumentSaved(document: TextDocument) { private onTextDocumentSaved(document: TextDocument) {
let doc = this._documentMap.get(document); let doc = this._documentMap.get(document);
if (doc !== undefined) { if (doc !== undefined) {
doc.update({ forceBlameChange: true });
void doc.update({ forceBlameChange: true });
return; return;
} }

+ 3
- 3
src/trackers/gitLineTracker.ts View File

@ -31,7 +31,7 @@ export class GitLineTracker extends LineTracker {
updated = await this.updateState(e.lines, e.editor); 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<GitDocumentState>) { private onBlameStateChanged(e: DocumentBlameStateChangeEvent<GitDocumentState>) {
@ -56,14 +56,14 @@ export class GitLineTracker extends LineTracker {
private _suspended = false; private _suspended = false;
private async resume(options: { force?: boolean } = {}) {
private resume(options: { force?: boolean } = {}) {
if (!options.force && !this._suspended) return; if (!options.force && !this._suspended) return;
this._suspended = false; this._suspended = false;
this.trigger('editor'); this.trigger('editor');
} }
private async suspend(options: { force?: boolean } = {}) {
private suspend(options: { force?: boolean } = {}) {
if (!options.force && this._suspended) return; if (!options.force && this._suspended) return;
this._suspended = true; this._suspended = true;

+ 3
- 3
src/trackers/lineTracker.ts View File

@ -122,7 +122,7 @@ export class LineTracker implements Disposable {
this._linesChangedDebounced.cancel(); this._linesChangedDebounced.cancel();
} }
this.fireLinesChanged(e);
void this.fireLinesChanged(e);
}); });
return; return;
@ -137,7 +137,7 @@ export class LineTracker implements Disposable {
return; return;
} }
this.fireLinesChanged(e);
void this.fireLinesChanged(e);
}, },
250, 250,
{ track: true } { 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 we have no pending moves, then fire an immediate pending event, and defer the real event
if (!this._linesChangedDebounced.pending!()) { if (!this._linesChangedDebounced.pending!()) {
this.fireLinesChanged({ ...e, pending: true });
void this.fireLinesChanged({ ...e, pending: true });
} }
this._linesChangedDebounced(e); this._linesChangedDebounced(e);

+ 2
- 2
src/trackers/trackedDocument.ts View File

@ -72,7 +72,7 @@ export class TrackedDocument implements Disposable {
// Reset any cached state // Reset any cached state
this.reset('repository'); this.reset('repository');
this.update();
void this.update();
} }
private _forceDirtyStateChangeOnNextDocumentChange: boolean = false; private _forceDirtyStateChangeOnNextDocumentChange: boolean = false;
@ -150,7 +150,7 @@ export class TrackedDocument implements Disposable {
this._blameFailed = true; this._blameFailed = true;
if (wasBlameable && isActiveDocument(this._document)) { if (wasBlameable && isActiveDocument(this._document)) {
this.update({ forceBlameChange: true });
void this.update({ forceBlameChange: true });
} }
} }

+ 10
- 7
src/views/gitExplorer.ts View File

@ -111,7 +111,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
window.onDidChangeVisibleTextEditors(Functions.debounce(this.onVisibleEditorsChanged, 500), this), window.onDidChangeVisibleTextEditors(Functions.debounce(this.onVisibleEditorsChanged, 500), this),
configuration.onDidChange(this.onConfigurationChanged, this) configuration.onDidChange(this.onConfigurationChanged, this)
); );
this.onConfigurationChanged(configuration.initializingChangeEvent);
void this.onConfigurationChanged(configuration.initializingChangeEvent);
} }
dispose() { dispose() {
@ -140,7 +140,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
} }
if (initializing || configuration.changed(e, configuration.name('gitExplorer')('autoRefresh').value)) { if (initializing || configuration.changed(e, configuration.name('gitExplorer')('autoRefresh').value)) {
this.setAutoRefresh(Container.config.gitExplorer.autoRefresh);
void this.setAutoRefresh(Container.config.gitExplorer.autoRefresh);
} }
// if (!initializing && configuration.changed(e, configuration.name('gitExplorer')('undockHistory').value)) { // if (!initializing && configuration.changed(e, configuration.name('gitExplorer')('undockHistory').value)) {
@ -185,7 +185,10 @@ export class GitExplorer extends Disposable implements TreeDataProvider
return; return;
} }
this.reset(view!, configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value));
void this.reset(
view!,
configuration.changed(e, configuration.name('advanced')('fileHistoryFollowsRenames').value)
);
} }
private async onActiveEditorChanged(editor: TextEditor | undefined) { private async onActiveEditorChanged(editor: TextEditor | undefined) {
@ -194,7 +197,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
const root = await this.getRootNode(editor); const root = await this.getRootNode(editor);
if (!this.setRoot(root)) return; if (!this.setRoot(root)) return;
this.refresh(RefreshReason.ActiveEditorChanged, root);
void this.refresh(RefreshReason.ActiveEditorChanged, root);
} }
private onRepositoriesChanged() { private onRepositoriesChanged() {
@ -204,7 +207,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
Logger.log(`GitExplorer[view=${this.view}].onRepositoriesChanged`); Logger.log(`GitExplorer[view=${this.view}].onRepositoriesChanged`);
this.refresh(RefreshReason.RepoChanged);
void this.refresh(RefreshReason.RepoChanged);
} }
private onVisibleEditorsChanged(editors: TextEditor[]) { private onVisibleEditorsChanged(editors: TextEditor[]) {
@ -214,7 +217,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
if (editors.length === 0 || !editors.some(e => e.document && Container.git.isTrackable(e.document.uri))) { if (editors.length === 0 || !editors.some(e => e.document && Container.git.isTrackable(e.document.uri))) {
this.clearRoot(); this.clearRoot();
this.refresh(RefreshReason.VisibleEditorsChanged);
void this.refresh(RefreshReason.VisibleEditorsChanged);
} }
} }
@ -349,7 +352,7 @@ export class GitExplorer extends Disposable implements TreeDataProvider
setCommandContext(CommandContext.GitExplorerAutoRefresh, enabled && workspaceEnabled); setCommandContext(CommandContext.GitExplorerAutoRefresh, enabled && workspaceEnabled);
if (toggled) { if (toggled) {
this.refresh(RefreshReason.AutoRefreshChanged);
void this.refresh(RefreshReason.AutoRefreshChanged);
} }
} }

+ 6
- 6
src/views/historyExplorer.ts View File

@ -60,7 +60,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
window.onDidChangeVisibleTextEditors(Functions.debounce(this.onVisibleEditorsChanged, 500), this), window.onDidChangeVisibleTextEditors(Functions.debounce(this.onVisibleEditorsChanged, 500), this),
configuration.onDidChange(this.onConfigurationChanged, this) configuration.onDidChange(this.onConfigurationChanged, this)
); );
this.onConfigurationChanged(configuration.initializingChangeEvent);
void this.onConfigurationChanged(configuration.initializingChangeEvent);
} }
dispose() { dispose() {
@ -90,10 +90,10 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
if (initializing || configuration.changed(e, configuration.name('historyExplorer')('enabled').value)) { if (initializing || configuration.changed(e, configuration.name('historyExplorer')('enabled').value)) {
if (this.config.enabled) { if (this.config.enabled) {
this.undock(!initializing, !configuration.changed(e, configuration.name('mode').value));
void this.undock(!initializing, !configuration.changed(e, configuration.name('mode').value));
} }
else { else {
this.dock(!initializing, !configuration.changed(e, configuration.name('mode').value));
void this.dock(!initializing, !configuration.changed(e, configuration.name('mode').value));
} }
} }
@ -114,7 +114,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
} }
if (!initializing && this._root !== undefined) { if (!initializing && this._root !== undefined) {
this.refresh(RefreshReason.ConfigurationChanged);
void this.refresh(RefreshReason.ConfigurationChanged);
} }
} }
@ -122,7 +122,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
const root = await this.getRootNode(editor); const root = await this.getRootNode(editor);
if (!this.setRoot(root)) return; if (!this.setRoot(root)) return;
this.refresh(RefreshReason.ActiveEditorChanged, root);
void this.refresh(RefreshReason.ActiveEditorChanged, root);
} }
private onVisibleEditorsChanged(editors: TextEditor[]) { private onVisibleEditorsChanged(editors: TextEditor[]) {
@ -132,7 +132,7 @@ export class HistoryExplorer extends Disposable implements TreeDataProvider
if (editors.length === 0 || !editors.some(e => e.document && Container.git.isTrackable(e.document.uri))) { if (editors.length === 0 || !editors.some(e => e.document && Container.git.isTrackable(e.document.uri))) {
this.clearRoot(); this.clearRoot();
this.refresh(RefreshReason.VisibleEditorsChanged);
void this.refresh(RefreshReason.VisibleEditorsChanged);
} }
} }

+ 1
- 1
src/views/nodes/activeRepositoryNode.ts View File

@ -20,7 +20,7 @@ export class ActiveRepositoryNode extends ExplorerNode {
window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveEditorChanged, 500), this) window.onDidChangeActiveTextEditor(Functions.debounce(this.onActiveEditorChanged, 500), this)
); );
this.onActiveEditorChanged(window.activeTextEditor);
void this.onActiveEditorChanged(window.activeTextEditor);
} }
dispose() { dispose() {

+ 7
- 7
src/views/resultsExplorer.ts View File

@ -70,7 +70,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab
setCommandContext(CommandContext.ResultsExplorerKeepResults, this.keepResults); setCommandContext(CommandContext.ResultsExplorerKeepResults, this.keepResults);
Container.context.subscriptions.push(configuration.onDidChange(this.onConfigurationChanged, this)); Container.context.subscriptions.push(configuration.onDidChange(this.onConfigurationChanged, this));
this.onConfigurationChanged(configuration.initializingChangeEvent);
void this.onConfigurationChanged(configuration.initializingChangeEvent);
} }
dispose() { dispose() {
@ -106,7 +106,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab
} }
if (!initializing && this._roots.length !== 0) { 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) { showComparisonInResults(repoPath: string, ref1: string | NamedRef, ref2: string | NamedRef) {
this.showResults(
void this.showResults(
this.addResults( this.addResults(
new ComparisonResultsNode( new ComparisonResultsNode(
repoPath, repoPath,
@ -204,7 +204,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab
} }
showCommitInResults(commit: GitLogCommit) { showCommitInResults(commit: GitLogCommit) {
this.showResults(this.addResults(new CommitResultsNode(commit, this)));
void this.showResults(this.addResults(new CommitResultsNode(commit, this)));
} }
showCommitsInResults( showCommitsInResults(
@ -244,7 +244,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab
})} for ${resultsLabel.label}${repository}`; })} for ${resultsLabel.label}${repository}`;
}; };
this.showResults(
void this.showResults(
this.addResults( this.addResults(
new CommitsResultsNode( new CommitsResultsNode(
results.repoPath, results.repoPath,
@ -282,7 +282,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab
this._roots.forEach(r => r.dispose()); this._roots.forEach(r => r.dispose());
this._roots = []; this._roots = [];
this.refresh();
void this.refresh();
} }
private clearResultsNode(node: ExplorerNode) { private clearResultsNode(node: ExplorerNode) {
@ -293,7 +293,7 @@ export class ResultsExplorer implements TreeDataProvider, Disposab
node.dispose(); node.dispose();
this.refresh();
void this.refresh();
} }
private setFilesLayout(layout: ExplorerFilesLayout) { private setFilesLayout(layout: ExplorerFilesLayout) {

+ 1
- 1
src/webviews/webviewEditor.ts View File

@ -64,7 +64,7 @@ export abstract class WebviewEditor implements Disposable {
break; break;
default: default:
this.show();
void this.show();
break; break;
} }
} }

+ 1
- 0
tslint.json View File

@ -17,6 +17,7 @@
"no-default-export": true, "no-default-export": true,
"no-duplicate-variable": true, "no-duplicate-variable": true,
"no-eval": true, "no-eval": true,
"no-floating-promises": true,
"no-inferrable-types": [true, "ignore-params", "ignore-properties"], "no-inferrable-types": [true, "ignore-params", "ignore-properties"],
"no-internal-module": true, "no-internal-module": true,
"no-irregular-whitespace": true, "no-irregular-whitespace": true,

Loading…
Cancel
Save