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

Collapse of source view is non-anticipatory. #4226

Closed
jinyutao opened this issue Mar 15, 2016 · 4 comments
Closed

Collapse of source view is non-anticipatory. #4226

jinyutao opened this issue Mar 15, 2016 · 4 comments
Assignees

Comments

@jinyutao
Copy link

  • VSCode Version:0.10.11
  • OS Version:WIN7 64Bit

Steps to Reproduce:

  1. Input source code
    void fun()
    {
    int i=0;

    ifdef ANY

    i=1;

    else

    i=2;

    endif

    ....
    }

  2. click the [-]icon left "{"
    SHOW:
    void fun()
    {...

    ifdef ANY

    i=1;

    else

    i=2;

    endif

    ....
    }

RIGHT IS:
void fun()
{...
}

@aeschli aeschli self-assigned this Mar 15, 2016
@aeschli
Copy link
Contributor

aeschli commented Mar 15, 2016

@jinyutao Maybe you can add a screenshot?
The current indentation strategy is based purely on the indentation of lines, A folding region starts when a line has a smaller indent than one or more following lines, and ends when there is a line with the same or smaller indent.

To be more smart and to, for example, understand code blocks, we will have to go one step further and introduce language agnostic folding regions. We have issue #3422 for this.

@aeschli aeschli closed this as completed Mar 15, 2016
@jinyutao
Copy link
Author

Thanks the answer.
Add screenshot:
Source code is:
image

click the [-]icon
image

According to answer,modify indent to same,then OK.
before:
image
after:
image

But,I think If we can customize the collapse rules according to different languages. Just like the syntax highlighting rules, is not better.

@aeschli
Copy link
Contributor

aeschli commented Mar 15, 2016

The langage agnostic folding would know that 'void fun()' is the start of a folding section, and '}' the end.
It could also have a rule for #ifdef/#else/#endif

@lkarabeg
Copy link

If this issue matters to you, please head over to #3422 and hit the thumbs up!

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants