Closed rwjblue closed 8 years ago
LGTM
After digging a bit more, I realized that almost all ElementNode
locations on the same line as a mustache were incorrect. I have updated the approach to utilize the ContentStatement
's location information to reset the tokenizer's current positioning which fixes the following additional issues that I identified while digging into the {{else if foo}}
issue:
{{#foo-bar}}<div>Foo</div>{{/foo-bar}}
-- elements inside blocks had incorrect start/end{{foo-bar}} <p>Hi!</p>
-- elements after a mustache had incorrect start/end
Given the following:
The
ElementNode
for the<div>
was indicating that itsloc.end.column
was 12. This is ultimately due to how Handlebars handles trailing newlines after the{{/if}}
. We were properly detecting that the node wasrightStripped
and adding the number of stripped newlines to thetokenizer.line
number, but we did not reset thetokenizer.column
also.The fix is to ensure that the column is reset when incrementing the line count.
This is also being fixed in Glimmer in https://github.com/tildeio/glimmer/pull/91