forked from qt-creator/qt-creator
QmlProject: Fix import paths for code model
This fixes a regression introduced by
30638df441
.
Custom import paths have to be absolute for the code model.
Change-Id: I232229fa58c3900fe684ca4529b2ed08bf93e8be
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
committed by
Ulf Hermann
parent
f60641f3d3
commit
0474216e2f
@@ -177,7 +177,7 @@ void QmlProject::refresh(RefreshOptions options)
|
||||
|
||||
QmlJS::ModelManagerInterface::ProjectInfo projectInfo =
|
||||
modelManager->defaultProjectInfoForProject(this);
|
||||
foreach (const QString &searchPath, customImportPaths())
|
||||
foreach (const QString &searchPath, makeAbsolute(canonicalProjectDir(), customImportPaths()))
|
||||
projectInfo.importPaths.maybeInsert(Utils::FileName::fromString(searchPath),
|
||||
QmlJS::Dialect::Qml);
|
||||
|
||||
@@ -249,6 +249,17 @@ void QmlProject::refreshProjectFile()
|
||||
refresh(QmlProject::ProjectFile | Files);
|
||||
}
|
||||
|
||||
QStringList QmlProject::makeAbsolute(const Utils::FileName &path, const QStringList &relativePaths)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
return relativePaths;
|
||||
|
||||
const QDir baseDir(path.toString());
|
||||
return Utils::transform(relativePaths, [&baseDir](const QString &path) {
|
||||
return QDir::cleanPath(baseDir.absoluteFilePath(path));
|
||||
});
|
||||
}
|
||||
|
||||
void QmlProject::refreshFiles(const QSet<QString> &/*added*/, const QSet<QString> &removed)
|
||||
{
|
||||
refresh(Files);
|
||||
|
Reference in New Issue
Block a user