diff --git a/src/plugins/clangcodemodel/CMakeLists.txt b/src/plugins/clangcodemodel/CMakeLists.txt index f9798dfaa46..27f7f1b2a4e 100644 --- a/src/plugins/clangcodemodel/CMakeLists.txt +++ b/src/plugins/clangcodemodel/CMakeLists.txt @@ -22,7 +22,6 @@ add_qtc_plugin(ClangCodeModel clangdiagnostictooltipwidget.cpp clangdiagnostictooltipwidget.h clangdquickfixfactory.cpp clangdquickfixfactory.h clangdqpropertyhighlighter.cpp clangdqpropertyhighlighter.h - clangeditordocumentparser.cpp clangeditordocumentparser.h clangeditordocumentprocessor.cpp clangeditordocumentprocessor.h clangfixitoperation.cpp clangfixitoperation.h clangfixitoperationsextractor.cpp clangfixitoperationsextractor.h diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs index e0f5a5632f8..68158e9d1af 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.qbs +++ b/src/plugins/clangcodemodel/clangcodemodel.qbs @@ -52,8 +52,6 @@ QtcPlugin { "clangdqpropertyhighlighter.h", "clangdquickfixfactory.cpp", "clangdquickfixfactory.h", - "clangeditordocumentparser.cpp", - "clangeditordocumentparser.h", "clangeditordocumentprocessor.cpp", "clangeditordocumentprocessor.h", "clangfixitoperation.cpp", diff --git a/src/plugins/clangcodemodel/clangeditordocumentparser.cpp b/src/plugins/clangcodemodel/clangeditordocumentparser.cpp deleted file mode 100644 index b892f393648..00000000000 --- a/src/plugins/clangcodemodel/clangeditordocumentparser.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "clangeditordocumentparser.h" - -namespace ClangCodeModel { -namespace Internal { - -ClangEditorDocumentParser::ClangEditorDocumentParser(const QString &filePath) - : BaseEditorDocumentParser(filePath) -{ -} - -void ClangEditorDocumentParser::updateImpl(const QFutureInterface &, - const UpdateParams &updateParams) -{ - State state_ = state(); - state_.projectPartInfo = determineProjectPart(filePath(), - configuration().preferredProjectPartId, - state_.projectPartInfo, - updateParams.activeProject, - updateParams.languagePreference, - updateParams.projectsUpdated); - emit projectPartInfoUpdated(state_.projectPartInfo); - setState(state_); -} - -} // namespace Internal -} // namespace ClangCodeModel diff --git a/src/plugins/clangcodemodel/clangeditordocumentparser.h b/src/plugins/clangcodemodel/clangeditordocumentparser.h deleted file mode 100644 index e917ff9e360..00000000000 --- a/src/plugins/clangcodemodel/clangeditordocumentparser.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -namespace ClangCodeModel { -namespace Internal { - -class ClangEditorDocumentParser : public CppEditor::BaseEditorDocumentParser -{ - Q_OBJECT - -public: - ClangEditorDocumentParser(const QString &filePath); - -private: - void updateImpl(const QFutureInterface &future, - const UpdateParams &updateParams) override; -}; - -} // namespace Internal -} // namespace ClangCodeModel diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index 2d494b04d04..69c260b8cc6 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -25,7 +25,6 @@ #include "clangeditordocumentprocessor.h" -#include "clangbackendcommunicator.h" #include "clangprojectsettings.h" #include "clangdiagnostictooltipwidget.h" #include "clangfixitoperation.h" @@ -33,11 +32,6 @@ #include "clangmodelmanagersupport.h" #include "clangutils.h" -#include -#include - -#include - #include #include #include @@ -67,38 +61,13 @@ namespace ClangCodeModel { namespace Internal { ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document) - : BaseEditorDocumentProcessor(document->document(), document->filePath().toString()) - , m_document(*document) - , m_parser(new ClangEditorDocumentParser(document->filePath().toString())) - , m_builtinProcessor(document) + : BuiltinEditorDocumentProcessor(document), m_document(*document) { - connect(m_parser.data(), &ClangEditorDocumentParser::projectPartInfoUpdated, + connect(parser().data(), &CppEditor::BaseEditorDocumentParser::projectPartInfoUpdated, this, &BaseEditorDocumentProcessor::projectPartInfoUpdated); - - // Forwarding the semantic info from the builtin processor enables us to provide all - // editor (widget) related features that are not yet implemented by the clang plugin. - connect(&m_builtinProcessor, &CppEditor::BuiltinEditorDocumentProcessor::cppDocumentUpdated, - this, &ClangEditorDocumentProcessor::cppDocumentUpdated); - connect(&m_builtinProcessor, &CppEditor::BuiltinEditorDocumentProcessor::semanticInfoUpdated, - this, &ClangEditorDocumentProcessor::semanticInfoUpdated); - connect(&m_builtinProcessor, &CppEditor::BuiltinEditorDocumentProcessor::codeWarningsUpdated, - this, &ClangEditorDocumentProcessor::codeWarningsUpdated); - m_builtinProcessor.setSemanticHighlightingChecker([this] { + setSemanticHighlightingChecker([this] { return !ClangModelManagerSupport::instance()->clientForFile(m_document.filePath()); }); - - m_parserSynchronizer.setCancelOnWait(true); -} - -void ClangEditorDocumentProcessor::runImpl( - const CppEditor::BaseEditorDocumentParser::UpdateParams &updateParams) -{ - m_builtinProcessor.runImpl(updateParams); -} - -void ClangEditorDocumentProcessor::recalculateSemanticInfoDetached(bool force) -{ - m_builtinProcessor.recalculateSemanticInfoDetached(force); } void ClangEditorDocumentProcessor::semanticRehighlight() @@ -110,27 +79,7 @@ void ClangEditorDocumentProcessor::semanticRehighlight() return; if (ClangModelManagerSupport::instance()->clientForFile(m_document.filePath())) return; - m_builtinProcessor.semanticRehighlight(); -} - -CppEditor::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo() -{ - return m_builtinProcessor.recalculateSemanticInfo(); -} - -CppEditor::BaseEditorDocumentParser::Ptr ClangEditorDocumentProcessor::parser() -{ - return m_builtinProcessor.parser(); -} - -CPlusPlus::Snapshot ClangEditorDocumentProcessor::snapshot() -{ - return m_builtinProcessor.snapshot(); -} - -bool ClangEditorDocumentProcessor::isParserRunning() const -{ - return m_builtinProcessor.isParserRunning(); + BuiltinEditorDocumentProcessor::semanticRehighlight(); } bool ClangEditorDocumentProcessor::hasProjectPart() const @@ -156,20 +105,13 @@ void ClangEditorDocumentProcessor::clearProjectPart() void ClangEditorDocumentProcessor::setParserConfig( const CppEditor::BaseEditorDocumentParser::Configuration &config) { - m_parser->setConfiguration(config); - m_builtinProcessor.parser()->setConfiguration(config); + CppEditor::BuiltinEditorDocumentProcessor::setParserConfig(config); emit parserConfigChanged(Utils::FilePath::fromString(filePath()), config); } -CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor::parserConfig() const +CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor::parserConfig() { - return m_parser->configuration(); -} - -QFuture -ClangEditorDocumentProcessor::cursorInfo(const CppEditor::CursorInfoParams ¶ms) -{ - return m_builtinProcessor.cursorInfo(params); + return parser()->configuration(); } ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath) diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h index 3d7499ff91f..59939177532 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h @@ -25,41 +25,21 @@ #pragma once -#include "clangeditordocumentparser.h" - -#include - #include -#include #include -#include - -namespace ClangBackEnd { -class DiagnosticContainer; -class TokenInfoContainer; -class FileContainer; -} - namespace ClangCodeModel { namespace Internal { -class ClangEditorDocumentProcessor : public CppEditor::BaseEditorDocumentProcessor +class ClangEditorDocumentProcessor : public CppEditor::BuiltinEditorDocumentProcessor { Q_OBJECT public: ClangEditorDocumentProcessor(TextEditor::TextDocument *document); - // BaseEditorDocumentProcessor interface - void runImpl(const CppEditor::BaseEditorDocumentParser::UpdateParams &updateParams) override; void semanticRehighlight() override; - void recalculateSemanticInfoDetached(bool force) override; - CppEditor::SemanticInfo recalculateSemanticInfo() override; - CppEditor::BaseEditorDocumentParser::Ptr parser() override; - CPlusPlus::Snapshot snapshot() override; - bool isParserRunning() const override; bool hasProjectPart() const; CppEditor::ProjectPart::ConstPtr projectPart() const; @@ -68,9 +48,7 @@ public: ::Utils::Id diagnosticConfigId() const; void setParserConfig(const CppEditor::BaseEditorDocumentParser::Configuration &config) override; - CppEditor::BaseEditorDocumentParser::Configuration parserConfig() const; - - QFuture cursorInfo(const CppEditor::CursorInfoParams ¶ms) override; + CppEditor::BaseEditorDocumentParser::Configuration parserConfig(); public: static ClangEditorDocumentProcessor *get(const QString &filePath); @@ -81,12 +59,8 @@ signals: private: TextEditor::TextDocument &m_document; - QSharedPointer m_parser; CppEditor::ProjectPart::ConstPtr m_projectPart; ::Utils::Id m_diagnosticConfigId; - - CppEditor::BuiltinEditorDocumentProcessor m_builtinProcessor; - Utils::FutureSynchronizer m_parserSynchronizer; }; } // namespace Internal