PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

Refactor rename incorrect when the referenced method is defined in another project.

Open ttSpace opened this issue 3 years ago • 3 comments

Describe the bug

image

Steps to Reproduce

  1. Create python application named PythonAppication1
  2. Create python application named PythonAppication2
  3. Right-click in PythonAppication1 and select Add->reference..., select PythonApplication2 as referenced
  4. Typing code in PythonApplication2.py
def add(a, b):
    print(a + b)
  1. Typing code in PythonAppication1.py
import PythonApplication2
PythonApplication2.add(1,2)
  1. Open PythonApplication2.py and select function name add and right-click to select rename...
  2. Input a new name addTest in rename dialog and press enter

Expected behavior

The name add can be renamed as addTest both in PythonApplication2.py and PythonApplication1.py

Actual behavior

Nothing has changed.

ttSpace avatar Aug 03 '21 06:08 ttSpace

Very weird. Only repros with the cross project reference. Otherwise rename works fine.

rchiodo avatar Aug 03 '21 16:08 rchiodo

In today's build 17.1.0 Preview 3.0 [32030.14.main] , The name of the place where this method is called has not changed.

ttSpace avatar Dec 31 '21 07:12 ttSpace

In today's build 17.2.0 Preview 2.0 [32228.339.main].In the same project, rename a method, but the method name of this method in other places where it is called has not changed image image image

linette-zyy avatar Mar 01 '22 08:03 linette-zyy

The original bug is reported for two projects, with one referencing the other. But the latest screenshots show this is broken for two files in the SAME project. We need to investigate and fix both of these cases if they still repro.

AdamYoblick avatar Feb 02 '23 22:02 AdamYoblick

@ttSpace Can you please verify if this is still happening on the latest version of Visual Studio? For both single project and multiproject cases. Thank you!

AdamYoblick avatar Feb 02 '23 22:02 AdamYoblick

@AdamYoblick In today's build 17.6.0 Preview 2.0 [33406.287.main], Python Package: 17.0.23033.1, In two Projects, Renamed only in PythonApplication2.py. The name of the place where this method is called has not changed. foo --> footest

image

This works fine for the two files in the SAME project. foo --> footest

image

ttSpace avatar Feb 07 '23 06:02 ttSpace

In today's latest build:17.7.0 Preview 2.0 [33709.378.main],Python package:17.0.23115.2 In two Projects, the 'rename' command doesn't have any responce after selecting it rename

linette-zyy avatar May 10 '23 06:05 linette-zyy

@linette-zyy I was trying to repro this issue, how did you find the other project to add as reference? Mine shows nothing was found. image

StellaHuang95 avatar Dec 13 '23 00:12 StellaHuang95

This issue was closed because it has been stalled for 30 days with no activity. If the issue still persists, please reopen with the information requested. Thanks.

github-actions[bot] avatar Jan 12 '24 00:01 github-actions[bot]