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

Code model ignores JS template literals

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • Qt Creator 5.0.3
    • Quick / QML Support
    • None

    Description

      If a variable is used inside a template literal, it is not affected by "Rename symbol under cursor" refactoring, and you cannot use go-to definition with it.

      Consider 

       

      import QtQuick 2.15
      import QtQuick.Window 2.15Rectangle {
          objectName: "foo"
          width: 640
          height: 480
          visible: true
          Component.onCompleted: {
              let fullContentPath = "/full/content/path"
              let volume = "super loud"
              let fillMode = "dashed"
              var src = `var videoPlayer = document.getElementById("videoPlayer");
                      var videoSource = document.getElementById("videoSource");
                      videoSource.src = ${fullContentPath};
                      videoPlayer.load();
                      videoPlayer.volume = ${volume} ;
                      videoPlayer.setAttribute("style", "object-fit : ${fillMode};");
                      videoPlayer.play();
                      `;
              console.log(volume)
          }
      }
      
      

       and rename `volume` to `loudness`: One would expect that it changes in the template literal, but it only changes in the console.log statement.

       

      Moreover, you cannot click on it in the template literal to go to the definition (whereas it does work in the console.log statement).

       

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              fabiankosmale Fabian Kosmale
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes