-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: conversation starters #4758
Conversation
✅ Deploy Preview for continuedev canceled.
|
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.
nice tests + analytics!
})), | ||
slashCommands: final.slashCommands?.map( | ||
({ run, ...slashCommandDescription }) => slashCommandDescription, | ||
), |
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.
stylistically prefer old way, not important
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.
Submitted this to the @tomasz-stefaniak oracle (e.g. Clean Code assistant)
Prompt
slashCommands: final.slashCommands?.map(
({ run, ...slashCommandDescription }) => slashCommandDescription,
),
slashCommands: final.slashCommands?.map((s) => ({
name: s.name,
description: s.description,
params: s.params, // TODO: is this why params aren't referenced properly by slash commands?
}))
which version is cleaner?
Response
The first version using destructuring is cleaner and more maintainable for several reasons:
slashCommands: final.slashCommands?.map(
({ run, ...slashCommandDescription }) => slashCommandDescription,
),
Advantages of the first version:
- It uses object destructuring with rest parameters (
...
) to explicitly show we're removing therun
property while keeping everything else - It's more maintainable - if new properties are added to slash commands in the future, they'll automatically be included without modifying this code
- It follows the Open/Closed Principle better - the code is open for extension (new properties) but closed for modification
- It's more concise and has less repetition
The second version:
slashCommands: final.slashCommands?.map((s) => ({
name: s.name,
description: s.description,
params: s.params,
}))
Has these drawbacks:
- It explicitly lists every property that needs to be copied
- It's more brittle - if new properties are added, this code needs to be updated
- More verbose and repetitive
- Higher chance of human error when maintaining the property list
The first version is the better choice as it's more maintainable, flexible, and follows SOLID principles better. It also makes it very clear that we're intentionally excluding the run
property while preserving everything else.
I made the update mostly stylistically but I think I agree with the points made by the model.
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.
Sounds good!
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.
Yeah this is a good callout - my thought was that the card was mostly redundant at this point when our tooltip UI has improved for cmd+I/cmd+L and more visible configurations through Nate's toolbar updates.
Lmk what your thoughts are though, I don't feel particularly strongly.
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.
was just excited
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.
I think this is valid since all prompt files are now rendered as slash commands.
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.
this was just excitement hahaha
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.
consider renaming/moving file/function to reflect v2 support
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.
"auth" slice or similar might be nice since orgs ~= profiles but nitpick
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.
Good callout - I created a new organizations
slice to make this clearer 👍 the reason I don't think auth
would have been clear is that we have all the preference logic (e.g. bookmarks) in the profile slice. Using an org slice is also more similar to what we have on the Hub.
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.
I meant auth slice with both orgs and profiles
61ea04b
to
71f8508
Compare
prompt
contents to slash command description