Skip to content
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

Migrate sort_items Assist to Use SyntaxFactory #18538

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

tareknaser
Copy link
Contributor

part of #15710 and #18285
For this one, I had to pass AssistContext to other methods as well in order to get the file ID.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 20, 2024
Copy link
Contributor

@darichey darichey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, a couple opportunities for simplification.

Not for this PR, but after doing a few of these, it looks like there may be potential for a slightly nicer api that takes care of some things for us. Something like:

fn add_with_editor(
    &mut self,
    id: AssistId,
    label: impl Into<String>,
    target: SyntaxNode,
    f: impl FnOnce(&mut SyntaxEditor, &SyntaxFactory),
) -> Option<()>

crates/ide-assists/src/handlers/sort_items.rs Outdated Show resolved Hide resolved
crates/ide-assists/src/handlers/sort_items.rs Outdated Show resolved Hide resolved
@tareknaser tareknaser force-pushed the syntax_factory_sort_items branch from 6f727e0 to 552206d Compare November 27, 2024 10:08
@tareknaser tareknaser requested a review from darichey December 3, 2024 20:29
Signed-off-by: Tarek <tareknaser360@gmail.com>
Signed-off-by: Tarek <tareknaser360@gmail.com>
@tareknaser tareknaser force-pushed the syntax_factory_sort_items branch from 552206d to c43d565 Compare December 4, 2024 10:42
Copy link
Contributor

@darichey darichey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! cc @davidbarsky

@davidbarsky davidbarsky added this pull request to the merge queue Dec 5, 2024
Merged via the queue into rust-lang:master with commit 5d23772 Dec 5, 2024
9 checks passed
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.

4 participants