fix: final-review wave — preview host INV-10 gate, thread status+offer contextValue tokens, establish-on-open baseline, polish
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+19
-3
@@ -402,6 +402,14 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
||||
// at the call site and avoids the no-op calls for a non-entered doc.
|
||||
const renderIfOpen = (doc: vscode.TextDocument) => {
|
||||
if (isAuthorable(doc.uri.scheme) && coeditingRegistry.isCoediting(doc.uri)) {
|
||||
// Finding 3 (final whole-branch review): DiffViewController only
|
||||
// establishes a baseline on the registry's enter TRANSITION and, at
|
||||
// startup, for documents already open. A doc that is a PERSISTED
|
||||
// coediting member but wasn't open yet at either of those moments (e.g.
|
||||
// lazily restored after a window reload) reaches this handler with no
|
||||
// baseline/mode — establish it now so QuickDiff/Review-Changes/Mark-
|
||||
// Reviewed never see a silent empty-baseline gap.
|
||||
if (diffViewController.modeOf(doc.uri.toString()) === undefined) void diffViewController.establish(doc);
|
||||
threadController.renderAll(doc);
|
||||
attributionController.loadAll(doc);
|
||||
proposalController.renderAll(doc);
|
||||
@@ -412,7 +420,7 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
||||
|
||||
// --- Task 7 (D3/D21, PUC-3): annotations in the BUILT-IN Markdown preview ---
|
||||
// `env.currentDocument` (VS Code's markdown-it render env) is an OBSERVED
|
||||
// preview-engine behavior, not a documented contract, so `lastActiveCoedited`
|
||||
// preview-engine behavior, not a documented contract, so `lastCoeditedUri`
|
||||
// is the fallback that keeps single-doc correctness when it's absent — the
|
||||
// last editor that WAS coediting when it lost focus (e.g. focus moved to the
|
||||
// preview pane itself) stays the annotation target until a different
|
||||
@@ -433,8 +441,16 @@ export function activate(context: vscode.ExtensionContext): CowritingApi | undef
|
||||
const previewAnnotationHost = {
|
||||
inputsFor(env: unknown): AnnotationInputs | undefined {
|
||||
const envUri = (env as { currentDocument?: { toString(): string } } | undefined)?.currentDocument?.toString();
|
||||
const key = envUri && coeditingRegistry.list().includes(envUri) ? envUri : lastCoeditedUri;
|
||||
if (!key) return undefined;
|
||||
// Finding 1 (final whole-branch review): the `lastCoeditedUri` fallback
|
||||
// is for an ABSENT env only (env.currentDocument didn't resolve) — a
|
||||
// present envUri is authoritative for the doc actually being previewed
|
||||
// and must never fall back to a different (or since-exited) document's
|
||||
// inputs. Either way, the winning key must currently be a coediting
|
||||
// member (INV-10) — an exited doc's stale `lastCoeditedUri` fails this
|
||||
// check too, closing the "preview stays annotated after stopCoediting"
|
||||
// gap.
|
||||
const key = envUri === undefined ? lastCoeditedUri : envUri;
|
||||
if (!key || !coeditingRegistry.list().includes(key)) return undefined;
|
||||
const doc = vscode.workspace.textDocuments.find((d) => d.uri.toString() === key);
|
||||
if (!doc) return undefined;
|
||||
const baseline = diffViewController.getBaseline(key);
|
||||
|
||||
Reference in New Issue
Block a user