Skip to content

DiffRegionStore

DiffRegionStore = object

Which collapsed regions are expanded, and who owns that answer.

Split mode is two editors holding two documents, which means two plugin instances — and a separator row is one region shown twice, once per side. If each instance kept its own expansion set, one gutter click would expand the left pane and leave the right where it was, and every row below would be misaligned. That is the single property split mode exists to hold (§C7).

So expansion is a store the sides share rather than state each side owns. A host building a split view creates one store and passes it to both plugins; a stacked host passes nothing and gets a private one. This is not the mirroring §C5 forbids — nobody is keeping a second copy in sync. There is one copy, and both sides read it.

getExpandedRegions(): ReadonlySet<string>

ReadonlySet<string>


isExpanded(key): boolean

string

boolean


onDidChange(listener): EditorDisposable

() => void

EditorDisposable


setFile(file): void

Points the store at a diff. Expansion is per diff, not per path — see the note below — so this drops the current set whenever the identity changes.

DiffFile | null

void


toggleRegion(key): void

string

void