From c0edd2c064e436eddd6c7c54f078373f86384834 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 24 May 2022 02:05:04 -0400 Subject: [PATCH] Adds better logging to document tracking --- src/trackers/documentTracker.ts | 10 +++++++++- src/trackers/gitLineTracker.ts | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/trackers/documentTracker.ts b/src/trackers/documentTracker.ts index c2e27f1..ae6c281 100644 --- a/src/trackers/documentTracker.ts +++ b/src/trackers/documentTracker.ts @@ -22,9 +22,10 @@ import { setContext } from '../context'; import { RepositoriesChangeEvent } from '../git/gitProviderService'; import { GitUri } from '../git/gitUri'; import { RepositoryChange, RepositoryChangeComparisonMode, RepositoryChangeEvent } from '../git/models'; +import { debug } from '../system/decorators/log'; import { once } from '../system/event'; import { debounce, Deferrable } from '../system/function'; -import { filter, map } from '../system/iterable'; +import { filter, join, map } from '../system/iterable'; import { getBestPath } from '../system/path'; import { isActiveDocument, isTextEditor } from '../system/utils'; import { DocumentBlameStateChangeEvent, TrackedDocument } from './trackedDocument'; @@ -386,12 +387,19 @@ export class DocumentTracker implements Disposable { this._dirtyStateChangedDebounced(e); } + @debug['reset']>({ + args: { + 1: c => (c != null ? join(c, ',') : ''), + 2: r => (r != null ? join(r, ',') : ''), + }, + }) private reset(reason: 'config' | 'repository', changedRepoPaths?: Set, removedRepoPaths?: Set) { void Promise.allSettled( map( filter(this._documentMap, ([key]) => typeof key === 'string'), async ([, promise]) => { const doc = await promise; + if (removedRepoPaths?.has(doc.uri.repoPath!)) { void this.remove(doc.document, doc); return; diff --git a/src/trackers/gitLineTracker.ts b/src/trackers/gitLineTracker.ts index 9c949c9..bb4dafe 100644 --- a/src/trackers/gitLineTracker.ts +++ b/src/trackers/gitLineTracker.ts @@ -125,7 +125,6 @@ export class GitLineTracker extends LineTracker { @debug({ args: { 0: selections => selections?.map(s => s.active).join(','), 1: e => e.document.uri.toString(true) }, exit: updated => `returned ${updated}`, - singleLine: true, }) private async updateState(selections: LineSelection[], editor: TextEditor): Promise { const cc = Logger.getCorrelationContext();