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

qmlls: lazy QmlFile in DOM loads with incorrect import path

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • 6.10
    • 6.10
    • QML: Tooling
    • None

    Description

      Discovered while working on https://bugreports.qt.io/browse/QTBUG-134308:

      • If you load a lazy QmlFile before doing a commitToBase() on the temporary Environment that created it, then it loads fine.
      • If you load the lazy QmlFile later (which is usually the case in qmlls), then you end up loading the file using the Base environment (as the temporary environment is probably already destroyed). The Base environment uses the fallback import path, not the one that was set in the temporary DomEnvironment, and will load the file with missing import paths.

      This means that base types will not be found, and this probably causes bugs later on like QTBUG-133586 where goes to definition only works if the lazy file was populated before the commitToBase-call, and not afterwards. (At least that would explain why QTBUG-133586 reproduces so randomly).

      One way to fix would be to pass the import paths around during commitToBase(), but the cleaner long-term fix would be to make sure that qmlls uses different DomEnvironments/QQmlCodeModels for files requiring different import paths in QTBUG-134308.

      Attachments

        Issue Links

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

          Activity

            People

              sami.shalayel Sami Shalayel
              sami.shalayel Sami Shalayel
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change