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

Refactoring fails badly on some prefix increments #5568

Closed
nic-hartley opened this issue May 26, 2020 · 3 comments
Closed

Refactoring fails badly on some prefix increments #5568

nic-hartley opened this issue May 26, 2020 · 3 comments
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

Comments

@nic-hartley
Copy link

Issue Type: Bug

  1. Create a new, empty .c file.

  2. Enter this text:

    int main(void) {
        for (int i = 0; i < a->b[i].c; ++i)
        {
            foo();
        }
    }
  3. Click on i (any instance of it), then press F2 to begin refactoring.

  4. Pick any other name for the variable. (e.g. i2)

  5. Refactor preview shows the error: ++i is incorrectly replaced. (e.g. by i2+i)

  6. 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%
@Colengms Colengms added bug Feature: Rename Language Service Works in VS So we'd need to fix it for VS Code to reach parity. labels May 26, 2020
@sean-mcmanus sean-mcmanus self-assigned this May 28, 2020
@sean-mcmanus sean-mcmanus added this to the 0.29.0 milestone May 28, 2020
@sean-mcmanus
Copy link
Contributor

Thanks a lot for reporting this. It should be fixed in the next release.

@nic-hartley
Copy link
Author

Awesome, thanks so much!

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label May 28, 2020
@sean-mcmanus sean-mcmanus removed their assignment May 28, 2020
@sean-mcmanus
Copy link
Contributor

@github-actions github-actions bot locked and limited conversation to collaborators Oct 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

3 participants