Refactoring fails badly on some prefix increments #5568
Labels
bug
Feature: Rename
fixed
Check the Milestone for the release in which the fix is or will be available.
Language Service
quick fix
Works in VS
So we'd need to fix it for VS Code to reach parity.
Milestone
Issue Type: Bug
Create a new, empty
.c
file.Enter this text:
Click on
i
(any instance of it), then press F2 to begin refactoring.Pick any other name for the variable. (e.g.
i2
)Refactor preview shows the error:
++i
is incorrectly replaced. (e.g. byi2+i
)Manually add the erroneous refactor (it's unticked by default) and accept, to confirm that the error shows when the change is actually made.
This breaks even worse when renaming multi-character variable names.
The precise breakage seems to depend on how the variable is used; namely, how "complex" the rest of the line before it is. If I have just a bare
++x
, on its own on a line, it works fine. If it's at the end of afor
loop, it sometimes breaks, in different ways (which vary further based on... possibly both line length and variable name length? not sure). If it's within a one-lineif
, it sometimes breaks (again, in various ways -- not sure what the correlation is). However, once I find a breaking scenario, I am able to consistently reproduce it.Apologies if this has already been raised; with all due respect, I'm not going to trawl through a thousand issues.
Extension version: 0.28.1
VS Code version: Code - OSS 1.44.2 (ff915844119ce9485abfe8aa9076ec76b5300ddd, 2020-04-23T19:32:05.786Z)
OS version: Linux x64 5.4.40-1-MANJARO
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: unavailable_off
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
The text was updated successfully, but these errors were encountered: