Skip to content

Infer DS labels from code + argument display names (arg-N)#128

Open
mkayander wants to merge 5 commits into
mainfrom
cursor/infer-ds-variable-labels-3270
Open

Infer DS labels from code + argument display names (arg-N)#128
mkayander wants to merge 5 commits into
mainfrom
cursor/infer-ds-variable-labels-3270

Conversation

@mkayander
Copy link
Copy Markdown
Owner

@mkayander mkayander commented Apr 14, 2026

Summary

Runtime structure labels (JS/Python)

  • JS: Array literals under inferable bindings → __dstructArrayLiteralWithName; single string element stays unnamed. new Array / new ArrayProxy with inferable RHS get trailing { displayLabel }; new Array(n) length form skipped. ArrayProxy accepts optional trailing options object.
  • Python: attach_ast_parents + inferred names on list literals in assignments; TrackedList passes displayLabel in addArray options.
  • Viewer: displayLabel on array / map / matrix (not trees/graphs).

Test case arguments

  • label optional, non-unique; name remains unique store key (short-uuid for new defaults).
  • Default visible: arg-{order+1} via getArgumentDisplayLabel.
  • Rename: Popover from suffix icon; 300ms debounce + flush on close.
  • Defaults: New array-like categories + binary tree/BST use uuid keys (merged with upstream category expansion in getDefaultArguments).

Rebase / CI

Review notes (for reviewers)

  • Identity: Duplicated label values are intentional; Redux keys stay ArgumentObject.name.
  • JS transform scope: Does not cover Array.from, push/concat builds, Map/Set literals, etc.
  • Python: List comprehensions still use fixed "comprehension" label.

PR: #128

Open in Web Open in Cursor 

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dstruct Ready Ready Preview, Comment May 21, 2026 8:16am

@cursor cursor Bot force-pushed the cursor/infer-ds-variable-labels-3270 branch from 54babea to 7956594 Compare April 23, 2026 19:22
@mkayander mkayander marked this pull request as ready for review April 23, 2026 19:32
@cursor cursor Bot changed the title Infer data structure display labels from variable names (JS/Python) Infer DS labels from code + argument display names (arg-N) Apr 23, 2026
@cursor cursor Bot force-pushed the cursor/infer-ds-variable-labels-3270 branch from 7956594 to 55d0d43 Compare April 23, 2026 19:53
@cursor cursor Bot force-pushed the cursor/infer-ds-variable-labels-3270 branch from 55d0d43 to 5bcccdd Compare April 23, 2026 22:02
cursoragent and others added 4 commits May 20, 2026 20:24
- JS: extend array literal transform to call __dstructArrayLiteralWithName
  for const/assign/assignment-pattern RHS; keep unnamed helper for
  single-string literals and return-position literals
- Runtime: build labeled literals via ControlledArray with displayLabel in addArray options
- Redux: store displayLabel on ArrayData; show caption in array/map/matrix views
- Python: attach AST parents and infer list names from assign/ann/aug assign;
  pass displayLabel in TrackedList addArray options; seed case arg labels from arg name

Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
- Add optional ArgumentObject.label (non-unique); getArgumentDisplayLabel falls back to arg-{order+1}
- caseSlice.updateArgumentLabel + include label in args content signature
- ArgInput: composite field labels; suffix rename opens Popover with debounced 300ms save + flush on close
- JsonInput: suffixSlot + timeout passthrough; string/json inputs use 300ms debounce
- New projects/cases: short-uuid argument ids instead of head/array keys; addCase binary tree uses uuid
- useArgumentsParsing: structure displayLabel uses display name, not store id
- i18n: rename tooltip strings (en + generated types)

Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
- Extend array literal transform: append { displayLabel } to new Array/ArrayProxy
  when RHS is inferable; skip ambiguous new Array(singleNumber) length form
- Require array literal parent to be actual RHS (init/right) for named literals
- ArrayProxy constructor accepts optional trailing options object for displayLabel

Co-authored-by: Max Kayander <mkayander@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/infer-ds-variable-labels-3270 branch from 5bcccdd to cf6dc58 Compare May 20, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants