In this section · 06 Compare and check itModes
06 · Compare and check it
One document or two: the editor’s four modes
What the four modes under Mode do, which one to be in for the job you have, and what survives a switch between them.
The editor always shows two panes, and the strip of controls above them — the band — says how those panes relate to each other. That relationship is the mode, and there are four of them under Mode: View, Mirror, Compare and Schema. Knowing which one you are in explains most of what the editor appears to do differently from one moment to the next.
The distinction that matters is how many documents are in play. View and Mirror have one: two panes showing the same thing, or one pane taking the whole width. Compare and Schema have two, and the second one means something specific — another version of the document in Compare, a set of rules about it in Schema. Everything else follows from that.
It follows, for instance, that Repair acts on a pane rather than on “the document”, and the band names which pane before you press. It follows that an extract needs somewhere to write, so running one from Mirror moves you to Compare first. And it follows that a search means two different things: one search across two views of one document, or a separate search in each of two documents.
Which mode do I want?
Input
You have two files and you want to know what changed between them.
Do
- In the editor band, open Mode.
- Choose Compare — the only one of the four that holds two documents you can diff.
Result
View and Mirror show one document; Compare and Schema hold two. Pick by how many documents you have and what you want the second pane to mean.
Pick by counting documents. If you have one and want the most room for it, that is View. If you have one and want to read it two ways at once — the text and a tree, say — that is Mirror, and it is where the editor starts. If you have two versions of a thing and want the differences, that is Compare. If you have a document and a JSON Schema, that is Schema.
The mode is remembered per tab, along with both documents and each pane’s view, so coming back to the editor puts you where you left off rather than at the default. Nothing about a mode is a preference you have to set up: it is just which arrangement of panes the job in front of you wants.
View: one document, full width
Input
A deeply nested document on a laptop screen, with the tree rows wrapping at half the width.
Do
- In the editor band, under Mode, choose View.
Result
One pane takes the whole window. The other document is not closed — it is waiting in Mirror or Compare.
View gives a single document the entire window. It is the mode for a deep tree on a laptop screen, where splitting the width in half means every row wraps, and for reading a long document without the second pane competing for attention.
The other document is not closed and not lost. View is a way of showing the panes, not a way of emptying one — switch to Mirror or Compare and whatever was on the other side is exactly where it was. That is the same promise every mode switch makes, and it is what makes moving between them cheap.
Mirror: one document, two views
Input
One document you are editing as text and reading as a tree at the same time.
Do
- In the editor band, under Mode, choose Mirror — it is where the editor starts.
Result
Both panes show one document. Type on the left and the right follows; a search marks its matches in both.
Mirror is the default and the one most work happens in: both panes are views of one document. Edit the text on the left and the tree on the right follows as you type; fold a branch on the right and the text does not move, because folding is a way of looking rather than a change.
A search in Mirror is one search. Open the Find bar, type a word, and the matches are marked in both panes at once, because there is only one document to search. That is the behaviour people expect and do not notice — right up until they switch to Compare, where two documents means two bars and two counts.
How to compare JSON files and see what changed
Compare gives each pane a document of its own and marks the differences between them down the gutter, by structure rather than line by line — so re-indenting a file or reordering two keys does not show up as a change, and a value that really is different does. That guide works through two releases of one config, five differences and the readouts that report them, and its example opens both panes for you.
Why a JSON Schema check says “not fully checked”
Schema puts the document on the left and a JSON Schema on the right and checks one against the other, marking the failures on the document and the parts it could not check on the schema. That guide covers the four verdicts it can give — including the one that says the check was incomplete rather than pretending otherwise — and the panel that lists what failed.
Switching between modes
Input
You are in Compare with two documents, and you switch to Mirror to read one of them.
Do
- In the editor band, under Mode, choose Mirror.
- Change your mind and choose Compare again.
Result
The right document is exactly where it was. No mode switch throws a document away, which is why none of them asks.
No mode switch throws a document away, which is why none of them asks you to confirm. The right pane’s document is kept whatever mode you are in: Mirror stops showing it, View stops showing it, and Compare shows it again unchanged. A question with only one sensible answer is a question not worth asking.
What does change is what the panes mean, and the editor updates with them. Entering Compare turns the difference marking on and opens a search bar per pane; leaving it puts the second document back into storage and goes quiet about differences. Each pane keeps the view it was showing, so a tree stays a tree across a switch.
Where the mode lives, and how to change it
Mode is a heading on the band, with the four modes listed under it and the current one marked. Beside each of them, where a guide exists, is a link to the page that explains it — the two on this page are the cards above, which is why those headings have addresses of their own. Changing mode takes one press and nothing is confirmed, because nothing is lost.
The command palette reaches the same four, which is often quicker than finding the band: ⌘K on a Mac, Ctrl+K on Windows and Linux, then the name of the mode you want. That is also the fastest way to discover which commands depend on the mode, since a command that needs a second document will say so there rather than silently doing nothing.
What the gutter does in each mode
The strip between the panes carries the controls that act on the pair rather than on one document, which is why its contents change with the mode. In Compare it holds the difference count, the arrows for stepping through the changes, the toggles for synchronised scrolling and difference highlighting, and the buttons for copying one document over the other.
In Mirror there is only one document, so most of that has nothing to act on and is not shown. What stays is the handful of things that genuinely concern both panes at once — opening a search across them, and the divider itself, which drags to give either side more room.
What a mode changes about the tools
Most of the editor’s commands work the same everywhere and simply need to know which pane they are acting on. A few genuinely depend on the mode, and those are the ones worth knowing about in advance, because they are where the editor appears to behave inconsistently until you see the rule.
Extract is the clearest case. Pulling the matches of a search out as a document of their own needs a second pane to write into, so running it from Mirror switches you to Compare first and says so in the status bar. It also turns the difference highlighting off, because an extract differs from the document it came from almost everywhere and colouring all of it would tell you nothing.
Validation is the other. The verdict on the band only means anything when there is a schema to check against, so it appears in Schema and is quiet elsewhere. Repair, Format, Minify and Sort keys are the opposite: they act on one pane’s text and do not care how the pair is arranged, which is why they sit in the pane toolbars rather than in the band.
Two documents and one browser tab
Both documents live in this tab and nowhere else. They are kept per tab, so a second tab is a genuinely separate workspace with its own pair of documents and its own mode, and nothing you do in one reaches the other. Nothing is uploaded, which is the reason two production configs are a reasonable thing to compare here.
That also sets the limit worth knowing: closing the tab is the end of the session. The documents come back after a reload, but they are not a project stored somewhere you can return to from another machine. If a document matters, save it — which takes one press, and is covered on Open and save a document.
Open the editor and try the Mode menu, or go straight to How to compare JSON files and see what changed if you have two files to put side by side.