forked from qt-creator/qt-creator
Revert "qmljs: better defaults, more uniform handling of paths"
moving to master This reverts commit 0c46692244def9edb89c2914b9b1e5eff10cb6ce Change-Id: Ie09f6db02058f4a5539221f1a0cc4f9225f38300 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -38,7 +38,6 @@
|
|||||||
#include <cplusplus/cppmodelmanagerbase.h>
|
#include <cplusplus/cppmodelmanagerbase.h>
|
||||||
#include <utils/function.h>
|
#include <utils/function.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/runextensions.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -50,7 +49,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtAlgorithms>
|
#include <QtAlgorithms>
|
||||||
#include <QLibraryInfo>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -371,32 +370,6 @@ bool pInfoLessThanAll(const ModelManagerInterface::ProjectInfo &p1, const ModelM
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pInfoLessThanImports(const ModelManagerInterface::ProjectInfo &p1, const ModelManagerInterface::ProjectInfo &p2)
|
|
||||||
{
|
|
||||||
if (p1.qtQmlPath < p2.qtQmlPath)
|
|
||||||
return true;
|
|
||||||
if (p1.qtQmlPath > p2.qtQmlPath)
|
|
||||||
return false;
|
|
||||||
if (p1.qtImportsPath < p2.qtImportsPath)
|
|
||||||
return true;
|
|
||||||
if (p1.qtImportsPath > p2.qtImportsPath)
|
|
||||||
return false;
|
|
||||||
QStringList s1 = p1.importPaths;
|
|
||||||
QStringList s2 = p2.importPaths;
|
|
||||||
if (s1.size() < s2.size())
|
|
||||||
return true;
|
|
||||||
if (s1.size() > s2.size())
|
|
||||||
return false;
|
|
||||||
for (int i = 0; i < s1.size(); ++i) {
|
|
||||||
if (s1.at(i) < s2.at(i))
|
|
||||||
return true;
|
|
||||||
else if (s1.at(i) > s2.at(i))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ModelManagerInterface::filesAtQrcPath(const QString &path, const QLocale *locale,
|
QStringList ModelManagerInterface::filesAtQrcPath(const QString &path, const QLocale *locale,
|
||||||
@@ -566,32 +539,14 @@ void ModelManagerInterface::removeProjectInfo(ProjectExplorer::Project *project)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QString path) const
|
ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(QString path)
|
||||||
{
|
{
|
||||||
QList<ProjectExplorer::Project *> projects;
|
QMutexLocker locker(&m_mutex);
|
||||||
{
|
|
||||||
QMutexLocker locker(&m_mutex);
|
|
||||||
projects = m_fileToProject.values(path);
|
|
||||||
}
|
|
||||||
QList<ProjectInfo> infos;
|
|
||||||
foreach (ProjectExplorer::Project *project, projects) {
|
|
||||||
ProjectInfo info = projectInfo(project);
|
|
||||||
if (info.isValid())
|
|
||||||
infos.append(info);
|
|
||||||
}
|
|
||||||
std::sort(infos.begin(), infos.end(), &pInfoLessThanImports);
|
|
||||||
|
|
||||||
ProjectInfo res;
|
foreach (const ProjectInfo &p, m_projects)
|
||||||
foreach (const ProjectInfo &pInfo, infos) {
|
if (p.sourceFiles.contains(path))
|
||||||
if (res.qtImportsPath.isEmpty())
|
return p;
|
||||||
res.qtImportsPath = pInfo.qtImportsPath;
|
return ProjectInfo();
|
||||||
if (res.qtQmlPath.isEmpty())
|
|
||||||
res.qtQmlPath = pInfo.qtQmlPath;
|
|
||||||
foreach (const QString &path, pInfo.importPaths)
|
|
||||||
if (res.importPaths.contains(path))
|
|
||||||
res.importPaths.append(path);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerInterface::emitDocumentChangedOnDisk(Document::Ptr doc)
|
void ModelManagerInterface::emitDocumentChangedOnDisk(Document::Ptr doc)
|
||||||
@@ -1056,26 +1011,21 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
QStringList allImportPaths;
|
QStringList allImportPaths;
|
||||||
QmlLanguageBundles activeBundles;
|
QmlLanguageBundles activeBundles;
|
||||||
QmlLanguageBundles extendedBundles;
|
QmlLanguageBundles extendedBundles;
|
||||||
QMapIterator<ProjectExplorer::Project *, ProjectInfo> pInfoIter(m_projects);
|
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(m_projects);
|
||||||
QHashIterator<Language::Enum, QmlJS::ViewerContext> vCtxsIter = m_defaultVContexts;
|
while (it.hasNext()) {
|
||||||
while (pInfoIter.hasNext()) {
|
it.next();
|
||||||
pInfoIter.next();
|
foreach (const QString &path, it.value().importPaths) {
|
||||||
foreach (const QString &path, pInfoIter.value().importPaths) {
|
|
||||||
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
||||||
if (!canonicalPath.isEmpty())
|
if (!canonicalPath.isEmpty())
|
||||||
allImportPaths += canonicalPath;
|
allImportPaths += canonicalPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (vCtxsIter.hasNext()) {
|
it.toFront();
|
||||||
vCtxsIter.next();
|
while (it.hasNext()) {
|
||||||
allImportPaths << vCtxsIter.value().paths;
|
it.next();
|
||||||
}
|
activeBundles.mergeLanguageBundles(it.value().activeBundle);
|
||||||
pInfoIter.toFront();
|
foreach (Language::Enum l, it.value().activeBundle.languages()) {
|
||||||
while (pInfoIter.hasNext()) {
|
foreach (const QString &path, it.value().activeBundle.bundleForLanguage(l)
|
||||||
pInfoIter.next();
|
|
||||||
activeBundles.mergeLanguageBundles(pInfoIter.value().activeBundle);
|
|
||||||
foreach (Language::Enum l, pInfoIter.value().activeBundle.languages()) {
|
|
||||||
foreach (const QString &path, pInfoIter.value().activeBundle.bundleForLanguage(l)
|
|
||||||
.searchPaths().stringList()) {
|
.searchPaths().stringList()) {
|
||||||
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
||||||
if (!canonicalPath.isEmpty())
|
if (!canonicalPath.isEmpty())
|
||||||
@@ -1083,33 +1033,18 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pInfoIter.toFront();
|
it.toFront();
|
||||||
while (pInfoIter.hasNext()) {
|
while (it.hasNext()) {
|
||||||
pInfoIter.next();
|
it.next();
|
||||||
QString pathAtt = pInfoIter.value().qtQmlPath;
|
extendedBundles.mergeLanguageBundles(it.value().extendedBundle);
|
||||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
foreach (Language::Enum l, it.value().extendedBundle.languages()) {
|
||||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
foreach (const QString &path, it.value().extendedBundle.bundleForLanguage(l)
|
||||||
allImportPaths.append(pathAtt);
|
.searchPaths().stringList()) {
|
||||||
}
|
const QString canonicalPath = QFileInfo(path).canonicalFilePath();
|
||||||
{
|
if (!canonicalPath.isEmpty())
|
||||||
QString pathAtt = defaultProjectInfo().qtQmlPath;
|
allImportPaths += canonicalPath;
|
||||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
}
|
||||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
}
|
||||||
allImportPaths.append(pathAtt);
|
|
||||||
}
|
|
||||||
pInfoIter.toFront();
|
|
||||||
while (pInfoIter.hasNext()) {
|
|
||||||
pInfoIter.next();
|
|
||||||
QString pathAtt = pInfoIter.value().qtImportsPath;
|
|
||||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
|
||||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
|
||||||
allImportPaths.append(pathAtt);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
QString pathAtt = defaultProjectInfo().qtImportsPath;
|
|
||||||
if (!pathAtt.isEmpty() && allImportPaths.size() > 0
|
|
||||||
&& allImportPaths.value(allImportPaths.size()) != pathAtt)
|
|
||||||
allImportPaths.append(pathAtt);
|
|
||||||
}
|
}
|
||||||
allImportPaths += m_defaultImportPaths;
|
allImportPaths += m_defaultImportPaths;
|
||||||
allImportPaths.removeDuplicates();
|
allImportPaths.removeDuplicates();
|
||||||
@@ -1137,6 +1072,13 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
maybeScan(allImportPaths, Language::Qml);
|
maybeScan(allImportPaths, Language::Qml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfo() const
|
||||||
|
{
|
||||||
|
if (m_projects.isEmpty())
|
||||||
|
return ProjectInfo();
|
||||||
|
return m_projects.begin().value();
|
||||||
|
}
|
||||||
|
|
||||||
void ModelManagerInterface::loadPluginTypes(const QString &libraryPath, const QString &importPath,
|
void ModelManagerInterface::loadPluginTypes(const QString &libraryPath, const QString &importPath,
|
||||||
const QString &importUri, const QString &importVersion)
|
const QString &importUri, const QString &importVersion)
|
||||||
{
|
{
|
||||||
@@ -1251,124 +1193,54 @@ ModelManagerInterface::CppDataHash ModelManagerInterface::cppData() const
|
|||||||
|
|
||||||
LibraryInfo ModelManagerInterface::builtins(const Document::Ptr &doc) const
|
LibraryInfo ModelManagerInterface::builtins(const Document::Ptr &doc) const
|
||||||
{
|
{
|
||||||
ProjectInfo info = projectInfoForPath(doc->path());
|
QList<ProjectExplorer::Project *> projects = m_fileToProject.values(doc->fileName());
|
||||||
|
|
||||||
|
ProjectExplorer::Project *project = 0;
|
||||||
|
foreach (ProjectExplorer::Project *p, projects) {
|
||||||
|
if (p) {
|
||||||
|
project = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!project)
|
||||||
|
return LibraryInfo();
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_mutex);
|
||||||
|
ProjectInfo info = m_projects.value(project);
|
||||||
if (!info.isValid())
|
if (!info.isValid())
|
||||||
return LibraryInfo();
|
return LibraryInfo();
|
||||||
|
|
||||||
return m_validSnapshot.libraryInfo(info.qtImportsPath);
|
return m_validSnapshot.libraryInfo(info.qtImportsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
|
ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx,
|
||||||
const Document::Ptr &doc) const
|
const Document::Ptr &doc) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(doc);
|
||||||
ViewerContext res = vCtx;
|
ViewerContext res = vCtx;
|
||||||
|
|
||||||
if (vCtx.language == Language::Qml && !doc.isNull() &&
|
|
||||||
(doc->language() == Language::QmlQtQuick1 || doc->language() == Language::QmlQtQuick2))
|
|
||||||
res.language = doc->language();
|
|
||||||
ProjectInfo info;
|
|
||||||
if (!doc.isNull())
|
|
||||||
info = projectInfoForPath(doc->path());
|
|
||||||
ViewerContext defaultVCtx = defaultVContext(res.language, Document::Ptr(0), false);
|
|
||||||
ProjectInfo defaultInfo = defaultProjectInfo();
|
|
||||||
if (info.qtImportsPath.isEmpty())
|
|
||||||
info.qtImportsPath = defaultInfo.qtImportsPath;
|
|
||||||
if (info.qtQmlPath.isEmpty())
|
|
||||||
info.qtQmlPath = defaultInfo.qtQmlPath;
|
|
||||||
switch (res.flags) {
|
switch (res.flags) {
|
||||||
case ViewerContext::Complete:
|
case ViewerContext::Complete:
|
||||||
break;
|
break;
|
||||||
case ViewerContext::AddAllPathsAndDefaultSelectors:
|
case ViewerContext::AddQtPath:
|
||||||
res.selectors.append(defaultVCtx.selectors);
|
|
||||||
// fallthrough
|
|
||||||
case ViewerContext::AddAllPaths:
|
case ViewerContext::AddAllPaths:
|
||||||
{
|
res.paths << importPaths();
|
||||||
foreach (const QString &path, defaultVCtx.paths)
|
|
||||||
res.maybeAddPath(path);
|
|
||||||
switch (res.language) {
|
|
||||||
case Language::Unknown:
|
|
||||||
case Language::Qml:
|
|
||||||
res.maybeAddPath(info.qtQmlPath);
|
|
||||||
// fallthrough
|
|
||||||
case Language::QmlQtQuick1:
|
|
||||||
res.maybeAddPath(info.qtImportsPath);
|
|
||||||
// fallthrough
|
|
||||||
case Language::QmlQtQuick2:
|
|
||||||
{
|
|
||||||
if (res.language == Language::QmlQtQuick2)
|
|
||||||
res.maybeAddPath(info.qtQmlPath);
|
|
||||||
QList<ProjectInfo> allProjects;
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&m_mutex);
|
|
||||||
allProjects = m_projects.values();
|
|
||||||
}
|
|
||||||
std::sort(allProjects.begin(), allProjects.end(), &pInfoLessThanImports);
|
|
||||||
foreach (const ProjectInfo &pInfo, allProjects) {
|
|
||||||
foreach (const QString &path, pInfo.importPaths)
|
|
||||||
res.maybeAddPath(path);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Language::JavaScript:
|
|
||||||
case Language::QmlTypeInfo:
|
|
||||||
case Language::Json:
|
|
||||||
case Language::QmlQbs:
|
|
||||||
case Language::QmlProject:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ViewerContext::AddDefaultPathsAndSelectors:
|
|
||||||
res.selectors.append(defaultVCtx.selectors);
|
|
||||||
// fallthrough
|
|
||||||
case ViewerContext::AddDefaultPaths:
|
|
||||||
foreach (const QString &path, defaultVCtx.paths)
|
|
||||||
res.maybeAddPath(path);
|
|
||||||
if (res.language == Language::Unknown || res.language == Language::Qml
|
|
||||||
|| res.language == Language::QmlQtQuick2)
|
|
||||||
res.maybeAddPath(info.qtImportsPath);
|
|
||||||
if (res.language == Language::Unknown || res.language == Language::Qml
|
|
||||||
|| res.language == Language::QmlQtQuick1)
|
|
||||||
res.maybeAddPath(info.qtQmlPath);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
res.flags = ViewerContext::Complete;
|
res.flags = ViewerContext::Complete;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewerContext ModelManagerInterface::defaultVContext(Language::Enum language,
|
ViewerContext ModelManagerInterface::defaultVContext(bool autoComplete, const Document::Ptr &doc) const
|
||||||
const Document::Ptr &doc,
|
|
||||||
bool autoComplete) const
|
|
||||||
{
|
{
|
||||||
if (!doc.isNull()) {
|
|
||||||
if (language == Language::Unknown)
|
|
||||||
language = doc->language();
|
|
||||||
else if (language == Language::Qml &&
|
|
||||||
(doc->language() == Language::QmlQtQuick1 || doc->language() == Language::QmlQtQuick2))
|
|
||||||
language = doc->language();
|
|
||||||
}
|
|
||||||
ViewerContext defaultCtx;
|
|
||||||
{
|
|
||||||
QMutexLocker locker(&m_mutex);
|
|
||||||
defaultCtx = m_defaultVContexts.value(language);
|
|
||||||
}
|
|
||||||
if (autoComplete)
|
if (autoComplete)
|
||||||
return completeVContext(defaultCtx, doc);
|
return completeVContext(m_vContext, doc);
|
||||||
else
|
else
|
||||||
return defaultCtx;
|
return m_vContext;
|
||||||
}
|
|
||||||
|
|
||||||
ModelManagerInterface::ProjectInfo ModelManagerInterface::defaultProjectInfo() const
|
|
||||||
{
|
|
||||||
ProjectInfo res;
|
|
||||||
res.qtImportsPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
|
|
||||||
res.qtQmlPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerInterface::setDefaultVContext(const ViewerContext &vContext)
|
void ModelManagerInterface::setDefaultVContext(const ViewerContext &vContext)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
m_vContext = vContext;
|
||||||
m_defaultVContexts[vContext.language] = vContext;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerInterface::joinAllThreads()
|
void ModelManagerInterface::joinAllThreads()
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public:
|
|||||||
void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info);
|
void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info);
|
||||||
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
|
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
|
||||||
void updateQrcFile(const QString &path);
|
void updateQrcFile(const QString &path);
|
||||||
ProjectInfo projectInfoForPath(QString path) const;
|
ProjectInfo projectInfoForPath(QString path);
|
||||||
|
|
||||||
QStringList importPaths() const;
|
QStringList importPaths() const;
|
||||||
QmlJS::QmlLanguageBundles activeBundles() const;
|
QmlJS::QmlLanguageBundles activeBundles() const;
|
||||||
@@ -189,16 +189,17 @@ public:
|
|||||||
|
|
||||||
CppDataHash cppData() const;
|
CppDataHash cppData() const;
|
||||||
LibraryInfo builtins(const Document::Ptr &doc) const;
|
LibraryInfo builtins(const Document::Ptr &doc) const;
|
||||||
ViewerContext completeVContext(const ViewerContext &vCtx,
|
virtual ViewerContext completeVContext(const ViewerContext &vCtx,
|
||||||
const Document::Ptr &doc = Document::Ptr(0)) const;
|
const Document::Ptr &doc = Document::Ptr(0)) const;
|
||||||
ViewerContext defaultVContext(Language::Enum language = Language::Qml,
|
virtual ViewerContext defaultVContext(bool autoComplete = true,
|
||||||
const Document::Ptr &doc = Document::Ptr(0),
|
const Document::Ptr &doc = Document::Ptr(0)) const;
|
||||||
bool autoComplete = true) const;
|
virtual void setDefaultVContext(const ViewerContext &vContext);
|
||||||
void setDefaultVContext(const ViewerContext &vContext);
|
|
||||||
virtual ProjectInfo defaultProjectInfo() const;
|
|
||||||
|
|
||||||
// Blocks until all parsing threads are done. Used for testing.
|
// Blocks until all parsing threads are done. Used for testing.
|
||||||
void joinAllThreads();
|
void joinAllThreads();
|
||||||
|
|
||||||
|
virtual ModelManagerInterface::ProjectInfo defaultProjectInfo() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void resetCodeModel();
|
virtual void resetCodeModel();
|
||||||
void removeProjectInfo(ProjectExplorer::Project *project);
|
void removeProjectInfo(ProjectExplorer::Project *project);
|
||||||
@@ -256,7 +257,7 @@ private:
|
|||||||
QStringList m_defaultImportPaths;
|
QStringList m_defaultImportPaths;
|
||||||
QmlJS::QmlLanguageBundles m_activeBundles;
|
QmlJS::QmlLanguageBundles m_activeBundles;
|
||||||
QmlJS::QmlLanguageBundles m_extendedBundles;
|
QmlJS::QmlLanguageBundles m_extendedBundles;
|
||||||
QHash<Language::Enum, QmlJS::ViewerContext> m_defaultVContexts;
|
QmlJS::ViewerContext m_vContext;
|
||||||
bool m_shouldScanImports;
|
bool m_shouldScanImports;
|
||||||
QSet<QString> m_scannedPaths;
|
QSet<QString> m_scannedPaths;
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,4 @@ bool ViewerContext::languageIsCompatible(Language::Enum l) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewerContext::maybeAddPath(const QString &path)
|
|
||||||
{
|
|
||||||
if (!path.isEmpty() && !paths.contains(path))
|
|
||||||
paths.append(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace QmlJS
|
} // namespace QmlJS
|
||||||
|
|||||||
@@ -42,10 +42,8 @@ class QMLJS_EXPORT ViewerContext
|
|||||||
public:
|
public:
|
||||||
enum Flags {
|
enum Flags {
|
||||||
Complete,
|
Complete,
|
||||||
AddAllPathsAndDefaultSelectors,
|
|
||||||
AddAllPaths,
|
AddAllPaths,
|
||||||
AddDefaultPaths,
|
AddQtPath
|
||||||
AddDefaultPathsAndSelectors
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ViewerContext();
|
ViewerContext();
|
||||||
@@ -54,7 +52,6 @@ public:
|
|||||||
Flags flags = AddAllPaths);
|
Flags flags = AddAllPaths);
|
||||||
|
|
||||||
bool languageIsCompatible(Language::Enum l) const;
|
bool languageIsCompatible(Language::Enum l) const;
|
||||||
void maybeAddPath(const QString &path);
|
|
||||||
|
|
||||||
QStringList selectors;
|
QStringList selectors;
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ static inline bool checkIfDerivedFromItem(const QString &fileName)
|
|||||||
|
|
||||||
snapshot.insert(document);
|
snapshot.insert(document);
|
||||||
|
|
||||||
QmlJS::Link link(snapshot, modelManager->defaultVContext(document->language(), document), QmlJS::ModelManagerInterface::instance()->builtins(document));
|
QmlJS::Link link(snapshot, modelManager->defaultVContext(), QmlJS::ModelManagerInterface::instance()->builtins(document));
|
||||||
|
|
||||||
QList<QmlJS::DiagnosticMessage> diagnosticLinkMessages;
|
QList<QmlJS::DiagnosticMessage> diagnosticLinkMessages;
|
||||||
QmlJS::ContextPtr context = link(document, &diagnosticLinkMessages);
|
QmlJS::ContextPtr context = link(document, &diagnosticLinkMessages);
|
||||||
|
|||||||
@@ -831,7 +831,7 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future,
|
|||||||
|
|
||||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
||||||
|
|
||||||
Link link(snapshot, modelManager->defaultVContext(doc->language(), doc), modelManager->builtins(doc));
|
Link link(snapshot, modelManager->defaultVContext(), modelManager->builtins(doc));
|
||||||
ContextPtr context = link();
|
ContextPtr context = link();
|
||||||
|
|
||||||
ScopeChain scopeChain(doc, context);
|
ScopeChain scopeChain(doc, context);
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ QmlJSTools::SemanticInfo SemanticInfoUpdater::makeNewSemanticInfo(const QmlJS::D
|
|||||||
|
|
||||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||||
|
|
||||||
Link link(semanticInfo.snapshot, modelManager->defaultVContext(doc->language(), doc), modelManager->builtins(doc));
|
Link link(semanticInfo.snapshot, modelManager->defaultVContext(), modelManager->builtins(doc));
|
||||||
semanticInfo.context = link(doc, &semanticInfo.semanticMessages);
|
semanticInfo.context = link(doc, &semanticInfo.semanticMessages);
|
||||||
|
|
||||||
ScopeChain *scopeChain = new ScopeChain(doc, semanticInfo.context);
|
ScopeChain *scopeChain = new ScopeChain(doc, semanticInfo.context);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void QmlTaskManager::updateMessagesNow(bool updateSemantic)
|
|||||||
QFuture<FileErrorMessages> future =
|
QFuture<FileErrorMessages> future =
|
||||||
QtConcurrent::run<FileErrorMessages>(
|
QtConcurrent::run<FileErrorMessages>(
|
||||||
&collectMessages, modelManager->newestSnapshot(), modelManager->projectInfos(),
|
&collectMessages, modelManager->newestSnapshot(), modelManager->projectInfos(),
|
||||||
modelManager->defaultVContext(Language::Unknown), updateSemantic);
|
modelManager->defaultVContext(), updateSemantic);
|
||||||
m_messageCollector.setFuture(future);
|
m_messageCollector.setFuture(future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,6 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QtAlgorithms>
|
#include <QtAlgorithms>
|
||||||
#include <QLibraryInfo>
|
|
||||||
#include <qglobal.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
@@ -89,8 +87,8 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
|
|||||||
globs.append(MimeGlobPattern(QLatin1String("*.qmltypes")));
|
globs.append(MimeGlobPattern(QLatin1String("*.qmltypes")));
|
||||||
globs.append(MimeGlobPattern(QLatin1String("*.qmlproject")));
|
globs.append(MimeGlobPattern(QLatin1String("*.qmlproject")));
|
||||||
}
|
}
|
||||||
foreach (const QString &filePath,
|
foreach (const QString &filePath
|
||||||
project->files(ProjectExplorer::Project::ExcludeGeneratedFiles))
|
, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles))
|
||||||
foreach (const MimeGlobPattern &glob, globs)
|
foreach (const MimeGlobPattern &glob, globs)
|
||||||
if (glob.matches(filePath))
|
if (glob.matches(filePath))
|
||||||
projectInfo.sourceFiles << filePath;
|
projectInfo.sourceFiles << filePath;
|
||||||
@@ -119,10 +117,6 @@ ModelManagerInterface::ProjectInfo QmlJSTools::defaultProjectInfoForProject(
|
|||||||
projectInfo.qtQmlPath = qtVersion->qmakeProperty("QT_INSTALL_QML");
|
projectInfo.qtQmlPath = qtVersion->qmakeProperty("QT_INSTALL_QML");
|
||||||
projectInfo.qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
|
projectInfo.qtImportsPath = qtVersion->qmakeProperty("QT_INSTALL_IMPORTS");
|
||||||
projectInfo.qtVersionString = qtVersion->qtVersionString();
|
projectInfo.qtVersionString = qtVersion->qtVersionString();
|
||||||
} else {
|
|
||||||
projectInfo.qtQmlPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
|
|
||||||
projectInfo.qtImportsPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
|
|
||||||
projectInfo.qtVersionString = QLatin1String(qVersion());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (projectInfo.tryQmlDump) {
|
if (projectInfo.tryQmlDump) {
|
||||||
@@ -257,9 +251,11 @@ ModelManagerInterface::WorkingCopy ModelManager::workingCopyInternal() const
|
|||||||
|
|
||||||
ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfo() const
|
ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfo() const
|
||||||
{
|
{
|
||||||
// needs to be performed in the ui therad (change?)
|
ProjectExplorer::Project *activeProject = ProjectExplorer::SessionManager::startupProject();
|
||||||
ProjectExplorer::Project *currentProject = ProjectExplorer::ProjectExplorerPlugin::currentProject();
|
if (!activeProject)
|
||||||
return defaultProjectInfoForProject(currentProject);
|
return ModelManagerInterface::ProjectInfo();
|
||||||
|
|
||||||
|
return projectInfo(activeProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether fileMimeType is the same or extends knownMimeType
|
// Check whether fileMimeType is the same or extends knownMimeType
|
||||||
@@ -283,3 +279,4 @@ void ModelManager::addTaskInternal(QFuture<void> result, const QString &msg, con
|
|||||||
{
|
{
|
||||||
ProgressManager::addTask(result, msg, taskId);
|
ProgressManager::addTask(result, msg, taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user