Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
6.1
Description
Currently comments are not added to the Dom, but they should, so that comment preserving dump works
- strategy
keep in mind the last token before a comment: token_before
collect comments until empty line or token
if nodes start at token_after
assign to before of biggest node starting at token, in the line, but the smallest between those that span multiple lines.
else if nodes end at token_before
assign to after of smallest multiline node spanning the most of the line with token_before
else if not node_after, look for node_after continuing collecting comments, and if node_after
assign to before of biggest node starting at token, in the line, but the smallest between those that span multiple lines.
else if nodes contain comment
assign to smallest node
else assign to header if not node_before, to footer if not node_after
else should never happen
// header
{ // before x // before x x // after x // after x // before y y // before z z // after z // before zz zz // after zz }/before (a b)/(/* before a / a / before b / b /*after b/) // after (a b)
a + b // comment
// footer
CommentAstVisitor::CommentAstVisitor(QQmlJS::Engine *engine, Node *rootNode) : m_engine(engine)
Attachments
Issue Links
- is required for
-
QTBUG-89391 Make DomModel usable by QML Design Studio
- Blocked