Follow a whole-value edit with the row that expands it - #19
Merged
Conversation
A Simulink.Parameter shows a Value row only while its value node has
something to expand into, and a structural edit inside that node already
re-decided the row: childEdit.ts notifies the parent after every add or
remove, so deleting [1 2] down to one element drops the row along with
the elements.
Restating the whole value took the other route and told nobody.
MatlabVariableNode.setProperty('Value', ...) rebuilds the node's children
from the text, which crosses the same has-children/has-none line — so
retyping a matrix as a scalar cleared the elements and left the Parameter
holding a childless Value row: an expander onto nothing, under a scalar,
until the file was re-read.
Invisible to a consumer that repaints by re-reading the file, which is
why it has gone unnoticed; visible to one that repaints from the node it
mutated, which is the direction both .sldd editors are moving.
The notification goes both ways, so the same hook brings the row back
when a hidden scalar value node grows elements.
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.
A
Simulink.Parametershows aValuerow only while its value node has something to expand into. A structural edit inside that node already re-decides the row —childEdit.tsnotifies the parent after every add or remove, so deleting[1 2]down to one element drops the row along with the elements.Restating the whole value took the other route and told nobody.
MatlabVariableNode.setProperty('Value', …)rebuilds the node's children from the text, which crosses the same has-children/has-none line, so retyping a matrix as a scalar cleared the elements and left the Parameter holding a childlessValuerow — an expander onto nothing, under a scalar — until the file was re-read.That is invisible to a consumer that repaints by re-reading the file, which is why it has gone unnoticed, and visible to one that repaints from the node it mutated. Both
.slddeditors indata-explorer-vscodeare moving that way, and its cross-check of "the mutated model says what the text says" is what surfaced this.The notification goes both ways, so the same hook brings the row back when a hidden scalar value node grows elements.
Tests
Four cases added beside the existing add/remove ones in
test/parameterNode.test.ts:42Valuerow) still adds itFull suite: 4105 passed, 26 skipped.