Skip to content

Commit

Permalink
Adds more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Sep 25, 2019
1 parent 52db302 commit 8fa2cab
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/annotations/lineAnnotationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ export class LineAnnotationController implements Disposable {
return false;
}

@debug({
args: {
0: (e: LinesChangeEvent) =>
`editor=${e.editor ? e.editor.document.uri.toString(true) : undefined}, lines=${
e.lines ? e.lines.join(',') : undefined
}, pending=${Boolean(e.pending)}, reason=${e.reason}`
}
})
private onActiveLinesChanged(e: LinesChangeEvent) {
if (!e.pending && e.lines !== undefined) {
void this.refresh(e.editor);
Expand Down Expand Up @@ -140,6 +148,10 @@ export class LineAnnotationController implements Disposable {

const lines = Container.lineTracker.lines;
if (editor === undefined || lines === undefined || !isTextEditor(editor)) {
if (cc) {
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because there is no valid editor or no valid lines`;
}

this.clear(this._editor);
return;
}
Expand All @@ -154,7 +166,7 @@ export class LineAnnotationController implements Disposable {
const cfg = Container.config.currentLine;
if (this.suspended) {
if (cc) {
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because suspended`;
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because the controller is suspended`;
}

this.clear(editor);
Expand All @@ -164,8 +176,10 @@ export class LineAnnotationController implements Disposable {
const trackedDocument = await Container.tracker.getOrAdd(editor.document);
if (!trackedDocument.isBlameable && this.suspended) {
if (cc) {
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because ${
this.suspended ? 'suspended' : `document(${trackedDocument.uri.toString(true)}) is not blameable`
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because the ${
this.suspended
? 'controller is suspended'
: `document(${trackedDocument.uri.toString(true)}) is not blameable`
}`;
}

Expand All @@ -176,7 +190,7 @@ 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)) {
if (cc) {
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because ${
cc.exitDetails = ` ${GlyphChars.Dot} Skipped because the ${
editor.document === undefined ? 'editor is gone' : `line(s)=${lines.join()} are no longer current`
}`;
}
Expand Down

0 comments on commit 8fa2cab

Please sign in to comment.