Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra blank lines appear when I rename symbols #5756

Closed
HwangWentian opened this issue Apr 3, 2024 · 8 comments
Closed

Extra blank lines appear when I rename symbols #5756

HwangWentian opened this issue Apr 3, 2024 · 8 comments
Assignees

Comments

@HwangWentian
Copy link

Type: Bug

As the title suggests.
Man, what can I say?
This question has been bothering me for long.

VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z)
OS version: Windows_NT x64 10.0.22631
Modes:

@vscodenpa
Copy link

Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

Happy Coding!

@HwangWentian HwangWentian closed this as not planned Won't fix, can't repro, duplicate, stale Apr 4, 2024
@HwangWentian
Copy link
Author

Sorry for the trouble caused by not providing enough information. I am a programming amateur,so I don't know the rules. Excuse me.

VS Code version: Code 1.87.2
OS version: Windows_NT x64 10.0.22631
Extensions Installed: Python(by Microsoft), Python Debugger(by Microsoft)

Problem description

Suppose I edit the following Python3 code:

a = 123
d = 321
c = "abc"

If I choose the variable b and perform the Rename Symbol operation, it will look like this:

a = 123

d = 321

c = "abc"

As the title suggests, extra blank lines appear inexplicably. I guess it's a problem with the Python Debugger extension.

@HwangWentian HwangWentian reopened this Apr 4, 2024
@HwangWentian
Copy link
Author

I made a typo..The first block of code is:

a = 123
b = 321
c = "abc"

@jrieken jrieken assigned karthiknadig and unassigned jrieken Apr 4, 2024
@karthiknadig karthiknadig transferred this issue from microsoft/vscode Apr 4, 2024
@karthiknadig
Copy link
Member

@HwangWentian What do you have for the python.languageServer setting? if it is set to Jedi please set it to Default.

@NunUrDamBizness
Copy link

@HwangWentian What do you have for the python.languageServer setting? if it is set to Jedi please set it to Default.

@HwangWentian
Copy link
Author

@karthiknadig @NunUrDamBizness
I confirmed that python.languageServer is set to Default.

This issue still persists. I'm not sure if the same issue exists on other platforms.

@karthiknadig karthiknadig removed their assignment Apr 12, 2024
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Apr 12, 2024
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Apr 12, 2024
@debonte
Copy link
Contributor

debonte commented Apr 12, 2024

I confirmed that python.languageServer is set to Default.

@HwangWentian, can you also check if you have the Pylance extension installed and enabled? Default means that Pylance will be used, but only if it is installed and enabled. Otherwise Jedi is used.

When we've seen this sort of behavior in the past it was due to either:

  1. Jedi was being used as the language server instead of Pylance. There's a Jedi bug that can cause extra lines to be inserted -- Renaming a module adds additional new lines pappasam/jedi-language-server#159. Also see Visual Studio Code F2 rename symbol key is adding newlines in Python vscode-python#17123.
  2. Pylance was the language server, but there was another Python-related extension installed that was also handling the rename request -- see Rename symbol (F2) to rename one variable name fully mess your whole script #2367 (comment)

So if you have Pylance installed, can you please try disabling all of your extensions except Python and Pylance and see if the issue still happens?

@debonte debonte added the waiting for user response Requires more information from user label Apr 12, 2024
@HwangWentian
Copy link
Author

@debonte , I have not installed Pylance. But the problem was fixed when I installed Pylance and set it to languageServer. Thanks for the tip.

@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels Apr 13, 2024
@debonte debonte closed this as completed Apr 13, 2024
@debonte debonte added external bug and removed user responded Was "waiting for user response" and they responded needs repro Issue has not been reproduced yet labels Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants