-
-
Notifications
You must be signed in to change notification settings - Fork 168
Add choice rename action and edit indicator #1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds a discoverable rename flow: introduces a pencil icon in the Choice header, a "Rename" context-menu item, a prompt helper ( Changes
Sequence DiagramsequenceDiagram
participant User
participant Item as ChoiceListItem
participant List as ChoiceList
participant View as ChoiceView
participant Prompt as promptRenameChoice
participant Backend as Update & Persist
User->>Item: Open context menu & select "Rename"
Item->>List: dispatch renameChoice(choice)
List->>View: propagate renameChoice(choice)
View->>Prompt: promptRenameChoice(app, currentName)
Prompt->>User: show input prompt
User->>Prompt: submit new name
Prompt->>View: return newName | null
View->>View: validate & trim newName
alt newName changed
View->>Backend: updateChoiceHelper(choice, newName)
Backend->>Backend: refresh command registry
Backend->>Backend: persist changes
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/gui/ChoiceBuilder/choiceBuilder.ts (1)
84-109:⚠️ Potential issue | 🟡 MinorPrevent empty/whitespace choice names in header rename.
This path allows blank names, while the ChoiceView rename trims/validates. Aligning behavior avoids empty labels and command naming issues.🔧 Proposed fix (trim + validate)
- const newName: string = await GenericInputPrompt.Prompt( + const newName: string = await GenericInputPrompt.Prompt( this.app, choice.name, "Choice name", choice.name, ); - if (newName !== choice.name) { - choice.name = newName; - textEl.setText(newName); - } + const trimmed = newName.trim(); + if (!trimmed || trimmed === choice.name) return; + choice.name = trimmed; + textEl.setText(trimmed);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/gui/choiceRename.ts`:
- Around line 9-14: The Prompt call passes arguments in the wrong order to
GenericInputPrompt.Prompt (signature: Prompt(app, header, placeholder?, value?,
description?)); change the call so the header is "Choice name" and currentName
is passed as the value (e.g. Prompt(app, "Choice name", /* placeholder? */
undefined, currentName)), updating the invocation that assigns newName to use
GenericInputPrompt.Prompt(app, "Choice name", undefined, currentName).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
Testing
Closes #683
Summary by CodeRabbit
New Features
Style
✏️ Tip: You can customize this high-level summary in your review settings.