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

Nested switch collapsing broken #2751

Closed
Redex68 opened this issue Oct 23, 2022 · 1 comment · Fixed by eclipse-jdtls/eclipse.jdt.ls#2794
Closed

Nested switch collapsing broken #2751

Redex68 opened this issue Oct 23, 2022 · 1 comment · Fixed by eclipse-jdtls/eclipse.jdt.ls#2794

Comments

@Redex68
Copy link

Redex68 commented Oct 23, 2022

Type: Bug

If there is a nested switch inside of another switch, collapsing the code doesn't work properly when we try to collapse a case from the encapsulating switch.

E.g.
Collapsing case 1 here doesn't properly collapse the code:

switch (a) {
    case 1:
    {
        switch (a){
            case 2:
                System.out.println("test1");
            case 3: 
                System.out.println("test2");
        }    
    }
    case 4:
    {
        System.out.println("test3");
    }
}

It collapses up untill the first occurance of a "case" keyword, regardles of which switch the case belongs to, instead of collapsing at the first occurance of a case keyword from the same switch.

Regular:
image
Failed collapse:
image
Expected behaviour:
image

Extension version: 1.11.0
VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:15:18.074Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Sandboxed: No

System Info
Item Value
CPUs AMD Ryzen 7 5800H with Radeon Graphics (16 x 3194)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.36GB (6.81GB free)
Process Argv D:\Marin\FER\5. Semestar\Odabrana poglavlja razvoja programske potpore 1\Domaci Radovi\hw02-0036535607 --crash-reporter-id 36b72c21-ca7f-4ca2-94be-5592b850898e
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
azure-dev_surveyone:30548225
2144e591:30553903
vsccc:30566497
pyindex848:30577860
nodejswelcome1cf:30587006
fc301958:30573243

@jdneo
Copy link
Collaborator

jdneo commented Oct 24, 2022

Yes I can reproduce it

switch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants