Skip to content

Feature request: "Change Signature" refactoring #39842

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

Closed
Tracked by #55825
saif97 opened this issue Dec 18, 2019 · 11 comments
Closed
Tracked by #55825

Feature request: "Change Signature" refactoring #39842

saif97 opened this issue Dec 18, 2019 · 11 comments
Labels
devexp-refactoring Issues with analysis server refactorings legacy-area-analyzer Use area-devexp instead. P4 type-enhancement A request for a change that isn't a bug

Comments

@saif97
Copy link

saif97 commented Dec 18, 2019

This is my very first time posting issue on GitHub, so excuse me if I did it wrong
IntelliJ idea has a really cool and time-saving refactoring method signatures feature. Unfortunately, for some reason, it doesn't work in IntelliJ Idea.

I've found this issue in IntelliJ's YouTrack 4 years ago which redirected me here.

Flutter 1.12.13+hotfix.5 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (7 days ago) •
2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0

Using Windows, chrome.

@devoncarew
Copy link
Member

@saif97 - thanks for the feedback. To clarify - is this a bug report or a feature request?

@devoncarew devoncarew added the area-intellij Tracking issues for the Dart IntelliJ plugin. label Dec 20, 2019
@devoncarew
Copy link
Member

cc @jwren

@jwren
Copy link
Member

jwren commented Dec 21, 2019

Are all Dart refactorings (Shift + F6 action) in IntelliJ broken? Does a dialog appear after you invoke the refactoring? Is an exception thrown?, or does the refactoring just not happen?

@saif97
Copy link
Author

saif97 commented Dec 21, 2019

@saif97 - thanks for the feedback. To clarify - is this a bug report or a feature request?

Feature request I guess. The feature is already available in IntelliJ Idea for Java development. However, It doesn't work for Dart.

Are all Dart refactorings (Shift + F6 action) in IntelliJ broken? Does a dialog appear after you invoke the refactoring? Is an exception thrown? or does the refactoring just not happen?

image
These are all the available refactoring options for Dart. They all work (Thank you guys for the amazing work).
However, the Change signature isn't available in Dart. The picture below shows Java Code where pressing Ctrl + F6 (in my case) or simply searching it shows the command
image

In this picture, I tried to do the same in Dart code but as you can see the command isn't there & pressing Ctrl + F6 doesn't show the window either.
image

No exceptions are thrown.

@jwren jwren changed the title Refactoring method signature of dart function in Intellj idea not working. Feature request: "Change Signature" refactoring Dec 27, 2019
@jwren
Copy link
Member

jwren commented Dec 27, 2019

Changed to a feature request. I am glad the refactorings are working as expected. This is just not one of the refactorings that we happen to offer.

https://htmlpreview.github.io/?https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/doc/api.html#type_RefactoringKind

@scheglov @bwilkerson

@jwren jwren added the type-enhancement A request for a change that isn't a bug label Dec 27, 2019
@alexander-doroshko
Copy link

@devoncarew Probably area-analyzer?

@bwilkerson bwilkerson added devexp-refactoring Issues with analysis server refactorings legacy-area-analyzer Use area-devexp instead. and removed area-intellij Tracking issues for the Dart IntelliJ plugin. labels Jan 10, 2020
@srawlins srawlins added the P4 label Jan 13, 2021
@vrnvorona
Copy link

Any updates?

@filipagh
Copy link

can you also include scope of move refactor to class, function ... (not only file) (idea shortcut F6)
expected result (python)
image
actual options
image
thanks

@prinkeeras
Copy link

any updates on this?

@bwilkerson
Copy link
Member

Nothing concrete.

We are hope to have some time this quarter to work on improving our refactoring support, but we haven't yet decided which refactorings we will be adding. This refactoring is definitely on our radar, though there are some limitations in LSP that might require us to implement a set of smaller refactorings that together could be used to achieve the same effect. That might not be ideal, but might be better than no support. We'll know more after we've had time to investigate what's possible and what isn't.

@bwilkerson
Copy link
Member

There have been a couple of refactorings added since I last commented. They are, unfortunately, not available in IntelliJ at this point, but are available in VS Code.

There is now a 'Move to file' refactoring to help re-organize code in libraries.

There are also some experimental refactorings to convert some or all of the positional parameters to be named parameters and to move parameters left in the parameter list. Both implement a portion of the kinds of changes that a 'Change signature' refactoring would be expected to make, but can be done without implementing a per-client dialog.

It's unlikely that we'll be able to provide the full-functioned refactoring asked for here, as much as we'd like to. So, as much as I don't want to, I'm going to close this issue.

If there are other small-grained refactorings like these that you would like us to add, please open an issue for each of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-refactoring Issues with analysis server refactorings legacy-area-analyzer Use area-devexp instead. P4 type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

9 participants