python-rope/ropevim

Not able to mark region to refactor

vcrini opened this issue · 1 comments

Hi, I'm trying to select a region of code for refactoring.

E.g. Say want to RopeExtractVariable from this piece of code (that's trivial I know but it shows my problem)

before refactoring

print(1+2+3)

to

sum=1+2+3
print(sum)

How can I tell vim to select "1+2+3" region?

I'm trying by selecting in visual code but I'm failing with error

RefactoringError: Extracted piece should contain complete statements.

If answer is trivial please can you direct me to resource explaining this?
Thanks a lot, Valerio

This is a bit tricky, but I think there is an off by one bug on the end marker for inline refactoring, you'd actually have to select the next character for inline refactoring to detect the selected text correctly.

So if your text is:

print(1+2+3)
      ------

your cursor needs to be selecting the underlined characters.