Browse Source

Stops exposing underlying TextDocument

main
Eric Amodio 7 years ago
parent
commit
fbb1328007
4 changed files with 13 additions and 5 deletions
  1. +1
    -1
      src/annotations/annotationController.ts
  2. +1
    -1
      src/codeLensController.ts
  3. +1
    -1
      src/currentLineController.ts
  4. +10
    -2
      src/trackers/trackedDocument.ts

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

@ -199,7 +199,7 @@ export class AnnotationController extends Disposable {
private onDirtyStateChanged(e: DocumentDirtyStateChangeEvent<GitDocumentState>) {
for (const [key, p] of this._annotationProviders) {
if (p.document !== e.document.document) continue;
if (!e.document.is(p.document)) continue;
this.clearCore(key, AnnotationClearReason.DocumentChanged);
}

+ 1
- 1
src/codeLensController.ts View File

@ -73,7 +73,7 @@ export class CodeLensController extends Disposable {
if (this._provider === undefined || !e.document.isBlameable) return;
const maxLines = configuration.get<number>(configuration.name('advanced')('blame')('sizeThresholdAfterEdit').value);
if (maxLines > 0 && e.document.document.lineCount > maxLines) return;
if (maxLines > 0 && e.document.lineCount > maxLines) return;
Logger.log('Dirty idle triggered; resetting CodeLens provider');
this._provider.reset('idle');

+ 1
- 1
src/currentLineController.ts View File

@ -204,7 +204,7 @@ export class CurrentLineController extends Disposable {
private onDirtyIdleTriggered(e: DocumentDirtyIdleTriggerEvent<GitDocumentState>) {
const maxLines = configuration.get<number>(configuration.name('advanced')('blame')('sizeThresholdAfterEdit').value);
if (maxLines > 0 && e.document.document.lineCount > maxLines) return;
if (maxLines > 0 && e.document.lineCount > maxLines) return;
this.resumeBlameAnnotations('dirty', window.activeTextEditor);
}

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

@ -26,14 +26,14 @@ export class TrackedDocument extends Disposable {
private _uri: GitUri;
constructor(
public readonly document: TextDocument,
private readonly _document: TextDocument,
public readonly key: string,
public dirty: boolean,
private _eventDelegates: { onDidBlameStateChange: (e: DocumentBlameStateChangeEvent<T>) => void }
) {
super(() => this.dispose());
this._repo = this.initialize(document.uri);
this._repo = this.initialize(_document.uri);
}
dispose() {
@ -101,6 +101,10 @@ export class TrackedDocument extends Disposable {
return this._isTracked;
}
get lineCount(): number {
return this._document.lineCount;
}
get uri() {
return this._uri;
}
@ -116,6 +120,10 @@ export class TrackedDocument extends Disposable {
await this._repo;
}
is(document: TextDocument) {
return document === this._document;
}
reset(reason: 'config' | 'dispose' | 'document' | 'repository') {
this._blameFailed = false;
this._isDirtyIdle = false;

Loading…
Cancel
Save