Hi Igor,
welcome on forum.
No, I think there is no way to achieve this with current engine functionality.
What you want is something like:
close currently open tag, if next tag is open.
Even if you say:
close current scope, if scope with same open tag opens.
will also not work, because with case of method m2, there is no next method, but start of next class.
Maybe will works something:
close current scope, if open tag of same type scope starts or open tag of parent scope (one in stack before) starts.
But this is will not help in case of class scopes.
While it is not only new rules for closing, but also for definition to which scope can be in which...
So, particular case of cause can be solvable, but it should be generic solution to be implemented.
I will think what can be done here (another case for such scope definitions is INI files) but do not promise something.
You can help here, trying to define clear mockup of rules, that will cover all cases.
So, you are not able to define scopes here, but can define label (not scope bound), that will also help in navigation.
BR, Alex.