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

"Rename Symbol (F2)" inserts blank lines #228691

Closed
srechenb opened this issue Sep 16, 2024 · 1 comment
Closed

"Rename Symbol (F2)" inserts blank lines #228691

srechenb opened this issue Sep 16, 2024 · 1 comment
Assignees

Comments

@srechenb
Copy link

Type: Bug

Using the "Rename Symbol (F2)" function also replaces every /n character with /n/n, thus adding unnecessary blank line severy time this function is used.

Create a new Python file in VS code, write some lines of code, and save. After auto-formatting, the code looks like this:

import pandas as pd

data = pd.Series([0, 0, 1, 0, 2, 0, 1, 2, 3, 7, 0, 0])
first_non_zero = data.ne(0).idxmax()
last_non_zero = data[::-1].ne(0).idxmax() + 1
trimmed_data = data.iloc[first_non_zero:last_non_zero]

Use Rename (F2) to change "first_non-zero" to "first_ind". The resulting code looks like this:

import pandas as pd


data = pd.Series([0, 0, 1, 0, 2, 0, 1, 2, 3, 7, 0, 0])

first_ind = data.ne(0).idxmax()

last_non_zero = data[::-1].ne(0).idxmax() + 1

trimmed_data = data.iloc[first_ind:last_non_zero]



Auto-formatting doesn't remove these extra lines. This behaviour is unexpected and inconsistent with earlier version of VS Code.

VS Code version: Code 1.93.1 (38c31bc, 2024-09-11T17:20:05.685Z)
OS version: Windows_NT x64 10.0.19045
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz (6 x 2712)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.64GB (16.84GB free)
Process Argv --user-data-dir C:\Users\Sven.Rechenberger\AppData\Roaming\.anaconda\navigator\Code --crash-reporter-id ec791493-91f7-49c7-bed0-58f49adf03fd
Screen Reader no
VM 0%
Extensions (11)
Extension Author (truncated) Version
Ansys Eml 0.1.3
black-formatter ms- 2024.2.0
debugpy ms- 2024.10.0
isort ms- 2023.10.1
python ms- 2024.14.1
datawrangler ms- 1.8.1
jupyter ms- 2024.8.1
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.19
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyonecf:30548226
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
724cj586:31013169
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
wkspc-ranged-t:31125599
autoexpandse:31133494
ei213698:31121563

@amunger
Copy link
Contributor

amunger commented Sep 16, 2024

This seems to only occur when using jedi as the language server, and it looks like they already have an issue for it pappasam/jedi-language-server#159

@amunger amunger closed this as completed Sep 16, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants