You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then select some code and try running extract method
Expected behavior
It extracts the method
Actual behavior
A notification appears telling me to save the file. Why do I need to save? And if saving is really required for now, why don't you just save the file for me?
Yup, Extract Method uses rope for refactoring, and it performs these actions on resources pointing to files inside a project (in our case, the workspace folder).
👉 We can't pass strings to rope, we have to work with a file.
Suggestions:
save the file automatically
copy the code in a temp file, perform the action there, and then replace the content of the current file
copy the code in a temp file, perform the action there, and then replace
Considering the fact that rope has not supported Python 3 for a while, I think its time consider dropping it. However we'd need to first find out whether this is a good idea, i.e. do users use this today, does it work without any problems (I don't think so, hasn't supported 3). Brett Cannon (@brettcannon) /cc
This whole bug is based on the wrong premise: rope has been supporting Python 3 for some time already. I (the only remaining something-like-maintainer of rope, https://github.com/python-rope/rope/ ) have no idea about VSCode (so I don't know how rope is weird into it), feel free to file issues for any bugs you find.
Hi all, rope is getting a new maintainer (me). Is there anything we can help fix here in rope for VSCode users that wants to continue to use rope for refactoring?
Rope 0.19.0 already has support for a lot of new Python 3.x syntaxes and I'm going to continue to further improving coverage of supported syntax, fix existing bugs, as well as improving usability and ease of use and integrations.
Brett can answer more definitively, but the main aim is to put as much behind language server protocol as possible, as this provides a standard way to interface with such tools. So I imagine that if rope had an LSP implementation it would be much easier to integrate in. Jedi support has gone through this process recently; it was originally quite tightly
integrated but now sits behind LSP and that makes it easier to maintain as well as light up new features. What we want to avoid is significant amounts of 3rd-party tool-specific code in the extension; using LSP could allow us to remove much of that while actually supporting more 3rd party tools.
@melMass, which refactorings do you use? We're also aiming to increase the number of refactorings supported by pylance so knowing what is missing but popular could be helpful.
Rope has been replaced by JediLSP (Jedi behind LSP) and/or Pylance for refactoring.
As Graham Wheeler (@gramster) pointed out, probably the best option for those that wish to continue to use Rope would be to create a separate extension, and I would strongly recommend putting rope behind LSP. That way other editors could also use rope directly w/o much effort.
Hi all, Rope should now be be usable again in VSCode and other editors that supports LSP using pylsp-rope. You'll want to install the pylsp-rope extension and configure your VSCode to use pylsp language server.
Activity
karthiknadig commentedon Mar 5, 2020
Kim-Adeline Miguel (@kimadeline) First we need to know if they are using rope. We need to see if we can pass string to rope.
kimadeline commentedon Mar 9, 2020
Yup,
Extract Methodusesropefor refactoring, and it performs these actions on resources pointing to files inside a project (in our case, the workspace folder).👉 We can't pass strings to
rope, we have to work with a file.Suggestions:
DonJayamanne commentedon Mar 10, 2020
Considering the fact that rope has not supported Python 3 for a while, I think its time consider dropping it. However we'd need to first find out whether this is a good idea, i.e. do users use this today, does it work without any problems (I don't think so, hasn't supported 3).
Brett Cannon (@brettcannon) /cc
brettcannon commentedon Mar 10, 2020
We still get bug reports for it so some people seem to be at least attempting to use it. David said he is looking at refactoring support in Jedi.
As for whether we should just yank it now or wait I don't know without chatting with Luciana Abud (@luabud) about it.
10 remaining items
mcepl commentedon Jul 5, 2021
This whole bug is based on the wrong premise: rope has been supporting Python 3 for some time already. I (the only remaining something-like-maintainer of rope, https://github.com/python-rope/rope/ ) have no idea about VSCode (so I don't know how rope is weird into it), feel free to file issues for any bugs you find.
melMass commentedon Aug 27, 2021
Well, I think this is becoming more urgent now:
python-rope/rope#360
brettcannon commentedon Aug 27, 2021
Our current plan is to remove Rope in our
2021.10release.lieryan commentedon Sep 5, 2021
Hi all, rope is getting a new maintainer (me). Is there anything we can help fix here in rope for VSCode users that wants to continue to use rope for refactoring?
Rope 0.19.0 already has support for a lot of new Python 3.x syntaxes and I'm going to continue to further improving coverage of supported syntax, fix existing bugs, as well as improving usability and ease of use and integrations.
melMass commentedon Sep 5, 2021
Good news!
I think the decision to remove rope and ctags is unfortunately acted for 2021.1 (see the just released change log)...
Brett Cannon (@brettcannon) Are you planning to replace the refactoring with something else than rope? (I'm using it a lot)
gramster commentedon Sep 5, 2021
brettcannon commentedon Sep 8, 2021
Rope has been replaced by JediLSP (Jedi behind LSP) and/or Pylance for refactoring.
As Graham Wheeler (@gramster) pointed out, probably the best option for those that wish to continue to use Rope would be to create a separate extension, and I would strongly recommend putting rope behind LSP. That way other editors could also use rope directly w/o much effort.
kimadeline commentedon Sep 28, 2021
Testing done as part of #17540
lieryan commentedon Nov 23, 2021
Hi all, Rope should now be be usable again in VSCode and other editors that supports LSP using pylsp-rope. You'll want to install the pylsp-rope extension and configure your VSCode to use pylsp language server.