Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Code folding based on grammar instead of indentation #11838

@fruggiero

Description

@fruggiero

The actual folding mechanism is simply wrong and unreliable.
I often work with big files and use folding to speed up my work.

But, if the file has a wrong indentation (something not rare if the files are human edited) atom also fold the code in a wrong manner.
This in some case can be extremely dangerous , because if you don't remember to check every time what is folded you take that as given and work on the other parts of the file in a wrong manner.

The actual code folding is based firstly on indentation then on grammar.

I think that the code folding should be based ONLY on grammar.
Because, actually, even when you have a correct grammar (with correct folding rules) you can't be sure that the editor fold the code in the right manner.

Here is some examples to show , editing an XML file (i want to fold at line number 10):

Unfolded text (with wrong indentation at line 18 and 19):
image

Folded text (WRONG because of wrong indentation):

image

What the correct folding should be:

image

But for achieve this we must fix the indentation (on line 18 and 19):

image

I think that correct indentation CAN'T be a requirement to correct code folding.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions