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

qmlformat: context aware formatting support

XMLWordPrintable

    • All

      performOperation(root.locking.lock(), "locking")
      .then(() => performOperation(aaa(), "opening damage"))
      .then(() => performOperation(bbb(), "removing file"))
      .then(() => {
          console.debug("moveToTrash: ", filePath);
          const success = Ibh.FileIo.moveToTrash(filePath);
          if (!success) {
              return Promise.reject("Failed to move file to trash");
          }
      {color:#000000}}).catch(error => {
          console.error("Operation failed:", error);
          errorOccurred(error);
      {color:#000000}});
       
      converts to:

      performOperation(root.locking.lock(), "locking").then(() => performOperation(aaa(), "opening damage")).then(() => performOperation(bbb(), "removing file")).then(() => {
          console.debug("moveToTrash: ", filePath);
          const success = Ibh.FileIo.moveToTrash(filePath);
          if (!success) {
              return Promise.reject("Failed to move file to trash");
          }
      {color:#000000}}).catch(error => {
          console.error("Operation failed:", error);
          errorOccurred(error);
      {color:#000000}});
       
       
      There is no line size limit, so additional .then statements will get written in the same line. I would really like to see them getting formatted like the first code.

        For Gerrit Dashboard: QTBUG-127435
        # Subject Branch Project Status CR V

            qtqmlteam Qt Qml Team User
            kelteseth Elias Steurer
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes