From b94b97135dee614c79d9b21e30d8231d2231989b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 29 Apr 2019 04:05:50 -0400 Subject: [PATCH] Adds more debug logging --- src/annotations/lineAnnotationController.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/annotations/lineAnnotationController.ts b/src/annotations/lineAnnotationController.ts index a2c9668..0400f5f 100644 --- a/src/annotations/lineAnnotationController.ts +++ b/src/annotations/lineAnnotationController.ts @@ -10,11 +10,12 @@ import { window } from 'vscode'; import { configuration } from '../configuration'; -import { isTextEditor } from '../constants'; +import { GlyphChars, isTextEditor } from '../constants'; import { Container } from '../container'; import { LinesChangeEvent } from '../trackers/gitLineTracker'; import { Annotations } from './annotations'; -import { log } from '../system'; +import { debug, log } from '../system'; +import { Logger } from '../logger'; const annotationDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({ after: { @@ -104,6 +105,7 @@ export class LineAnnotationController implements Disposable { void this.refresh(window.activeTextEditor); } + @debug({ args: false }) clear(editor: TextEditor | undefined) { if (this._editor !== editor && this._editor !== undefined) { this.clearAnnotations(this._editor); @@ -111,6 +113,7 @@ export class LineAnnotationController implements Disposable { this.clearAnnotations(editor); } + @log({ args: false }) async toggle(editor: TextEditor | undefined) { this._enabled = !(this._enabled && !this.suspended); @@ -130,9 +133,12 @@ export class LineAnnotationController implements Disposable { editor.setDecorations(annotationDecoration, []); } + @debug({ args: false }) private async refresh(editor: TextEditor | undefined) { if (editor === undefined && this._editor === undefined) return; + const cc = Logger.getCorrelationContext(); + const lines = Container.lineTracker.lines; if (editor === undefined || lines === undefined || !isTextEditor(editor)) { this.clear(this._editor); @@ -159,7 +165,18 @@ export class LineAnnotationController implements Disposable { } // Make sure the editor hasn't died since the await above and that we are still on the same line(s) - if (editor.document === undefined || !Container.lineTracker.includesAll(lines)) return; + if (editor.document === undefined || !Container.lineTracker.includesAll(lines)) { + if (cc) { + cc.exitDetails = ` ${GlyphChars.Dot} Skipped because ${ + editor.document === undefined ? 'editor is gone' : `line(s)=${lines.join()} are no longer current` + }`; + } + return; + } + + if (cc) { + cc.exitDetails = ` ${GlyphChars.Dot} line(s)=${lines.join()}`; + } const scrollable = Container.config.currentLine.scrollable;