Skip to content

Commit fbb1328

Browse files
committed
Stops exposing underlying TextDocument
1 parent f7b2638 commit fbb1328

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

src/annotations/annotationController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class AnnotationController extends Disposable {
199199

200200
private onDirtyStateChanged(e: DocumentDirtyStateChangeEvent<GitDocumentState>) {
201201
for (const [key, p] of this._annotationProviders) {
202-
if (p.document !== e.document.document) continue;
202+
if (!e.document.is(p.document)) continue;
203203

204204
this.clearCore(key, AnnotationClearReason.DocumentChanged);
205205
}

src/codeLensController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class CodeLensController extends Disposable {
7373
if (this._provider === undefined || !e.document.isBlameable) return;
7474

7575
const maxLines = configuration.get<number>(configuration.name('advanced')('blame')('sizeThresholdAfterEdit').value);
76-
if (maxLines > 0 && e.document.document.lineCount > maxLines) return;
76+
if (maxLines > 0 && e.document.lineCount > maxLines) return;
7777

7878
Logger.log('Dirty idle triggered; resetting CodeLens provider');
7979
this._provider.reset('idle');

src/currentLineController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class CurrentLineController extends Disposable {
204204

205205
private onDirtyIdleTriggered(e: DocumentDirtyIdleTriggerEvent<GitDocumentState>) {
206206
const maxLines = configuration.get<number>(configuration.name('advanced')('blame')('sizeThresholdAfterEdit').value);
207-
if (maxLines > 0 && e.document.document.lineCount > maxLines) return;
207+
if (maxLines > 0 && e.document.lineCount > maxLines) return;
208208

209209
this.resumeBlameAnnotations('dirty', window.activeTextEditor);
210210
}

src/trackers/trackedDocument.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ export class TrackedDocument<T> extends Disposable {
2626
private _uri: GitUri;
2727

2828
constructor(
29-
public readonly document: TextDocument,
29+
private readonly _document: TextDocument,
3030
public readonly key: string,
3131
public dirty: boolean,
3232
private _eventDelegates: { onDidBlameStateChange: (e: DocumentBlameStateChangeEvent<T>) => void }
3333
) {
3434
super(() => this.dispose());
3535

36-
this._repo = this.initialize(document.uri);
36+
this._repo = this.initialize(_document.uri);
3737
}
3838

3939
dispose() {
@@ -101,6 +101,10 @@ export class TrackedDocument<T> extends Disposable {
101101
return this._isTracked;
102102
}
103103

104+
get lineCount(): number {
105+
return this._document.lineCount;
106+
}
107+
104108
get uri() {
105109
return this._uri;
106110
}
@@ -116,6 +120,10 @@ export class TrackedDocument<T> extends Disposable {
116120
await this._repo;
117121
}
118122

123+
is(document: TextDocument) {
124+
return document === this._document;
125+
}
126+
119127
reset(reason: 'config' | 'dispose' | 'document' | 'repository') {
120128
this._blameFailed = false;
121129
this._isDirtyIdle = false;

0 commit comments

Comments
 (0)