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

Code folding doesn't work for single-line if/else statements #7809

Closed
sean-mcmanus opened this issue Jul 9, 2021 · 7 comments · Fixed by #7818
Closed

Code folding doesn't work for single-line if/else statements #7809

sean-mcmanus opened this issue Jul 9, 2021 · 7 comments · Fixed by #7818
Labels
bug Feature: Code Folding fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix

Comments

@sean-mcmanus
Copy link
Collaborator

@vacing The fix is in 1.5.0 (https://github.com/microsoft/vscode-cpptools/releases/tag/1.5.0).

thank you, it workes fine for the previous case, now I have a new bad case : (

    if (true) {
        if (true) {
            ;
        } else {
            ;
        }
        ;
    } else if(true)  // else or else if(), the most important is no bracket here
        ;

Originally posted by @vacing in #5521 (comment)

@sean-mcmanus sean-mcmanus self-assigned this Jul 9, 2021
@sean-mcmanus sean-mcmanus added Feature: Code Folding investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service labels Jul 9, 2021
@sean-mcmanus
Copy link
Collaborator Author

@vacing Thanks, I'll check it out tomorrow...

@vacing
Copy link

vacing commented Jul 9, 2021

@vacing Thanks, I'll check it out tomorrow...

It's me who should say thanks for your great work and rapid response.

@sean-mcmanus sean-mcmanus changed the title Bug with code folding Code folding doesn't work for single-line if/else statements Jul 9, 2021
@sean-mcmanus sean-mcmanus added more info needed The issue report is not actionable in its current state and removed investigate: repro This issue's repro steps needs to be investigated/confirmed labels Jul 9, 2021
@sean-mcmanus
Copy link
Collaborator Author

sean-mcmanus commented Jul 9, 2021

@vacing I'm seeing code folding not working for single line if/else statements. So in your case, the last "else if" doesn't fold, but it also repros with

    if (true)
        return 0;

Is that the issue you are seeing?

It seems like that behavior may be "by design", since it also repros with VS. I'll see if I can find out for sure. Was there a reason you believe folding of 1 line if/else would be desirable?

@sean-mcmanus
Copy link
Collaborator Author

TypeScript in VS Code has the same folding behavior -- I'm closing this as "by design".

@sean-mcmanus sean-mcmanus added by design and removed more info needed The issue report is not actionable in its current state labels Jul 9, 2021
@sean-mcmanus sean-mcmanus removed their assignment Jul 9, 2021
@vacing
Copy link

vacing commented Jul 10, 2021

@vacing I'm seeing code folding not working for single line if/else statements. So in your case, the last "else if" doesn't fold, but it also repros with

    if (true)
        return 0;

Is that the issue you are seeing?

What I mean is fold the outer if will hide the else if line if it doesn't has a brace.
Do you mean this behavior is "by design"?

@sean-mcmanus
Copy link
Collaborator Author

Oops, sorry, I didn't see that behavior previously.

@sean-mcmanus sean-mcmanus reopened this Jul 12, 2021
@sean-mcmanus sean-mcmanus added this to the 1.6.0-insiders milestone Jul 13, 2021
@sean-mcmanus sean-mcmanus added quick fix fixed Check the Milestone for the release in which the fix is or will be available. labels Jul 13, 2021
@vacing
Copy link

vacing commented Jul 13, 2021

Oops, sorry, I didn't see that behavior previously.

: >

@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Code Folding fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants