Repository navigation
Description
Issue Type: Bug
-
Create a new, empty
.cfile. -
Enter this text:
int main(void) { for (int i = 0; i < a->b[i].c; ++i) { foo(); } }
-
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:
++iis 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 a for 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-line if, 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
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 9 3950X 16-Core Processor (32 x 2848) |
| GPU Status | 2d_canvas: enabled 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 |
| Load (avg) | 1, 1, 1 |
| Memory (System) | 15.57GB (9.26GB free) |
| Process Argv | --no-sandbox |
| Screen Reader | no |
| VM | 0% |
Activity
sean-mcmanus commentedon May 28, 2020
Thanks a lot for reporting this. It should be fixed in the next release.
nic-hartley commentedon May 28, 2020
Awesome, thanks so much!
sean-mcmanus commentedon Jun 25, 2020
Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.29.0-insiders .