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
Relevant/affected Python packages and their versions:
rope 0.10.7
Actual behavior
When one of the symbols being renamed is on the last line of the file, that line disappears after renaming the symbol. Take this tiny file for example:
def testme(num):
x = num + 2
return x
print testme(2)
If you select testme in the function and press F2, then rename the function to, for example, testyou and press Enter. The last line in the file (print testme(2)) vanishes. I've verified that putting a newline character at the end of the last line fixes the issue. It appears to have something do with one of the symbols being renamed being on the last line of the file.
Expected behavior
I would have expected the line print testme(2) to turn into print testyou(2), instead of the line disappearing.
Steps to reproduce:
Create a file with the above minimal content, making sure that there are no newline characters after the last line.
Select testme in the function.
Press F2.
Rename the function to whatever you want.
Press Enter.
The last line disappears from the file.
Logs
Output for Python in the Output panel:
It is empty. Well, some git commands show up, but it seems highly unlikely they are relevant.
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)
None. There is no output at all in the Console of the Developer Tools.
Comments
While looking to see if there were any other issues filed for this problem, I did come across issue #52, in which the last comment (from puzzler10) seems to be related to this issue. They were asked to create a separate issue, but I can't find any issues opened by puzzler10, so I assume the person never did.
The text was updated successfully, but these errors were encountered:
I can verify this seems to be an issue on our end and not with Rope:
# Creating a projectfromrope.base.projectimportProjectproject=Project('.')
# Working with files to create a modulecode="""def testme(num): x = num + 2 return xprint(testme(2))"""mod1=project.root.create_file('mod1.py')
mod1.write(code)
# Performing rename refactoring on `mod1.a_var`fromrope.refactor.renameimportRenamechanges=Rename(project, mod1, 4).get_changes('tested')
project.do(changes)
print(repr(mod1.read())) # 'def tested(num):\n x = num + 2\n return x\n\nprint(tested(2))'
Environment data
Actual behavior
When one of the symbols being renamed is on the last line of the file, that line disappears after renaming the symbol. Take this tiny file for example:
If you select
testme
in the function and pressF2
, then rename the function to, for example,testyou
and pressEnter
. The last line in the file (print testme(2)
) vanishes. I've verified that putting a newline character at the end of the last line fixes the issue. It appears to have something do with one of the symbols being renamed being on the last line of the file.Expected behavior
I would have expected the line
print testme(2)
to turn intoprint testyou(2)
, instead of the line disappearing.Steps to reproduce:
testme
in the function.F2
.Enter
.Logs
Output for
Python
in theOutput
panel:It is empty. Well, some git commands show up, but it seems highly unlikely they are relevant.
Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)None. There is no output at all in the
Console
of theDeveloper Tools
.Comments
While looking to see if there were any other issues filed for this problem, I did come across issue #52, in which the last comment (from puzzler10) seems to be related to this issue. They were asked to create a separate issue, but I can't find any issues opened by puzzler10, so I assume the person never did.
The text was updated successfully, but these errors were encountered: