forked from qt-creator/qt-creator
qmljs: ensure that opening an editor always updates the modelmanager
Change-Id: Ia23d9c84240bd2c54b0c331494474d0fa74674e8 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
@@ -189,6 +189,14 @@ ModelManagerInterface::WorkingCopy ModelManagerInterface::workingCopy()
|
||||
return WorkingCopy();
|
||||
}
|
||||
|
||||
void ModelManagerInterface::activateScan()
|
||||
{
|
||||
if (!m_shouldScanImports) {
|
||||
m_shouldScanImports = true;
|
||||
updateImportPaths();
|
||||
}
|
||||
}
|
||||
|
||||
QHash<QString, Language::Enum> ModelManagerInterface::languageForSuffix() const
|
||||
{
|
||||
return defaultLanguageMapping();
|
||||
|
||||
@@ -156,6 +156,7 @@ public:
|
||||
QmlJS::Snapshot snapshot() const;
|
||||
QmlJS::Snapshot newestSnapshot() const;
|
||||
|
||||
void activateScan();
|
||||
void updateSourceFiles(const QStringList &files,
|
||||
bool emitDocumentOnDiskChanged);
|
||||
void fileChangedOnDisk(const QString &path);
|
||||
|
||||
@@ -139,6 +139,8 @@ void QmlJSTextEditorWidget::ctor()
|
||||
m_modelManager = QmlJS::ModelManagerInterface::instance();
|
||||
m_contextPane = ExtensionSystem::PluginManager::getObject<QmlJS::IContextPane>();
|
||||
|
||||
m_modelManager->activateScan();
|
||||
|
||||
m_contextPaneTimer = new QTimer(this);
|
||||
m_contextPaneTimer->setInterval(UPDATE_OUTLINE_INTERVAL);
|
||||
m_contextPaneTimer->setSingleShot(true);
|
||||
|
||||
@@ -448,6 +448,8 @@ QmlJSEditorDocumentPrivate::QmlJSEditorDocumentPrivate(QmlJSEditorDocument *pare
|
||||
m_updateOutlineModelTimer.setInterval(UPDATE_OUTLINE_INTERVAL);
|
||||
m_updateOutlineModelTimer.setSingleShot(true);
|
||||
connect(&m_updateOutlineModelTimer, SIGNAL(timeout()), this, SLOT(updateOutlineModel()));
|
||||
|
||||
modelManager->updateSourceFiles(QStringList(parent->filePath()), false);
|
||||
}
|
||||
|
||||
QmlJSEditorDocumentPrivate::~QmlJSEditorDocumentPrivate()
|
||||
|
||||
Reference in New Issue
Block a user