fix: opening a different graph in a diagram that is already open - #52
Merged
Merged
Conversation
The open command stashes the requested graph name and then calls `vscode.openWith`. The stash is read by the INITIAL model request, and an editor that already exists does not make one — `openWith` focuses it instead. So asking for a different graph inside a file you were already looking at did nothing: the name was recorded, the tab came forward, and the diagram kept showing what it showed before. That is the ordinary way to move between the graphs in one file, and it is the case where nothing happening is hardest to read, because the command plainly did SOMETHING — the editor took focus. A reader has no way to tell a command that silently declined from one that is not wired up. When a diagram for the file is already open, the command now refreshes it with the requested name. A refresh already carries `networkName` into a fresh model request; that is the mechanism a drill-down relies on, so this reuses it rather than adding a second path. "Already open" is asked before opening, because opening is what makes it true. The split-view command had the same shape and is fixed the same way. Leaving a known identical bug beside a fixed one is worse than fixing both. Neither path changes for a diagram that is not yet open: the stash is still what the initial request reads, and no extra round trip is added to a fresh open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
The open command stashes the requested graph name, then calls
vscode.openWith:The stash is read by the initial model request. An editor that already exists does not make one —
openWithfocuses it instead. So asking for a different graph inside a file you were already looking at did nothing at all: the name was recorded, the tab came forward, and the diagram kept showing what it showed before.Moving between the graphs in one file is the ordinary use of this command, and it is the case where doing nothing is hardest to read, because the command plainly did something: the editor took focus. There is no way for a reader to tell a command that silently declined from one that was never wired up.
The change
When a diagram for the file is already open, refresh it with the requested name.
A refresh already carries
networkNameinto a fresh model request — that is the mechanism a drill-down relies on — so this reuses it rather than adding a second path. Whether the diagram is already open is asked before opening, since opening is what makes it true.The split-view command had the same shape and is fixed the same way. Leaving a known identical bug beside a fixed one is worse than fixing both.
Neither path changes for a diagram that is not yet open: the stash is still what the initial request reads, and no extra round trip is added to a fresh open.
Verified
npm run build,npm run typecheck(5/5),npm run check:neutrality(5/5),npm test— green by exit code.