Skip to content

Extract method does not work. #8643

Closed

Description

@linette-zyy

Environment
Build of Visual Studio: 18.13.0 Canary [12309.413.main]
Build of Python Package: 18.0.26285.1
Version of Pylance: 2026.4.100
OS version: Windows 11 Enterprise, version 25H2

  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. Select the lines of code or expression to extract into a separate method
  2. Observes

Expected behavior
An symbol like this Image should display.

Additional context and screenshots
No response when refactor code

Image

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions