Skip to content

Refactor code: Rename, Extract method and remove unused imports are not working. #8595

Description

@linette-zyy

Environment
Build of Visual Studio: 18.10.0 Canary [12024.283.main]
Build of Python Package: 18.0.26207.1
Version of Pylance: 2026.2.109
OS version: Windows 11 Enterprise, version 25H2

Steps to Reproduce

  1. Create a new python application
  2. Input some codes
from math import cos, radians
	
# Create a string with spaces proportional to a cosine of x in degrees
def make_dot_string(x):
	rad = radians(x)                             # cos works with radians
	numspaces = int(20 * cos(radians(x)) + 20)   # scale to 0-40 spaces
	st = ' ' * numspaces + 'o'                   # place 'o' after the spaces
	return st
	
def main():
	for i in range(0, 1800, 12):
		s = make_dot_string(i)
		print(s)
	
main()
  1. Right click ‘make_dot_string’, choose rename.

Expected behavior
A dialog will pops up, enter the new name and then enter, the code will change to new name
Image

Additional context and screenshots
No response when refactor code
Image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions