When I tried to rename myset
in the following code, I saw the following message.
class NumberGenerator:
def __init__(self):
self.__myset__ = set()
def uncount(self, i):
self.__myset__.add(i)
Refactor failed. module 'rope.base.ast' has no attribute 'Str'
[<FrameSummary file refactor.py, line 294 in watch>, <FrameSummary file refactor.py, line 274 in _process_request>, <FrameSummary file refactor.py, line 206 in _rename>, ...
It's so long, if you want to see I can show you. Is this code wrong? It works, though. Why does refactor not work?
The reason you're seeing "No refactorings available" is because the currently selected text doesn't match any of these actions. Try selecting a line of text and then press [Ctrl][Shift][R] .
Visual Studio Code supports refactoring operations (refactorings) such as Extract Method and Extract Variable to improve your code base from within your editor.
Visit the Tools-Options page, IntelliCode General tab, Preview features area, and switch C# refactorings to “Enabled” to turn it on.
It doesn't work because Rope has some bugs in it. If you install Pylance then you may have better success (it will automatically prompt you to update your settings appropriately).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With