You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect unordered list structure, when indented by tabs #2172
After lots of debugging I found that in the list_syntax.dart file, in the parse method, there are two variables indent and currentIndent that are crucial to detect nested list.
And the currentIndent is calculated as:
final currentIndent = parser.current.content.indentation() +
(parser.current.tabRemaining ??0);
In the case above, when we have list indented by tabs, we have tabRemaining as 2 for both nested lines of second level, but because indent is not taking into account tabRemaining there, it mistakenly adds unwanted nesting later, when we compare indent <= currentIndent (which is 2 <= 2 for the "nested two" element).
So my suggested fix is to change indent calculation by adding tabRemaining there:
That way all tests are passing. But I'm not sure if we should also add the same fix to contentWhitespances >= 4 branch above, and I couldn't find a test case for that branch.
Activity
Fixing structure issue of nested lists indented by tabs (dart-lang#2172)
Fixing structure issue of nested lists indented by tabs (dart-lang#2172)
srawlins commentedon Sep 29, 2025
Looks perfectly legit. Thanks for the issue, @alexgarbarev
Looking at Babelmark, most implementations work as you describe above that you would expect. I think using
tabRemainingis a good solution.Fixing structure issue of nested lists indented by tabs (dart-lang#2172)
Fixing structure issue of nested lists indented by tabs (dart-lang#2172)
Fixing structure issue of nested lists indented by tabs (#2172) (#2173)
Fixing structure issue of nested lists indented by tabs (dart-lang#2172…