Skip to content

feat(editor): auto-assign binder View and Id from context menu - #127

Draft
VPDPersonal wants to merge 2 commits into
mainfrom
feat/asp-5-auto-assign-binder-view-ids
Draft

feat(editor): auto-assign binder View and Id from context menu#127
VPDPersonal wants to merge 2 commits into
mainfrom
feat/asp-5-auto-assign-binder-view-ids

Conversation

@VPDPersonal

@VPDPersonal VPDPersonal commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Completes the ASP-5 binder auto-assigner (Unity/Editor/Scripts/Binders/BinderAutoAssigner.cs).
  • Adds an always-available component context-menu command — right-click a binder () → Auto-Assign View And Id — that resolves the single valid (View, Id) slot across the parent chain and assigns it non-destructively.
  • The menu entry greys out (validate pass) when the binder is already assigned or the target is ambiguous / absent, so it can never clobber existing wiring.
  • Keeps the existing opt-in "auto-assign on component add" toggle (Tools/Aspid 🐍/Experimental, OFF by default).
  • Both entry points now share one resolution core (TryResolveSingleTarget), reusing BinderEditorUtilities.GetIds so auto-assign never offers a slot the manual dropdowns would not.

Validation

Verified in Unity 6000.4.0f1 via UniCli:

  • Compile: 0 errors, 0 warnings; console clean.
  • Sample scene (Hello World / MVVM): imported the sample, then for each of the 19 bound binders — reset the assignment, ran the auto-assigner, and checked the outcome:
    • 18/18 unambiguous binders round-tripped exactly (same View + Id restored) and became non-reassignable afterwards (idempotent / non-destructive).
    • 1 binder with more than one valid slot was correctly abstained (auto-assign does not guess on ambiguity).
    • 0 failures.

Notes for review

  • Editor-only; no runtime code touched. MonoBinderEditor is intentionally left untouched — the hook is a self-contained CONTEXT/MonoBinder/... menu item, so risk to the core binder inspector is nil.
  • main merged in to pick up the com.yucchiy.unicli-server package (build(deps): add com.yucchiy.unicli-server package #126) used for the validation above.

Linked issues

Closes ASP-5

🇷🇺 Описание на русском

Summary

  • Завершает авто-ассайнер биндеров по ASP-5 (Unity/Editor/Scripts/Binders/BinderAutoAssigner.cs).
  • Добавляет всегда доступную команду контекстного меню компонента — ПКМ по биндеру () → Auto-Assign View And Id, — которая находит единственный валидный слот (View, Id) по цепочке родителей и назначает его недеструктивно.
  • Пункт меню сереет (validate-проход), если биндер уже назначен или цель неоднозначна / отсутствует, — затереть существующую разводку он не может.
  • Существующий opt-in тумблер «auto-assign при добавлении компонента» сохранён (Tools/Aspid 🐍/Experimental, по умолчанию OFF).
  • Обе входные точки теперь используют одно ядро резолюции (TryResolveSingleTarget), переиспользуя BinderEditorUtilities.GetIds, — авто-ассайн никогда не предложит слот, которого нет в ручных дропдаунах.

Валидация

Проверено в Unity 6000.4.0f1 через UniCli:

  • Компиляция: 0 ошибок, 0 предупреждений; консоль чистая.
  • Сэмпл-сцена (Hello World / MVVM): импортирован сэмпл, затем для каждого из 19 привязанных биндеров — сброс назначения, запуск авто-ассайнера, проверка результата:
    • 18/18 однозначных биндеров восстановились в точности (те же View + Id) и после этого перестали быть переназначаемыми (идемпотентность / недеструктивность).
    • 1 биндер с несколькими валидными слотами корректно пропущен (авто-ассайн не гадает при неоднозначности).
    • 0 падений.

Notes for review

  • Только editor; runtime-код не тронут. MonoBinderEditor намеренно не изменён — хук является самодостаточным пунктом меню CONTEXT/MonoBinder/..., так что риск для основного инспектора биндеров нулевой.
  • Вмержен main ради пакета com.yucchiy.unicli-server (build(deps): add com.yucchiy.unicli-server package #126), использованного для валидации выше.

Complete the ASP-5 binder auto-assigner. Alongside the opt-in
"auto-assign on component add" toggle, add an always-available
component context-menu command (⋮ ▸ Auto-Assign View And Id) that
resolves the single valid (View, Id) slot and assigns it
non-destructively; the entry greys out when the binder is already
assigned or the target is ambiguous.

Both entry points now share one resolution core
(TryResolveSingleTarget), reusing BinderEditorUtilities.GetIds so
auto-assign never picks a slot the manual dropdowns would not offer.

Refs ASP-5

Co-Authored-By: Claude <noreply@anthropic.com>
@VPDPersonal VPDPersonal added status: work-in-progress Draft / not ready for review type: feature New feature or capability area: editor Editor-only code labels Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: editor Editor-only code status: work-in-progress Draft / not ready for review type: feature New feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant