-
Notifications
You must be signed in to change notification settings - Fork 191
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
add element parts, startTag & endTag #1553
Conversation
3210d83
to
38bec77
Compare
</Foo> | ||
`); | ||
|
||
let [, section] = ast.body; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the first node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, copied from tests above. Probably text node
locEqual(section.endTag, 5, 4, 5, 10, 'Foo end tag'); | ||
let [, barSelfClosed] = section.children; | ||
if (assertNodeType(barSelfClosed, 'ElementNode')) { | ||
locEqual(barSelfClosed.parts[0], 3, 7, 3, 10, 'bar.x.y bar part'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do each of these have their part name attached? if so, it would be good to assert that as well.
38bec77
to
b4e31f5
Compare
8e4690b
to
c7682c5
Compare
value: string; | ||
} | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful, thank you!
`); | ||
|
||
let [, foo] = ast.body; | ||
locEqual(foo, 2, 4, 5, 10, 'Foo element'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this range right? 4 to 10 is 6, but the element is <Foo as |bar|>
~ 14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the end is at </Foo>
, so this is correct. the element is the whole thing, from <Foo
to </Foo>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the range of 6 though? feels ... arbitrary? I'm probably missing something though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start: line 2, column 4
end: line 5, column 10
different line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol oops. thanks
let [, foo] = ast.body; | ||
locEqual(foo, 2, 4, 5, 10, 'Foo element'); | ||
if (assertNodeType(foo, 'ElementNode')) { | ||
locEqual(foo.startTag, 2, 4, 2, 18, 'Foo start tag'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18-4 = 14 nice
Provide source spans for the open and close tags without adding new AST nodes, also parse the element's tag name into a path which has the required source span.
part of #1490