Преглед изворни кода

Fixes issue with line blame toggle not working

When current line blame starts off, the toggle doesn't work
main
Eric Amodio пре 6 година
родитељ
комит
0884098748
2 измењених фајлова са 29 додато и 11 уклоњено
  1. +24
    -10
      src/annotations/lineAnnotationController.ts
  2. +5
    -1
      src/trackers/gitLineTracker.ts

+ 24
- 10
src/annotations/lineAnnotationController.ts Прегледај датотеку

@ -50,18 +50,11 @@ export class LineAnnotationController extends Disposable {
const cfg = configuration.get<IConfig>();
if (cfg.currentLine.enabled) {
this._enabled = true;
Container.lineTracker.start(
this,
Disposable.from(
Container.lineTracker.onDidChangeActiveLines(this.onActiveLinesChanged, this)
)
);
this.resume();
}
else {
this._enabled = false;
Container.lineTracker.stop(this);
this.setLineTracker(false);
}
}
@ -74,6 +67,8 @@ export class LineAnnotationController extends Disposable {
}
resume(reason: 'debugging' | 'user' = 'user') {
this.setLineTracker(true);
switch (reason) {
case 'debugging':
if (this._suspended !== 'user') {
@ -94,6 +89,8 @@ export class LineAnnotationController extends Disposable {
}
suspend(reason: 'debugging' | 'user' = 'user') {
this.setLineTracker(false);
if (this._suspended !== 'user') {
this._suspended = reason;
return true;
@ -201,4 +198,21 @@ export class LineAnnotationController extends Disposable {
editor.setDecorations(annotationDecoration, decorations);
}
}
private setLineTracker(enabled: boolean) {
if (enabled) {
if (!Container.lineTracker.isSubscribed(this)) {
Container.lineTracker.start(
this,
Disposable.from(
Container.lineTracker.onDidChangeActiveLines(this.onActiveLinesChanged, this)
)
);
}
return;
}
Container.lineTracker.stop(this);
}
}

+ 5
- 1
src/trackers/gitLineTracker.ts Прегледај датотеку

@ -67,8 +67,12 @@ export class GitLineTracker extends LineTracker {
this.trigger('editor');
}
isSubscribed(subscriber: any) {
return this._subscriptions.has(subscriber);
}
start(subscriber: any, subscription: Disposable): void {
if (this._subscriptions.has(subscriber)) return;
if (this.isSubscribed(subscriber)) return;
this._subscriptions.set(subscriber, subscription);

Loading…
Откажи
Сачувај