Skip to content

Renaming private declarations takes 40+ seconds #57031

@FMorschel

Description

@FMorschel

While working at https://dart-review.googlesource.com/c/sdk/+/392860 for #49294, I was refactoring and needed to rename a private method for AddConst.

The method was used only once and since it is a file with no parts the analysis and renaming for this should be really fast.

image
image

After talking with @DanTup on Discord he mentioned that this is actually caused by the creation of an index that for future renamings would decrease the waiting time.

I was wondering if we could ever do some form of work to help users with this long waiting time for renaming simple things. I have two suggestions which basically overlap:

  1. Creating that index in the background hopefully before it is needed in a way that doesn't slow down things the user does care about (suggested by Dan).
  2. Basically the above but with a small tweak. I think this could be started whenever the user did request to rename something but we could actually try and leave that work running separately after we had solved the single rename request. I'm not sure how exactly we could do this but I thought of something like:
  • User requests to rename something
  • We calculate every reference to it that needs to be renamed
  • Return that result but also trigger the background process to calculate the index for everything else

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-refactoringIssues with analysis server refactoringstype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions