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

qmlls: lazy QmlFile in DOM loads with incorrect import path

XMLWordPrintable

    • 032a2e6bf (dev), c91a22559 (6.10), 1cc93ee78 (6.9), 37ef1c24e (tqtc/lts-6.8)

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes