forked from qt-creator/qt-creator
CppEditor: refactor FollowSymbol
Create an interface to get the ability to use another FollowSymbol implementation Change-Id: I5802f62523ff3ee47b8a14e487adf43edcb6c9b1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "clangconstants.h"
|
||||
#include "clangeditordocumentprocessor.h"
|
||||
#include "clangutils.h"
|
||||
#include "clangfollowsymbol.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
@@ -52,6 +53,12 @@ using namespace ClangCodeModel::Internal;
|
||||
|
||||
static ModelManagerSupportClang *m_instance = 0;
|
||||
|
||||
static bool useClangFollowSymbol()
|
||||
{
|
||||
static bool use = qEnvironmentVariableIntValue("QTC_CLANG_FOLLOW_SYMBOL");
|
||||
return use;
|
||||
}
|
||||
|
||||
static CppTools::CppModelManager *cppModelManager()
|
||||
{
|
||||
return CppTools::CppModelManager::instance();
|
||||
@@ -63,6 +70,9 @@ ModelManagerSupportClang::ModelManagerSupportClang()
|
||||
QTC_CHECK(!m_instance);
|
||||
m_instance = this;
|
||||
|
||||
if (useClangFollowSymbol())
|
||||
m_followSymbol.reset(new ClangFollowSymbol);
|
||||
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
connect(editorManager, &Core::EditorManager::editorOpened,
|
||||
this, &ModelManagerSupportClang::onEditorOpened);
|
||||
@@ -96,6 +106,11 @@ CppTools::CppCompletionAssistProvider *ModelManagerSupportClang::completionAssis
|
||||
return &m_completionAssistProvider;
|
||||
}
|
||||
|
||||
CppTools::FollowSymbolInterface *ModelManagerSupportClang::followSymbolInterface()
|
||||
{
|
||||
return m_followSymbol.get();
|
||||
}
|
||||
|
||||
CppTools::BaseEditorDocumentProcessor *ModelManagerSupportClang::editorDocumentProcessor(
|
||||
TextEditor::TextDocument *baseTextDocument)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user