feat(f7): additive onDidChangeBaseline event on DiffViewController (#21)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,11 @@ export class DiffViewController implements vscode.Disposable {
|
||||
/** Source of truth for the content provider, keyed by `document.uri.toString()`. */
|
||||
private readonly baselines = new Map<string, Baseline>();
|
||||
private readonly onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>();
|
||||
/** F7 (additive): fires on every baseline capture (open / advance / pin) so
|
||||
* the track-changes preview refreshes without polling. Mirrors the internal
|
||||
* content-provider change signal but carries the real document URI. */
|
||||
private readonly onDidChangeBaselineEmitter = new vscode.EventEmitter<{ uri: string }>();
|
||||
readonly onDidChangeBaseline = this.onDidChangeBaselineEmitter.event;
|
||||
private storageWarned = false;
|
||||
|
||||
constructor(private readonly store: BaselineStore | null) {
|
||||
@@ -38,6 +43,7 @@ export class DiffViewController implements vscode.Disposable {
|
||||
};
|
||||
this.disposables.push(
|
||||
this.onDidChangeEmitter,
|
||||
this.onDidChangeBaselineEmitter,
|
||||
vscode.workspace.registerTextDocumentContentProvider(BASELINE_SCHEME, provider),
|
||||
vscode.commands.registerCommand("cowriting.toggleDiffView", () =>
|
||||
this.toggle(vscode.window.activeTextEditor),
|
||||
@@ -123,6 +129,7 @@ export class DiffViewController implements vscode.Disposable {
|
||||
}
|
||||
// An open diff re-requests the left side when its baseline URI changes.
|
||||
this.onDidChangeEmitter.fire(this.baselineUri(document));
|
||||
this.onDidChangeBaselineEmitter.fire({ uri: key });
|
||||
}
|
||||
|
||||
private warnStorageOnce(): void {
|
||||
|
||||
Reference in New Issue
Block a user