diff --git a/plugins/custom-definesandincludes/definesandincludesmanager.h b/plugins/custom-definesandincludes/definesandincludesmanager.h --- a/plugins/custom-definesandincludes/definesandincludesmanager.h +++ b/plugins/custom-definesandincludes/definesandincludesmanager.h @@ -52,9 +52,9 @@ ///@return list of all custom framework directories for @p item KDevelop::Path::List frameworkDirectories( KDevelop::ProjectBaseItem* item, Type type ) const override; - KDevelop::Defines defines( const QString& path ) const override; - KDevelop::Path::List includes( const QString& path ) const override; - KDevelop::Path::List frameworkDirectories(const QString& path) const override; + KDevelop::Defines defines( const QString& path, Type type = All ) const override; + KDevelop::Path::List includes( const QString& path, Type type = All ) const override; + KDevelop::Path::List frameworkDirectories(const QString& path, Type type = All) const override; void registerProvider( Provider* provider ) override; bool unregisterProvider( Provider* provider ) override; diff --git a/plugins/custom-definesandincludes/definesandincludesmanager.cpp b/plugins/custom-definesandincludes/definesandincludesmanager.cpp --- a/plugins/custom-definesandincludes/definesandincludesmanager.cpp +++ b/plugins/custom-definesandincludes/definesandincludesmanager.cpp @@ -264,22 +264,33 @@ m_providers.push_back(provider); } -Defines DefinesAndIncludesManager::defines(const QString& path) const +Defines DefinesAndIncludesManager::defines(const QString& path, Type type) const { - Defines ret = m_settings->provider()->defines(nullptr); - merge(&ret, m_noProjectIPM->includesAndDefines(path).second); + Defines ret; + if ( type & CompilerSpecific ) { + merge(&ret, m_settings->provider()->defines(nullptr)); + } + if ( type & ProjectSpecific ) { + merge(&ret, m_noProjectIPM->includesAndDefines(path).second); + } return ret; } -Path::List DefinesAndIncludesManager::includes(const QString& path) const +Path::List DefinesAndIncludesManager::includes(const QString& path, Type type) const { - return m_settings->provider()->includes(nullptr) - + m_noProjectIPM->includesAndDefines(path).first; + Path::List ret; + if ( type & CompilerSpecific ) { + ret += m_settings->provider()->includes(nullptr); + } + if ( type & ProjectSpecific ) { + ret += m_noProjectIPM->includesAndDefines(path).first; + } + return ret; } -Path::List DefinesAndIncludesManager::frameworkDirectories(const QString& /* path */) const +Path::List DefinesAndIncludesManager::frameworkDirectories(const QString& /* path */, Type type) const { - return m_settings->provider()->frameworkDirectories(nullptr); + return (type & CompilerSpecific) ? m_settings->provider()->frameworkDirectories(nullptr) : Path::List(); } void DefinesAndIncludesManager::openConfigurationDialog(const QString& pathToFile) diff --git a/plugins/custom-definesandincludes/idefinesandincludesmanager.h b/plugins/custom-definesandincludes/idefinesandincludesmanager.h --- a/plugins/custom-definesandincludes/idefinesandincludesmanager.h +++ b/plugins/custom-definesandincludes/idefinesandincludesmanager.h @@ -98,34 +98,40 @@ }; ///@param item project item + ///@param type Data sources to be used. ///@return list of defines for @p item ///NOTE: call it from the foreground thread only. virtual Defines defines( ProjectBaseItem* item, Type type = All ) const = 0; ///@param item project item + ///@param type Data sources to be used. ///@return list of include directories/files for @p item ///NOTE: call it from the foreground thread only. virtual Path::List includes( ProjectBaseItem* item, Type type = All ) const = 0; ///@param item project item + ///@param type Data sources to be used. ///@return list of framework directories for @p item ///NOTE: call it from the foreground thread only. virtual Path::List frameworkDirectories( ProjectBaseItem* item, Type type = All ) const = 0; ///@param path path to an out-of-project file. + ///@param type Data sources to be used. ///@return list of defines for @p path ///NOTE: call it from the foreground thread only. - virtual Defines defines( const QString& path ) const = 0; + virtual Defines defines( const QString& path, Type type = All ) const = 0; ///@param path path to an out-of-project file. + ///@param type Data sources to be used. ///@return list of include directories/files for @p path ///NOTE: call it from the foreground thread only. - virtual Path::List includes( const QString& path ) const = 0; + virtual Path::List includes( const QString& path, Type type = All ) const = 0; ///@param path path to an out-of-project file. + ///@param type Data sources to be used. ///@return list of framework directories for @p path ///NOTE: call it from the foreground thread only. - virtual Path::List frameworkDirectories( const QString& path ) const = 0; + virtual Path::List frameworkDirectories( const QString& path, Type type = All ) const = 0; /** * Computes include directories in background thread. diff --git a/plugins/qmljs/qmljsparsejob.cpp b/plugins/qmljs/qmljsparsejob.cpp --- a/plugins/qmljs/qmljsparsejob.cpp +++ b/plugins/qmljs/qmljsparsejob.cpp @@ -83,12 +83,15 @@ if (auto file = findProjectFileItem(url)) { QmlJS::Cache::instance().setFileCustomIncludes( url, - IDefinesAndIncludesManager::manager()->includes(file) + IDefinesAndIncludesManager::manager()->includes(file, + IDefinesAndIncludesManager::Type( + IDefinesAndIncludesManager::ProjectSpecific | IDefinesAndIncludesManager::UserDefined)) ); } else { QmlJS::Cache::instance().setFileCustomIncludes( url, - IDefinesAndIncludesManager::manager()->includes(url.str()) + IDefinesAndIncludesManager::manager()->includes(url.str(), + IDefinesAndIncludesManager::ProjectSpecific) ); } }