From 7b9ef7923f9a8d33f118e703695b4e23d57c1c4c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 May 2011 14:25:14 +0200 Subject: [PATCH 01/28] fix read beyond eol on missing expansion terminator now we uniformly increment the read pointer only if we encountered a terminator (which also implies that we were not at non-eol yet). Task-number: QTCREATORBUG-5022 Change-Id: If4a4e7aec7423684297393fa10e50a69773b2048 Reviewed-on: http://codereview.qt.nokia.com/222 Reviewed-by: Qt Sanity Bot Reviewed-by: Oswald Buddenhagen --- src/shared/proparser/profileparser.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/shared/proparser/profileparser.cpp b/src/shared/proparser/profileparser.cpp index 0050940079d..8d923c18d74 100644 --- a/src/shared/proparser/profileparser.cpp +++ b/src/shared/proparser/profileparser.cpp @@ -515,7 +515,6 @@ bool ProFileParser::read(ProFile *pro, const QString &in) goto newWord; } if (term) { - cur++; checkTerm: if (c != term) { parseError(fL1S("Missing %1 terminator [found %2]") @@ -523,9 +522,9 @@ bool ProFileParser::read(ProFile *pro, const QString &in) .arg(c ? QString(c) : QString::fromLatin1("end-of-line"))); pro->setOk(false); m_inError = true; - if (c) - cur--; // Just parse on, as if there was a terminator ... + } else { + cur++; } } joinToken: @@ -585,7 +584,7 @@ bool ProFileParser::read(ProFile *pro, const QString &in) finalizeCall(tokPtr, buf, ptr, theargc); goto nextItem; } else if (term == '}') { - c = (cur == end) ? 0 : *cur++; + c = (cur == end) ? 0 : *cur; goto checkTerm; } else { Q_ASSERT(!term); From 8b95ca89572479262c9eb3dd4b2ecd88ddf6db5c Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 27 May 2011 14:51:30 +0200 Subject: [PATCH 02/28] QmlJS: Allow for QML modules with version subdirectories. That means import Foo 2.1 can resolve to /path/Foo.2.1 or /path/Foo.2 or /path/Foo Task-number: QTCREATORBUG-4607 Change-Id: Ie1efc5be2ca2ed3ccc130e8a662f94aed11bec1ax Reviewed-on: http://codereview.qt.nokia.com/194 Reviewed-by: Roberto Raggi (cherry picked from commit 8742026380faeb39c7084872d5c146f301253a78) Reviewed-on: http://codereview.qt.nokia.com/380 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/libs/languageutils/componentversion.cpp | 3 + src/libs/languageutils/componentversion.h | 1 + src/libs/qmljs/qmljsdocument.cpp | 6 +- src/libs/qmljs/qmljsdocument.h | 17 +++- src/libs/qmljs/qmljslink.cpp | 32 ++++++-- src/plugins/qmljstools/qmljsmodelmanager.cpp | 82 +++++++++++++++----- 6 files changed, 106 insertions(+), 35 deletions(-) diff --git a/src/libs/languageutils/componentversion.cpp b/src/libs/languageutils/componentversion.cpp index 7811bb438ca..4368d5f94f8 100644 --- a/src/libs/languageutils/componentversion.cpp +++ b/src/libs/languageutils/componentversion.cpp @@ -34,9 +34,12 @@ #include +#include + using namespace LanguageUtils; const int ComponentVersion::NoVersion = -1; +const int ComponentVersion::MaxVersion = std::numeric_limits::max(); ComponentVersion::ComponentVersion() : _major(NoVersion), _minor(NoVersion) diff --git a/src/libs/languageutils/componentversion.h b/src/libs/languageutils/componentversion.h index 5f8e413fb66..baa8d4e1878 100644 --- a/src/libs/languageutils/componentversion.h +++ b/src/libs/languageutils/componentversion.h @@ -44,6 +44,7 @@ class LANGUAGEUTILS_EXPORT ComponentVersion public: static const int NoVersion; + static const int MaxVersion; ComponentVersion(); ComponentVersion(int major, int minor); diff --git a/src/libs/qmljs/qmljsdocument.cpp b/src/libs/qmljs/qmljsdocument.cpp index 467c522c74c..2cfeb1d6ee0 100644 --- a/src/libs/qmljs/qmljsdocument.cpp +++ b/src/libs/qmljs/qmljsdocument.cpp @@ -357,14 +357,14 @@ void Document::extractPragmas(QString *source) } } -LibraryInfo::LibraryInfo() - : _valid(false) +LibraryInfo::LibraryInfo(Status status) + : _status(status) , _dumpStatus(DumpNotStartedOrRunning) { } LibraryInfo::LibraryInfo(const QmlDirParser &parser) - : _valid(true) + : _status(Found) , _components(parser.components()) , _plugins(parser.plugins()) , _dumpStatus(DumpNotStartedOrRunning) diff --git a/src/libs/qmljs/qmljsdocument.h b/src/libs/qmljs/qmljsdocument.h index 2c1a516cac9..b1aaadaa32f 100644 --- a/src/libs/qmljs/qmljsdocument.h +++ b/src/libs/qmljs/qmljsdocument.h @@ -127,8 +127,14 @@ public: DumpError }; + enum Status { + NotScanned, + NotFound, + Found + }; + private: - bool _valid; + Status _status; QList _components; QList _plugins; typedef QList FakeMetaObjectList; @@ -138,8 +144,8 @@ private: QString _dumpError; public: - LibraryInfo(); - LibraryInfo(const QmlDirParser &parser); + explicit LibraryInfo(Status status = NotScanned); + explicit LibraryInfo(const QmlDirParser &parser); ~LibraryInfo(); QList components() const @@ -155,7 +161,10 @@ public: { _metaObjects = objects; } bool isValid() const - { return _valid; } + { return _status == Found; } + + bool wasScanned() const + { return _status != NotScanned; } DumpStatus dumpStatus() const { return _dumpStatus; } diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 8f20b447d22..c9c1bb8e926 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -43,8 +43,6 @@ #include #include -#include - using namespace LanguageUtils; using namespace QmlJS; using namespace QmlJS::Interpreter; @@ -276,18 +274,37 @@ ObjectValue *Link::importNonFile(Document::Ptr doc, const ImportInfo &importInfo bool importFound = false; - // check the filesystem const QString &packagePath = importInfo.name(); + // check the filesystem with full version foreach (const QString &importPath, d->importPaths) { - QString libraryPath = importPath; - libraryPath += QDir::separator(); - libraryPath += packagePath; + QString libraryPath = QString("%1/%2.%3").arg(importPath, packagePath, version.toString()); if (importLibrary(doc, import, libraryPath, importInfo, importPath)) { importFound = true; break; } } + if (!importFound) { + // check the filesystem with major version + foreach (const QString &importPath, d->importPaths) { + QString libraryPath = QString("%1/%2.%3").arg(importPath, packagePath, + QString::number(version.majorVersion())); + if (importLibrary(doc, import, libraryPath, importInfo, importPath)) { + importFound = true; + break; + } + } + } + if (!importFound) { + // check the filesystem with no version + foreach (const QString &importPath, d->importPaths) { + QString libraryPath = QString("%1/%2").arg(importPath, packagePath); + if (importLibrary(doc, import, libraryPath, importInfo, importPath)) { + importFound = true; + break; + } + } + } // if there are cpp-based types for this package, use them too if (engine()->cppQmlTypes().hasPackage(packageName)) { @@ -406,8 +423,7 @@ void Link::loadQmldirComponents(Interpreter::ObjectValue *import, ComponentVersi // if the version isn't valid, import the latest if (!version.isValid()) { - const int maxVersion = std::numeric_limits::max(); - version = ComponentVersion(maxVersion, maxVersion); + version = ComponentVersion(ComponentVersion::MaxVersion, ComponentVersion::MaxVersion); } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 08f943e0554..5cb426e2c2e 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -285,7 +285,9 @@ void ModelManager::updateLibraryInfo(const QString &path, const LibraryInfo &inf QMutexLocker locker(&m_mutex); _snapshot.insertLibraryInfo(path, info); } - emit libraryInfoUpdated(path, info); + // only emit if we got new useful information + if (info.isValid()) + emit libraryInfoUpdated(path, info); } static QStringList qmlFilesInDirectory(const QString &path) @@ -356,15 +358,22 @@ static bool findNewQmlLibraryInPath(const QString &path, QSet *newLibraries) { // if we know there is a library, done - if (snapshot.libraryInfo(path).isValid()) + const LibraryInfo &existingInfo = snapshot.libraryInfo(path); + if (existingInfo.isValid()) return true; if (newLibraries->contains(path)) return true; + // if we looked at the path before, done + if (existingInfo.wasScanned()) + return false; const QDir dir(path); QFile qmldirFile(dir.filePath(QLatin1String("qmldir"))); - if (!qmldirFile.exists()) + if (!qmldirFile.exists()) { + LibraryInfo libraryInfo(LibraryInfo::NotFound); + modelManager->updateLibraryInfo(path, libraryInfo); return false; + } #ifdef Q_OS_WIN // QTCREATORBUG-3402 - be case sensitive even here? @@ -380,8 +389,7 @@ static bool findNewQmlLibraryInPath(const QString &path, const QString libraryPath = QFileInfo(qmldirFile).absolutePath(); newLibraries->insert(libraryPath); - modelManager->updateLibraryInfo(libraryPath, - LibraryInfo(qmldirParser)); + modelManager->updateLibraryInfo(libraryPath, LibraryInfo(qmldirParser)); // scan the qml files in the library foreach (const QmlDirParser::Component &component, qmldirParser.components()) { @@ -398,30 +406,62 @@ static bool findNewQmlLibraryInPath(const QString &path, return true; } +static void findNewQmlLibrary( + const QString &path, + const LanguageUtils::ComponentVersion &version, + const Snapshot &snapshot, + ModelManager *modelManager, + QStringList *importedFiles, + QSet *scannedPaths, + QSet *newLibraries) +{ + QString libraryPath = QString("%1.%2.%3").arg( + path, + QString::number(version.majorVersion()), + QString::number(version.minorVersion())); + findNewQmlLibraryInPath( + libraryPath, snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); + + libraryPath = QString("%1.%2").arg( + path, + QString::number(version.majorVersion())); + findNewQmlLibraryInPath( + libraryPath, snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); + + findNewQmlLibraryInPath( + path, snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); +} + static void findNewLibraryImports(const Document::Ptr &doc, const Snapshot &snapshot, ModelManager *modelManager, QStringList *importedFiles, QSet *scannedPaths, QSet *newLibraries) { - // scan library imports + // scan current dir + findNewQmlLibraryInPath(doc->path(), snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); + + // scan dir and lib imports const QStringList importPaths = modelManager->importPaths(); foreach (const Interpreter::ImportInfo &import, doc->bind()->imports()) { - if (import.type() == Interpreter::ImportInfo::LibraryImport) { - foreach (const QString &importPath, importPaths) { - const QString targetPath = QDir(importPath).filePath(import.name()); - - if (findNewQmlLibraryInPath(targetPath, snapshot, modelManager, - importedFiles, scannedPaths, newLibraries)) - break; - } - } else if (import.type() == Interpreter::ImportInfo::DirectoryImport) { + if (import.type() == Interpreter::ImportInfo::DirectoryImport) { const QString targetPath = import.name(); findNewQmlLibraryInPath(targetPath, snapshot, modelManager, importedFiles, scannedPaths, newLibraries); } - } - findNewQmlLibraryInPath(doc->path(), snapshot, modelManager, - importedFiles, scannedPaths, newLibraries); + if (import.type() == Interpreter::ImportInfo::LibraryImport) { + if (!import.version().isValid()) + continue; + foreach (const QString &importPath, importPaths) { + const QString targetPath = QDir(importPath).filePath(import.name()); + findNewQmlLibrary(targetPath, import.version(), snapshot, modelManager, + importedFiles, scannedPaths, newLibraries); + } + } + } } static bool suffixMatches(const QString &fileName, const Core::MimeType &mimeType) @@ -451,8 +491,6 @@ void ModelManager::parse(QFutureInterface &future, int progressRange = files.size(); future.setProgressRange(0, progressRange); - Snapshot snapshot = modelManager->_snapshot; - // paths we have scanned for files and added to the files list QSet scannedPaths; // libraries we've found while scanning imports @@ -499,6 +537,10 @@ void ModelManager::parse(QFutureInterface &future, doc->setSource(contents); doc->parse(); + // update snapshot. requires synchronization, but significantly reduces amount of file + // system queries for library imports because queries are cached in libraryInfo + const Snapshot snapshot = modelManager->snapshot(); + // get list of referenced files not yet in snapshot or in directories already scanned QStringList importedFiles; findNewImplicitImports(doc, snapshot, &importedFiles, &scannedPaths); From 918a1653da02f712d56bc56c38d235bbf0c41204 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 20 Apr 2011 10:46:04 +0200 Subject: [PATCH 03/28] QmlJS: Fix library-by-path imports. Fixes the problem 5426c3ac2cdf898ca1190a7746ba506ff24abc50 and 7b25f438c67c7cf395ccd2cd846e5d413f6d9222 worked around. Reviewed-by: Erik Verbruggen (cherry picked from commit e21311132ba3fa8cf0d8ade81117f988da8363e9) Change-Id: I5426c3ac2cdf898ca1190a7746ba506ff24abc50xx Reviewed-on: http://codereview.qt.nokia.com/381 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/libs/qmljs/qmljsinterpreter.cpp | 91 +++++++++++++++++--- src/libs/qmljs/qmljsinterpreter.h | 13 ++- src/libs/qmljs/qmljslink.cpp | 21 ----- src/plugins/qmljstools/qmljsplugindumper.cpp | 1 - 4 files changed, 87 insertions(+), 39 deletions(-) diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 51388b6c996..a060fd1c0b6 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -2029,12 +2029,15 @@ template QList CppQmlTypes::load(Engine *engine, const T &objects) { // load + QList loadedObjects; QList newObjects; foreach (FakeMetaObject::ConstPtr metaObject, objects) { foreach (const FakeMetaObject::Export &exp, metaObject->exports()) { - QmlObjectValue *newObject = makeObject(engine, metaObject, exp); - if (newObject) - newObjects += newObject; + bool wasCreated; + QmlObjectValue *loadedObject = getOrCreate(engine, metaObject, exp, &wasCreated); + loadedObjects += loadedObject; + if (wasCreated) + newObjects += loadedObject; } } @@ -2043,7 +2046,7 @@ QList CppQmlTypes::load(Engine *engine, const T &objects) setPrototypes(object); } - return newObjects; + return loadedObjects; } // explicitly instantiate load for list and hash template QList CppQmlTypes::load< QList >(Engine *, const QList &); @@ -2101,19 +2104,26 @@ QmlObjectValue *CppQmlTypes::typeByQualifiedName(const QString &package, const Q return typeByQualifiedName(qualifiedName(package, type, version)); } -QmlObjectValue *CppQmlTypes::makeObject( +QmlObjectValue *CppQmlTypes::getOrCreate( Engine *engine, FakeMetaObject::ConstPtr metaObject, - const LanguageUtils::FakeMetaObject::Export &exp) + const LanguageUtils::FakeMetaObject::Export &exp, + bool *wasCreated) { // make sure we're not loading duplicate objects - if (_typesByFullyQualifiedName.contains(exp.packageNameVersion)) - return 0; + if (QmlObjectValue *existing = _typesByFullyQualifiedName.value(exp.packageNameVersion)) { + if (wasCreated) + *wasCreated = false; + return existing; + } QmlObjectValue *objectValue = new QmlObjectValue( metaObject, exp.type, exp.package, exp.version, engine); _typesByPackage[exp.package].append(objectValue); _typesByFullyQualifiedName[exp.packageNameVersion] = objectValue; + + if (wasCreated) + *wasCreated = true; return objectValue; } @@ -2141,7 +2151,7 @@ void CppQmlTypes::setPrototypes(QmlObjectValue *object) // needs to create Positioner (Qt) and Positioner (QtQuick) QmlObjectValue *v = object; while (!v->prototype() && !fmo->superclassName().isEmpty()) { - QmlObjectValue *superValue = getOrCreate(targetPackage, fmo->superclassName()); + QmlObjectValue *superValue = getOrCreateForPackage(targetPackage, fmo->superclassName()); if (!superValue) return; v->setPrototype(superValue); @@ -2150,7 +2160,7 @@ void CppQmlTypes::setPrototypes(QmlObjectValue *object) } } -QmlObjectValue *CppQmlTypes::getOrCreate(const QString &package, const QString &cppName) +QmlObjectValue *CppQmlTypes::getOrCreateForPackage(const QString &package, const QString &cppName) { // first get the cpp object value QmlObjectValue *cppObject = typeByCppName(cppName); @@ -2164,10 +2174,9 @@ QmlObjectValue *CppQmlTypes::getOrCreate(const QString &package, const QString & FakeMetaObject::Export exp = metaObject->exportInPackage(package); QmlObjectValue *object = 0; if (exp.isValid()) { - object = typeByQualifiedName(exp.packageNameVersion); - if (!object) - object = makeObject(cppObject->engine(), metaObject, exp); + object = getOrCreate(cppObject->engine(), metaObject, exp); } else { + // make a convenience object that does not get added to _typesByPackage const QString qname = qualifiedName(package, cppName, ComponentVersion()); object = typeByQualifiedName(qname); if (!object) { @@ -3443,3 +3452,59 @@ ImportInfo TypeEnvironment::importInfo(const QString &name, const Context *conte } return ImportInfo(); } + +#ifdef QT_DEBUG + +class MemberDumper: public MemberProcessor +{ +public: + MemberDumper() {} + + virtual bool processProperty(const QString &name, const Value *) + { + qDebug() << "property: " << name; + return true; + } + + virtual bool processEnumerator(const QString &name, const Value *) + { + qDebug() << "enumerator: " << name; + return true; + } + + virtual bool processSignal(const QString &name, const Value *) + { + qDebug() << "signal: " << name; + return true; + } + + virtual bool processSlot(const QString &name, const Value *) + { + qDebug() << "slot: " << name; + return true; + } + + virtual bool processGeneratedSlot(const QString &name, const Value *) + { + qDebug() << "generated slot: " << name; + return true; + } +}; + +void TypeEnvironment::dump() const +{ + qDebug() << "Type environment contents, in search order:"; + QListIterator it(_imports); + it.toBack(); + while (it.hasPrevious()) { + const Import &i = it.previous(); + const ObjectValue *import = i.object; + const ImportInfo &info = i.info; + + qDebug() << " " << info.name() << " " << info.version().toString() << " as " << info.id() << " : " << import; + MemberDumper dumper; + import->processMembers(&dumper); + } +} + +#endif diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 636cc955239..a14158678b4 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -633,11 +633,12 @@ public: LanguageUtils::ComponentVersion version) const; private: - QmlObjectValue *makeObject(Engine *engine, - LanguageUtils::FakeMetaObject::ConstPtr metaObject, - const LanguageUtils::FakeMetaObject::Export &exp); void setPrototypes(QmlObjectValue *object); - QmlObjectValue *getOrCreate(const QString &package, const QString &cppName); + QmlObjectValue *getOrCreate(Engine *engine, + LanguageUtils::FakeMetaObject::ConstPtr metaObject, + const LanguageUtils::FakeMetaObject::Export &exp, + bool *wasCreated = 0); + QmlObjectValue *getOrCreateForPackage(const QString &package, const QString &cppName); QHash > _typesByPackage; @@ -1036,6 +1037,10 @@ public: void addImport(const ObjectValue *import, const ImportInfo &info); ImportInfo importInfo(const QString &name, const Context *context) const; + +#ifdef QT_DEBUG + void dump() const; +#endif }; } } // namespace QmlJS::Interpreter diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index c9c1bb8e926..c6cf2e7e8ba 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -181,27 +181,6 @@ void Link::populateImportedTypes(TypeEnvironment *typeEnv, Document::Ptr doc) foreach (const ImportInfo &info, doc->bind()->imports()) { ObjectValue *import = d->importCache.value(ImportCacheKey(info)); - //### Hack: if this document is in a library, and if there is an qmldir file in the same directory, and if the prefix is an import-path, the import means to import everything in this library. - if (info.ast() && info.ast()->fileName && info.ast()->fileName->asString() == QLatin1String(".")) { - const QString importInfoName(info.name()); - if (QFileInfo(QDir(importInfoName), QLatin1String("qmldir")).exists()) { - foreach (const QString &importPath, d->importPaths) { - if (importInfoName.startsWith(importPath)) { - // Got it. - - const QString cleanPath = QFileInfo(importInfoName).canonicalFilePath(); - const QString forcedPackageName = cleanPath.mid(importPath.size() + 1).replace('/', '.').replace('\\', '.'); - import = importNonFile(doc, info, forcedPackageName); - if (import) - d->importCache.insert(ImportCacheKey(info), import); - - break; - } - } - } - } - //### End of hack. - if (!import) { switch (info.type()) { case ImportInfo::FileImport: diff --git a/src/plugins/qmljstools/qmljsplugindumper.cpp b/src/plugins/qmljstools/qmljsplugindumper.cpp index 8e1c5f2113b..07cea32863f 100644 --- a/src/plugins/qmljstools/qmljsplugindumper.cpp +++ b/src/plugins/qmljstools/qmljsplugindumper.cpp @@ -274,7 +274,6 @@ void PluginDumper::dump(const Plugin &plugin) connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int))); connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(qmlPluginTypeDumpError(QProcess::ProcessError))); QStringList args; - args << QLatin1String("--notrelocatable"); if (plugin.importUri.isEmpty()) { args << QLatin1String("--path"); args << plugin.importPath; From aee9a55a819971bc9bcddedf8b2c3b489ed9e61d Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 8 Jun 2011 12:58:46 +0200 Subject: [PATCH 04/28] QmlJS: Fix missing rehighlight if other file changes. When QML modules with many source files were loaded, the rehighlight from the found library was done before the files contained in the library were done parsing. This way any updated document will eventually lead to the current editor rehighlighting. Reviewed-by: Erik Verbruggen Change-Id: I0f4d18390d3e0ee17cd255c68496f61479f82f05x Reviewed-on: http://codereview.qt.nokia.com/382 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/plugins/qmljseditor/qmljseditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 4261431953b..f2eba64f426 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -635,7 +635,7 @@ QmlJSTextEditorWidget::QmlJSTextEditorWidget(QWidget *parent) : m_semanticRehighlightTimer = new QTimer(this); m_semanticRehighlightTimer->setInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL); m_semanticRehighlightTimer->setSingleShot(true); - connect(m_semanticRehighlightTimer, SIGNAL(timeout()), this, SLOT(forceSemanticRehighlight())); + connect(m_semanticRehighlightTimer, SIGNAL(timeout()), this, SLOT(forceSemanticRehighlightIfCurrentEditor())); connect(this, SIGNAL(textChanged()), this, SLOT(updateDocument())); @@ -808,6 +808,9 @@ void QmlJSTextEditorWidget::onDocumentUpdated(QmlJS::Document::Ptr doc) { if (file()->fileName() != doc->fileName() || doc->editorRevision() != document()->revision()) { + // maybe a dependency changed: schedule a potential rehighlight + // will not rehighlight if the current editor changes away from this file + m_semanticRehighlightTimer->start(); return; } From 1a5df408836875a7f867411145a377d9a7bc9b16 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 6 Jun 2011 13:25:52 +0200 Subject: [PATCH 05/28] debugger: allow "Attach to Core" on Windows Patch by Orgad Shaneh Task-number: QTCREATORBUG-3813 Change-Id: I7ff88946981ef210bb53e20d7e462055199a30e2x Reviewed-on: http://codereview.qt.nokia.com/388 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index a7044a4ac98..069a1dd6c46 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1896,11 +1896,7 @@ void DebuggerPluginPrivate::setInitialState() m_startExternalAction->setEnabled(true); m_attachExternalAction->setEnabled(true); -#ifdef Q_OS_WIN - m_attachCoreAction->setEnabled(false); -#else m_attachCoreAction->setEnabled(true); -#endif m_startRemoteAction->setEnabled(true); m_detachAction->setEnabled(false); From 87c515d1a39a886b75fb5a4a0263449b152e830f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 17 May 2011 16:47:10 +0200 Subject: [PATCH 06/28] debugger: show something when editing (cherry picked from commit 752066d0431566447220958945bebd9ba81bed66) Change-Id: If24dfee05b8039b1f091e8f88e8d59155f2bd7dx Reviewed-on: http://codereview.qt.nokia.com/389 Reviewed-by: hjk --- src/plugins/debugger/watchhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index ea135f2216f..996cee7ccfb 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -441,7 +441,7 @@ static inline QVariant editValue(const WatchData &d) break; } // Replace newlines, which will cause line edit troubles. - QString stringValue; + QString stringValue = d.value; stringValue.replace(QLatin1String("\n"), QLatin1String("\\n")); return QVariant(stringValue); } From a3137a031aabe376624823083c2d2667e02cd8c0 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 12 May 2011 13:25:03 +0200 Subject: [PATCH 07/28] add some mimetype for geometry shaders This gives at least some syntax highlighting. (cherry picked from commit 04c5425de2292c9da66c7c1dd2ae0c646528ca07) Change-Id: I04c5425de2292c9da66c7c1dd2ae0c646528ca07x Reviewed-on: http://codereview.qt.nokia.com/390 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/plugins/glsleditor/GLSLEditor.mimetypes.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/glsleditor/GLSLEditor.mimetypes.xml b/src/plugins/glsleditor/GLSLEditor.mimetypes.xml index 9d2eb6c7db3..8f4570980a4 100644 --- a/src/plugins/glsleditor/GLSLEditor.mimetypes.xml +++ b/src/plugins/glsleditor/GLSLEditor.mimetypes.xml @@ -33,4 +33,10 @@ + + + GLSL/ES Geometry Shader file + + + From 07c1609c0c58fb4c60c3a6ad2e34ed6010b6ff31 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 11 May 2011 14:41:38 +0200 Subject: [PATCH 08/28] cppeditor: fix crash on uninitialized pointer Reviewed-by: Erik Verbruggen (cherry picked from commit 769b21b49d4072e426ac82271ba7797461ef86d3) Change-Id: I769b21b49d4072e426ac82271ba7797461ef86d3x Reviewed-on: http://codereview.qt.nokia.com/391 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/plugins/cppeditor/cppquickfixes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 85ebca29bf0..2bafa42d795 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -138,7 +138,7 @@ private: public: Operation(const CppQuickFixState &state, int priority, BinaryExpressionAST *binary, Kind invertToken) : CppQuickFixOperation(state, priority) - , binary(binary) + , binary(binary), nested(0), negation(0) { Token tok; tok.f.kind = invertToken; From 2cf06b8285152e59f80a55bc99ce3fbe93f494c5 Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Tue, 31 May 2011 15:49:14 +0200 Subject: [PATCH 09/28] CMake editor: Use keywords scheme for functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Link color from inkpot still needs to be changed. This will be done in a following commit. Task-number: QTCREATORBUG-5037 Change-Id: Ia8a5203067761ff6622258fd16f2027667637583x Reviewed-on: http://codereview.qt.nokia.com/273 Reviewed-by: Thorbjørn Lindeijer (cherry picked from commit a3daedc7b70a9e4f4db1db38add119741179dbed) Reviewed-on: http://codereview.qt.nokia.com/392 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- src/plugins/cmakeprojectmanager/cmakeeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 67beed67234..570bfb84ef3 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -110,7 +110,7 @@ void CMakeEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) static QVector categories; if (categories.isEmpty()) { categories << QLatin1String(TextEditor::Constants::C_LABEL) // variables - << QLatin1String(TextEditor::Constants::C_LINK) // functions + << QLatin1String(TextEditor::Constants::C_KEYWORD) // functions << QLatin1String(TextEditor::Constants::C_COMMENT) << QLatin1String(TextEditor::Constants::C_STRING) << QLatin1String(TextEditor::Constants::C_VISUAL_WHITESPACE); From 1bc927591778419ce75859ae4200d24c654dd23a Mon Sep 17 00:00:00 2001 From: Leandro Melo Date: Tue, 31 May 2011 15:52:52 +0200 Subject: [PATCH 10/28] Editors: Change Link color from inkpot scheme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In addition for the report below, the cmake highlighter now uses the keyword color for functions. This was done in the previous commit: 5ecd885af3d25acfd8f688428268da2d9198a1bd Task-number: QTCREATORBUG-5037 Change-Id: I7cdf11d0b13cdf7fbd6fac9bfbe715944c57c5a2x Reviewed-on: http://codereview.qt.nokia.com/274 Reviewed-by: Thorbjørn Lindeijer (cherry picked from commit c09c870248e9df5aadf40ae88f6cbd240e57473f) Reviewed-on: http://codereview.qt.nokia.com/393 Reviewed-by: Qt Sanity Bot Reviewed-by: hjk --- share/qtcreator/styles/inkpot.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/styles/inkpot.xml b/share/qtcreator/styles/inkpot.xml index 3634cca394b..f4e61475917 100644 --- a/share/qtcreator/styles/inkpot.xml +++ b/share/qtcreator/styles/inkpot.xml @@ -22,7 +22,7 @@