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

Second terminator doesn't foldLastLine when Begin line has two matches #120

Open
TonyGravagno opened this issue Nov 8, 2024 · 1 comment

Comments

@TonyGravagno
Copy link

Two rules (first and second) have a Begin match on the same line. At the end of the block, the inside (second) End is consumed by foldLastLine, but the outside (first) End is not.

To reproduce

  • VSCode: 1.95.1
  • Explicit Folding: 0.24.1
  • Language: typescript

Code Example

   static read(key: string) {
        let person: Person = new Person({   // first BEGIN on parenthesis, second on brace
            name: "Jane Doe",
            country: "USA",
            birthDate: new Date("6/7/1967"),
            numberOfPets: 2,
            petNames: ["Minnie", "Mickey"],
            hasCar: true,
        }       // is consumed with foldLine
        )       // should also be consumed with foldLastLine
        return person;
    };

Settings

"*": [
  {
    "foldLastLine": true
  }
],
...
{
  "beginRegex": "{$",
  "endRegex": "(\\}(,|;|)$)",
  "nested": true
},
...
{
  "begin": "(",
  "end": ")",
  "nested": true,
},

Expected behavior

Single folded line that considers all End matches

Actual

Single folded line consumes brace, does not consume closing parenthesis.
Note that the folding does process the brace on line 11 and the parenthesis on line 12. It just doesn't include the parenthesis in the handling of the foldLastLine processing.

[document] foldings: [{"start":4,"end":11,"kind":3},{"start":4,"end":12,"kind":3} ...

image

@daiyam
Copy link
Member

daiyam commented Nov 8, 2024

"foldLastLine": true alone does nothing... It's an optional property of a rule.

{"start":4,"end":11,"kind":3} and {"start":4,"end":12,"kind":3} start at the same line.
They behave the same but you see a difference because {"start":4,"end":11,"kind":3} is simply ignored by the foldings displayer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants