Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-26602

Integration of "qmlformat" in QtCreator

    XMLWordPrintable

Details

    Description

      What is the benefit? Why is this valuable?

      Use essentials QML tooling in Qt Creator

       

      What are common use cases?

      • Run qmlformat for a single file
      • Run qmlformat for a selected section of a file ("Edit" > "Advanced" > "Auto-format Selection"/"Auto-indent Selection")
      • Run qmlformat for the whole project

       

      Technical information

      There are a few place that formatting can be triggered in QtC.

      Full document formatting:
      Tools -> Qml/JS -> Reformat

      Preferences -> QtQuick -> Qml/Js Editing -> Enable auto format on file save

      Range formatting:

      RightClick on qml editor -> Auto indent selection

      Edit -> Advanced -> Auto indent selection

      • As a first step, replace the embedded formatter with QML tooling for these actions. When enabled, use qmlls otherwise use standalone qmlformat tool.
      • For range formatting, first implement the auto-indent functionality in qmlformat (this is already in for qmlls but not for standalone qmlformat. See QTBUG-127306). Regarding "Auto-format Selection", it should be done as follow-up feature to this as full formatting of ranges is not supported in the embedded formatter, too.
      • Add a new action in the menu to trigger qmlformat for all the qmlfiles in the project.
      • Respect the tabs and indentation policy in the Pref -> QtQuick -> CodeStyle

      Attachments

        Issue Links

          For Gerrit Dashboard: QTCREATORBUG-26602
          # Subject Branch Project Status CR V

          Activity

            People

              semih.yavuz Semih Yavuz
              vminenko Vladimir Minenko
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change