_From [email protected] on 2010-10-14T06:03:28Z_
Rope can provide a great refactoring support, I note that spyder use it but not for refactoring (masive and safe renaming).
Spyder would provide a great feature if you implement a good support for refactoring.
_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=415_
_From pierre.raybaut on 2010-10-26T04:34:50Z_
Status: Accepted
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low
_From pierre.raybaut on 2011-05-16T01:14:51Z_
Labels: Cat-Editor
_From pierre.raybaut on 2011-05-18T00:30:15Z_
Status: ContributorNeeded
_From pierre.raybaut on 2012-03-18T14:11:22Z_
Status: HelpNeeded
Labels: -Type-Enhancement Type-Enh
Had a couple of friends who switched to PyCharm simply due to the refactoring capability... Felt that this is a really needed feature.
Really needed features really need contributors ! ;)
I agree that it would be great to have, thanks for the reminder.
General note: #1937 is a near duplicate of this one; the nominal scope in that issue's OP is more limited (variable renaming, etc), but while what gets described in the comments (a full refactoring pane, etc.) covers what is being requested here. Regardless, this would be awesome to have.
This issue has the tag community:Help wanted. I am considering to contribute on this because I would really appreciate that feature but some hints on were to start would be helpful.
@cknoll, thanks for offering help. We will address this after PR #4751 is merged, sorry for the confusion.
Any updates on this? Would love to see this feature soon. Seems #4751 is merged. @ccordoba12
Most probably we'll leave this for Spyder 5, to be released in 2020.
I'd like to voice some support for this feature; I've been using Spyder for somewhat over a year now, and this is the _one_ feature I still really miss from other editors. (It's like syntax highlighting: once you've used it it's hard to do without it!) I see you've removed the "community help wanted" label some time ago, but I'd be willing to work on implementing it myself if that would help it get in faster.
This feature would be of great help!
@DBerke, @Kischy: it seems there is pull request #2964 about this, and what it needs to do is use pyls
. Would any one of you like to continue the work there?
it seems there is pull request #2964 about this, and what it needs to do is use
pyls
.
As the author of that pull request, I came to the conclusion that the rope library (which I was using to do the actual refactoring) is not a good fit because the rope library works on files save on disc, while we want to act on files in the editor. Thus, you need either to make substantial changes to rope (which does not seem to be very active) or find another library to do the refactoring. I don't know what is the best approach, but I have no plans to work on it myself any time soon.
@ccordoba12 Perhaps we should add the community help wanted tag back in now that support for PyLS is merged?
we want to act on files in the editor
For me it would be OK to require saving all files before refactoring. What do you think?
Here are two alternatives to Rope:
Bowler (uses fissix, a backported lib2to3 that is intended to enable Bowler to always support the latest Python grammar)
RedBaron (Supports up to Python 3.7 grammar)
I would like this feature very much! I found it very useful in Eclipse. However, I tended to use it to rename a specific variable inside a single file. Special case, perhaps.
Hopefully, scope will be respected.
E.g.
squared = lambda x: x * x
def halved(x):
return x / 2.0
x = 3
x += 42
If I refactor x in the outer scope to puppy, this will be the result:
squared = lambda x: x * x
def halved(x):
return x / 2.0
puppy = 3
puppy = += 42
I am sticking with Spyder whether or not this enhancement request is addressed. It catches my worst mistakes, makes my overall Python development easier than it would be otherwise, especially converting my Python 2 sources to Python 3.
I am sticking with Spyder whether or not this enhancement request is addressed. It catches my worst mistakes, makes my overall Python development easier than it would be otherwise, especially converting my Python 2 sources to Python 3.
Glad to hear that! We are working on refactoring support so it will come in some months ;-)
Thanks for using spyder !
@goanpeca As a developer, I can directly relate trying to balance personal time/energy with work, "hobby time" projects, and family. It is not easy.
We will add refactoring support via the python-language-server (now integral part of Spyder 4.0.0 released yesterday!) so you can also follow https://github.com/palantir/python-language-server to be on the loop. We also help develop that package!
Limited refactoring that would be useful:
@goanpeca, I think refactoring is already implemented in the PyLS. We just need to provide a UI in our side to perform it.
I think refactoring is already implemented in the PyLS. We just need to provide a UI in our side to perform it.
Nice :-p
The refactoring function of pyLS is not perfect.
Is it not possible to support refactoring the formal spyder version?
Most helpful comment
Had a couple of friends who switched to PyCharm simply due to the refactoring capability... Felt that this is a really needed feature.