Repository navigation
fix(vscode): mark the focused neighbourhood from the new rendering and count only the edges the canvas has - #1336
Merged
Conversation
…d count only the edges the canvas has The diagram panel stored a rendering only after showing it, so a focused node's neighbourhood was marked from the previous rendering until the auto layout settled. The Relations list counted every edge of the rendering, including those at nodes folded under a collapsed owner, which the canvas never draws; the list and the canvas now share one notion of a folded edge in layout.ts. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…anel-neighbourhood-relations Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
…rag' into fix/diagram-panel-neighbourhood-relations Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # editors/vscode/src/webview/diagram.test.ts
…neighbourhood-relations
…rag' into fix/diagram-panel-neighbourhood-relations
…neighbourhood-relations
Merged
2 of 6 tasks
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.
What and why
Two bugs in the diagram panel's webview (
editors/vscode/src/webview/diagram.ts), both reproduced with jsdom tests that drive the real panel script before the fix.Stale focused neighbourhood after an edit.
drawshowed the new canvas (show→applySelection) before storing the rendering inlast, so a focused node's neighbours were marked from the previous rendering. After an edit moved a relationship, the new canvas was marked with the old neighbours until ELK's auto layout resolved and redrew; where auto layout is unavailable, it stayed wrong.drawnow storeslast = resultbefore showing the canvas; the empty-canvas and table branches are folded into the sameif (layout !== undefined)so there is one point of order.Relations list counting edges the canvas never draws. The canvas hides an edge whose end is under a collapsed owner (
PlacedNode.hidden→PlacedEdge.hiddeninlayout.ts), butshowRelations/countRelationscounted every edge of theRenderResult, so the list named kinds and totals that were not on the canvas.Correct count, from the panel's design: the Relations list is the panel's hide-kinds filter, so it lists each kind the canvas has with how many edges there are (and
N of M relatedfor the focused node), a kind the filter hides included — the filter must say what it hides, which is whyrelatedByKindalways counted hidden kinds. An edge at a node folded under a collapsed owner is different: no filter setting can draw it, so it is neither listed nor counted, and a kind with only such edges does not appear. The folded case is now one predicate,folded(placed, edge)inlayout.ts, used byrouteEdgeforPlacedEdge.hidden(what the canvas skips) and by the newlistedEdges(layout)(what the list counts).showRelations/countRelationstake theCanvasLayoutrather than theRenderResult, andrelatedByKindtakes the edge list to count.Behaviour changes: a kind whose only edges are at folded nodes is no longer listed, and totals exclude folded edges.
Overlap: #1330 adds the jsdom harness for the panel script and
src/markup.ts; the harness is shared, so its head is merged into this branch as a merge commit — firstf26e19977, thend18b5e4f4anddd250071b, which fix the two review findings raised here on that code (the only conflicts were both branches appending tests todiagram.test.ts, resolved by keeping both sets over one harness). #1335 dry-merged clean on top; both have since landed ondevelop, which is merged in. The branchfix/webview-collapsed-portsremoves the webview's own fold of a collapsed owner's ports; it is behinddevelopand has no PR, and it did not render under these tests, so this change does not depend on it — once that lands,foldedsimply never holds for a port.How it was verified
editors/vscode:npm ci,npm run typecheck,npm run build,npm test— 383 pass, 0 fail (there is nolintscript in this package).src/webview/diagram.test.ts, both failing ondevelopand passing here:develop:the canvas drawn for the edit marks a's new neighbour c: actual ['a','b'], expected ['a','c'].develop:the list names the kinds the canvas draws: actual ['connection','dependency'], expected ['dependency'].python3 scripts/changelog.py check,go build ./...,go vet ./...,gofmt -l .(empty) — no Go change.diagram.test.ts(resolved by the merge commit above); fix(vscode): sort the diagram panel's relationship kinds with an explicit code-unit comparator #1335 clean before and after that merge.Native VS Code, develop
f9f6d953fvs this branchBoth VSIXs built with
npm run build -- --production+vsce package, installed into an isolated VS Code profile with a freshly builtsysml-lsp.Relations list under a collapsed owner.
part a { port p; },part b;,connection hiddenLink connect a.p to b;,binding visibleLink bind a = b;, an interconnection view withmetadata Layout about a { collapsed = true; }; zero Problems. The canvas draws the binding only.connection 1binding 1On the branch, focusing
ashows1 of 1 related; untickingbindingremoves the edge and keeps its count; ticking it restores the edge:Focused neighbourhood after an edit. With
afocused,connection link connect a to b;edited toconnect a to c;and saved. On a small model develop's stale frame lasts only until ELK redraws and was not capturable; with 601 exposed parts (over the panel's auto-layout cutoff) it is:bstill highlighted,cdimmedchighlighted,bdimmedChecklist
npm test,npm run typecheck,go build,go vet,gofmt -lpass locallychanges/unreleased/diagram-panel-focus-after-edit.fixed.mdmake docs-countsrun if a gate count moved (none moved)Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/b94cef1a8c024e98b730a806a001118d
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/b94cef1a8c024e98b730a806a001118d?variant=devin
Requested by: @HuiJun