Closed dnbln closed 4 years ago
I'm still not sure what should be done here(if it found a }
without a corresponding {
):
https://github.com/Mcat12/intellij-lalrpop/pull/6/commits/ee42607370a1767026a9e32c9f7268f489da0e90#diff-a5e31c273a67464a39b866ae9a09fd4cR27
I think it's fine as it is. Alternatively we may want to return an empty list if we find that the braces don't match up. I did some limited testing and didn't see any odd behavior when I removed or added braces. I can clarify the comment so that's documented.
Edit: I pushed the clarification and also a fix to the grammar so that enum block parsing is successful (which also allows folding to happen).
And also here it's the other way around by the way https://github.com/Mcat12/intellij-lalrpop/commit/ac9fd4c5bf3ba8694932d00fd4b31ed2c3ba03ca#diff-a5e31c273a67464a39b866ae9a09fd4cR27
There are more closing braces than opening ones.
Also there are more opening braces if the stack is not empty at the end.
Ah, you're right, I'll update the comment again.
I'm a little surprised that IntelliJ doesn't automatically find the braces for folding based on the LpBraceMatcher
class, or at least provide a way to re-use that code. I guess it's not always a 1:1 relationship between brace matching and folding.
Because they somehow were missing and I consider them essential.