swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-17] Refactoring

Open swift-ci opened this issue 11 years ago • 8 comments

Previous ID SR-17
Radar None
Original Reporter krusche (JIRA User)
Type New Feature
Status Closed
Resolution Done

Additional Detail from JIRA
Votes 11
Component/s
Labels New Feature
Assignee @bitjammer
Priority Medium

md5: ce13c69509de60ecfe1aaced5dc7c844

Issue Description:

Swift is a statically typed language and it would be great, if refactoring would be supported!

swift-ci avatar Dec 03 '15 20:12 swift-ci

I've got plans for the following refactoring actions:

  • Rename symbol

  • Conform to protocol

  • Extract expression to:

    • local

    • property

    • module function

    • method

    • default parameter

Please let me know which other refactoring actions you'd like to see.

bitjammer avatar Dec 03 '15 23:12 bitjammer

Comment by Stephan Krusche (JIRA)

Thank you for the quick reply. Glad to here that there are already plans for refactorings in Swift. Your list sounds like a very good starting point. I am curious to try them out! https://sourcemaking.com/refactoring/refactorings offers a good overview of possible refactorings.

In my opinion, support for the following refactorings would also be interesting:

  • Add / remove / change parameters in functions

  • Move functions to other types

  • Pull up or push down methods / properties in class hierarchies

  • Extract protocol

  • Extract superclass

  • Extract subclass

swift-ci avatar Dec 03 '15 23:12 swift-ci

Comment by Nikita Leonov (JIRA)

@bitjammer Martin Fowler covered a lot of refactoring techniques — http://refactoring.com/catalog/
It would be unfair to ask everything from it today, but it could be used a roadmap. Meanwhile your plan & priorities on refactoring is great. Looking forward for it. Thanks!

swift-ci avatar Dec 04 '15 08:12 swift-ci

nikita (JIRA User) Nice resource - thanks!

bitjammer avatar Dec 04 '15 17:12 bitjammer

Comment by Matthew Bischoff (JIRA)

I think it’d be swell to also have a command that allowed extracting a method or set of methods to an extension, optionally in a separate file.

swift-ci avatar Dec 04 '15 18:12 swift-ci

Comment by Stephan Krusche (JIRA)

Any News on this request? When can we expect refactoring?

swift-ci avatar Feb 17 '16 22:02 swift-ci

Hey, @nkcsgexi, we can probably close out this top-level bug by now, yeah? :-)

belkadan avatar Jan 09 '18 21:01 belkadan

That's a good idea to close this generic task. If anyone has any new refactoring ideas for Swift to implement, please file separate issues describing the details.

nkcsgexi avatar Jan 09 '18 22:01 nkcsgexi