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

Broken "Enable auto format on file save" feature for qml/js files

    XMLWordPrintable

Details

    • Linux/X11, Windows

    Description

      When selecting Tools>Options>Qt Quick>QML/JS Editing>Enable auto format on file save feature, some parts of codes in Javascript functions are removed after saving a changed file. For example if you have a function with more than one argument like:

      function test(p1, p2) {
          console.log("Hello")
      }
      

      After saving the changes it changes in to:

      function test(p1p2) {
          console.log("Hello")
      }
      

      Another example is this function :

      function test() {
          for(var i=0;i<10;i++)
              console.log(i)
      }
      

      After saving it is changed to:

      function test() {
          for (; i < 10; i++)
              console.log(i)
      }
      

      Also default values for function parameters are removed after saving.
      For example this function :

      function test(p = 1) {
          console.log("hello")
      }
      

      is changed to:

      function test(p) {
          console.log("hello")
      }
      

      I didn't see these problems on Qt Creator 4.8.

      Attachments

        Issue Links

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

          Activity

            People

              tjenssen Tim Jenssen
              nejatafshar Nejat Afshar
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes