Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89404

Correctly handle comments in Dom

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 6.1
    • QML: Tooling

    Description

      Currently comments are not added to the Dom, but they should, so that comment preserving dump works

      1. 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              fawzi Fawzi Mohamed
              fawzi Fawzi Mohamed
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes