| 157 | } |
| 158 | |
| 159 | ClangSupport::ClangSupport(QObject* parent, const KPluginMetaData& metaData, const QVariantList&) |
| 160 | : IPlugin(QStringLiteral("kdevclangsupport"), parent, metaData) |
| 161 | , ILanguageSupport() |
| 162 | , m_highlighting(nullptr) |
| 163 | , m_refactoring(nullptr) |
| 164 | , m_index(nullptr) |
| 165 | { |
| 166 | clangDebug() << "Detected Clang version:" << ClangHelpers::clangVersion(); |
| 167 | |
| 168 | { |
| 169 | const auto builtinDir = ClangHelpers::clangBuiltinIncludePath(); |
| 170 | if (!ClangHelpers::isValidClangBuiltingIncludePath(builtinDir)) { |
| 171 | setErrorDescription(i18n("The clang builtin include path \"%1\" is invalid (missing cpuid.h header).\n" |
| 172 | "Try setting the KDEV_CLANG_BUILTIN_DIR environment variable manually to fix this.\n" |
| 173 | "See also: https://bugs.kde.org/show_bug.cgi?id=393779", builtinDir)); |
| 174 | return; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | setXMLFile( QStringLiteral("kdevclangsupport.rc") ); |
| 179 | |
| 180 | ClangIntegration::DUChainUtils::registerDUChainItems(); |
| 181 | |
| 182 | m_highlighting = new ClangHighlighting(this); |
| 183 | m_refactoring = new ClangRefactoring(this); |
| 184 | m_index.reset(new ClangIndex); |
| 185 | |
| 186 | auto model = new KDevelop::CodeCompletion( this, new ClangCodeCompletionModel(m_index.data(), this), name() ); |
| 187 | connect(model, &CodeCompletion::registeredToView, |
| 188 | this, &ClangSupport::disableKeywordCompletion); |
| 189 | connect(model, &CodeCompletion::unregisteredFromView, |
| 190 | this, &ClangSupport::enableKeywordCompletion); |
| 191 | const auto& mimeTypes = DocumentFinderHelpers::mimeTypesList(); |
| 192 | for (const auto& type : mimeTypes) { |
| 193 | KDevelop::IBuddyDocumentFinder::addFinder(type, this); |
| 194 | } |
| 195 | |
| 196 | auto assistantsManager = core()->languageController()->staticAssistantsManager(); |
| 197 | assistantsManager->registerAssistant(StaticAssistant::Ptr(new RenameAssistant(this))); |
| 198 | assistantsManager->registerAssistant(StaticAssistant::Ptr(new AdaptSignatureAssistant(this))); |
| 199 | |
| 200 | connect(ICore::self()->documentController(), &IDocumentController::documentActivated, |
| 201 | this, &ClangSupport::documentActivated); |
| 202 | } |
| 203 | |
| 204 | ClangSupport::~ClangSupport() |
| 205 | { |
nothing calls this directly
no test coverage detected