Details
-
User Story
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
QDS Berlin - 2023 Week 15/16
-
6035ff939 (qds/dev), 34c69766d (qds/dev), ece03f55a (qds/dev)
Description
Currently we resolve the possible imports for each document seperatly.
Resolving the possible imports is slow and gets slower in Qt 6.5, because more modules are added.
The possible imports only depend on the import paths and are a property of the project.
Currently we determine the possible imports for each document twice, since the possible imports do not settle immediatly.
Therefore we compare the number and consider the possible imports as settled if the number of imports does not change anymore.
This is quite noticable when using QDS especially QDS 4.1 with Qt 6.5. Switching files is slow unless the file has been already opened twice.
Solution:
Move the possible imports to QmlDesignerProjectManager and ExternalDependenciesInterface and make it independ of single documents.
The QmlDesignerProjectManager would determine the possible imports per project. We can use the same heuristic for settling. Once the numer of possible imports does not change we consider it settled. The import paths are part of the QmlProject anyway.
Directory imports are handled seperatly already.
Note that there is DocumentManager::resetPossibleImports(), which is called if new modules are added. This has to continue to work and reset the possible imports of the
QmlDesignerProjectManager instead.
See:
TextToModelMerger::setupPossibleImports
if (m_possibleImportKeys.isEmpty() || projectUrl != lastProjectUrl)
m_possibleImportKeys = snapshot.importDependencies()->libraryImports(viewContext);
snapshot.importDependencies()->libraryImports(viewContext);
See:
ExternalDependenciesInterface
See:
See:
QmlDesignerProjectManager
// Clear possible imports cache if code model hasn't settled yet const int importKeysSize = m_possibleImportKeys.size(); if (m_previousPossibleImportsSize != importKeysSize) m_possibleImportKeys.clear(); m_previousPossibleImportsSize = importKeysSize;
See also
void DocumentManager::resetPossibleImports() { for (const auto &[key, value] : m_designDocuments) { if (RewriterView *view = value->rewriterView()) view->resetPossibleImports(); } }
The possible imports are reset for each rewriter view at the moment.
Attachments
For Gerrit Dashboard: QDS-9542 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
469970,35 | QmlDesigner: Add module scanner | qds/dev | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
472640,9 | QmlDesigner: Add version scanning for Qt5 | qds/dev | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
473197,11 | QmlDesigner: Add import difference | qds/dev | qt-creator/qt-creator | Status: MERGED | +2 | 0 |