Skip to content

feat: user choice group api #19828

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

discord9
Copy link

@discord9 discord9 commented May 20, 2025

related

#19454

overview

Added a API for asking user multiple questions and get answers, useful for quick fix that need to ask multiple question and get user choice(i.e. import all missing item, choose multiple import crates etc.)

details

Use ShowMessageRequest to send message to user, and get MessageAction in return.

The major impl is in ask_for_choice function and is somewhere twisted as writing async code using callback is certainly very uncomfortable. ask_for_choice send with a empty request id as can't determine what request id it should belong to.

On the Assists side, developer basically provide a callback with signature of dyn FnOnce(&mut SourceChangeBuilder, &[usize]) + Send + 'static to handle what to do after get user choices results, so it's similar to add_group method

todo

test this with a integration test

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants