forked from qt-creator/qt-creator
C++: make highlighting/completion plugable.
Change-Id: I990fdf5411153041c6b4c62f31b453342d59de53 Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
@@ -30,43 +30,20 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cppcompletionassist.h"
|
||||
#include "cppcompletionsupport.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cpptoolseditorsupport.h"
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <texteditor/codeassist/iassistinterface.h>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
CppCompletionSupport::CppCompletionSupport(CppEditorSupport *editorSupport)
|
||||
: m_editorSupport(editorSupport)
|
||||
CppCompletionSupport::CppCompletionSupport(TextEditor::ITextEditor *editor)
|
||||
: m_editor(editor)
|
||||
{
|
||||
Q_ASSERT(editorSupport);
|
||||
Q_ASSERT(editor);
|
||||
}
|
||||
|
||||
TextEditor::IAssistInterface *CppCompletionSupport::createAssistInterface(ProjectExplorer::Project *project,
|
||||
QTextDocument *document,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const
|
||||
CppCompletionSupport::~CppCompletionSupport()
|
||||
{
|
||||
}
|
||||
|
||||
CppCompletionSupportFactory::~CppCompletionSupportFactory()
|
||||
{
|
||||
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
|
||||
QStringList includePaths;
|
||||
QStringList frameworkPaths;
|
||||
if (project) {
|
||||
includePaths = modelManager->projectInfo(project).includePaths();
|
||||
frameworkPaths = modelManager->projectInfo(project).frameworkPaths();
|
||||
}
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(
|
||||
document,
|
||||
position,
|
||||
m_editorSupport->textEditor()->document(),
|
||||
reason,
|
||||
modelManager->snapshot(),
|
||||
includePaths,
|
||||
frameworkPaths);
|
||||
}
|
||||
|
||||
@@ -41,35 +41,42 @@ QT_BEGIN_NAMESPACE
|
||||
class QTextDocument;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IDocument;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class IAssistInterface;
|
||||
class ITextEditor;
|
||||
}
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
class CppEditorSupport;
|
||||
}
|
||||
|
||||
class CPPTOOLS_EXPORT CppCompletionSupport
|
||||
{
|
||||
public:
|
||||
CppCompletionSupport(Internal::CppEditorSupport *editorSupport);
|
||||
CppCompletionSupport(TextEditor::ITextEditor *editor);
|
||||
virtual ~CppCompletionSupport() = 0;
|
||||
|
||||
TextEditor::IAssistInterface *createAssistInterface(ProjectExplorer::Project *project,
|
||||
QTextDocument *document,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const;
|
||||
virtual TextEditor::IAssistInterface *createAssistInterface(ProjectExplorer::Project *project,
|
||||
QTextDocument *document,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const = 0;
|
||||
|
||||
protected:
|
||||
TextEditor::ITextEditor *editor() const
|
||||
{ return m_editor; }
|
||||
|
||||
private:
|
||||
Internal::CppEditorSupport *m_editorSupport;
|
||||
TextEditor::ITextEditor *m_editor;
|
||||
};
|
||||
|
||||
class CPPTOOLS_EXPORT CppCompletionSupportFactory
|
||||
{
|
||||
public:
|
||||
virtual ~CppCompletionSupportFactory() = 0;
|
||||
|
||||
virtual CppCompletionSupport *completionSupport(TextEditor::ITextEditor *editor) = 0;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
83
src/plugins/cpptools/cppcompletionsupportinternal.cpp
Normal file
83
src/plugins/cpptools/cppcompletionsupportinternal.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cppcompletionassist.h"
|
||||
#include "cppcompletionsupportinternal.h"
|
||||
#include "cppmodelmanager.h"
|
||||
|
||||
#include <coreplugin/idocument.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <texteditor/codeassist/iassistinterface.h>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
CppCompletionSupportInternal::CppCompletionSupportInternal(TextEditor::ITextEditor *editor)
|
||||
: CppCompletionSupport(editor)
|
||||
{
|
||||
}
|
||||
|
||||
CppCompletionSupportInternal::~CppCompletionSupportInternal()
|
||||
{
|
||||
}
|
||||
|
||||
TextEditor::IAssistInterface *CppCompletionSupportInternal::createAssistInterface(
|
||||
ProjectExplorer::Project *project,
|
||||
QTextDocument *document,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const
|
||||
{
|
||||
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
|
||||
QStringList includePaths;
|
||||
QStringList frameworkPaths;
|
||||
if (project) {
|
||||
includePaths = modelManager->projectInfo(project).includePaths();
|
||||
frameworkPaths = modelManager->projectInfo(project).frameworkPaths();
|
||||
}
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(
|
||||
document,
|
||||
position,
|
||||
editor()->document(),
|
||||
reason,
|
||||
modelManager->snapshot(),
|
||||
includePaths,
|
||||
frameworkPaths);
|
||||
}
|
||||
|
||||
CppCompletionSupportInternalFactory::~CppCompletionSupportInternalFactory()
|
||||
{}
|
||||
|
||||
CppCompletionSupport *CppCompletionSupportInternalFactory::completionSupport(TextEditor::ITextEditor *editor)
|
||||
{
|
||||
return new CppCompletionSupportInternal(editor);
|
||||
}
|
||||
64
src/plugins/cpptools/cppcompletionsupportinternal.h
Normal file
64
src/plugins/cpptools/cppcompletionsupportinternal.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CPPTOOLS_CPPCOMPLETIONSUPPORTINTERNAL_H
|
||||
#define CPPTOOLS_CPPCOMPLETIONSUPPORTINTERNAL_H
|
||||
|
||||
#include "cppcompletionsupport.h"
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
|
||||
class CppCompletionSupportInternal: public CppCompletionSupport
|
||||
{
|
||||
public:
|
||||
CppCompletionSupportInternal(TextEditor::ITextEditor *editor);
|
||||
virtual ~CppCompletionSupportInternal();
|
||||
|
||||
virtual TextEditor::IAssistInterface *createAssistInterface(ProjectExplorer::Project *project,
|
||||
QTextDocument *document,
|
||||
int position,
|
||||
TextEditor::AssistReason reason) const;
|
||||
};
|
||||
|
||||
class CppCompletionSupportInternalFactory: public CppCompletionSupportFactory
|
||||
{
|
||||
public:
|
||||
virtual ~CppCompletionSupportInternalFactory();
|
||||
|
||||
virtual CppCompletionSupport *completionSupport(TextEditor::ITextEditor *editor);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
#endif // CPPTOOLS_CPPCOMPLETIONSUPPORTINTERNAL_H
|
||||
@@ -30,23 +30,20 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cppchecksymbols.h"
|
||||
#include "cpphighlightingsupport.h"
|
||||
#include "cpptoolseditorsupport.h"
|
||||
|
||||
#include <cplusplus/LookupContext.h>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
CppHighlightingSupport::CppHighlightingSupport()
|
||||
CppHighlightingSupport::CppHighlightingSupport(TextEditor::ITextEditor *editor)
|
||||
: m_editor(editor)
|
||||
{
|
||||
Q_ASSERT(editor);
|
||||
}
|
||||
|
||||
CppHighlightingSupport::~CppHighlightingSupport()
|
||||
{
|
||||
}
|
||||
|
||||
QFuture<CppHighlightingSupport::Use> CppHighlightingSupport::highlightingFuture(
|
||||
const Document::Ptr &doc, const Snapshot &snapshot) const
|
||||
CppHighlightingSupportFactory::~CppHighlightingSupportFactory()
|
||||
{
|
||||
LookupContext context(doc, snapshot);
|
||||
return CheckSymbols::go(doc, context);
|
||||
}
|
||||
|
||||
@@ -40,21 +40,38 @@
|
||||
|
||||
#include <QFuture>
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
class CppEditorSupport;
|
||||
namespace TextEditor {
|
||||
class ITextEditor;
|
||||
}
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class CPPTOOLS_EXPORT CppHighlightingSupport
|
||||
{
|
||||
public:
|
||||
typedef TextEditor::SemanticHighlighter::Result Use;
|
||||
|
||||
public:
|
||||
CppHighlightingSupport();
|
||||
CppHighlightingSupport(TextEditor::ITextEditor *editor);
|
||||
virtual ~CppHighlightingSupport() = 0;
|
||||
|
||||
QFuture<Use> highlightingFuture(const CPlusPlus::Document::Ptr &doc,
|
||||
const CPlusPlus::Snapshot &snapshot) const;
|
||||
virtual QFuture<Use> highlightingFuture(const CPlusPlus::Document::Ptr &doc,
|
||||
const CPlusPlus::Snapshot &snapshot) const = 0;
|
||||
|
||||
protected:
|
||||
TextEditor::ITextEditor *editor() const
|
||||
{ return m_editor; }
|
||||
|
||||
private:
|
||||
TextEditor::ITextEditor *m_editor;
|
||||
};
|
||||
|
||||
class CPPTOOLS_EXPORT CppHighlightingSupportFactory
|
||||
{
|
||||
public:
|
||||
virtual ~CppHighlightingSupportFactory() = 0;
|
||||
|
||||
virtual CppHighlightingSupport *highlightingSupport(TextEditor::ITextEditor *editor) = 0;
|
||||
};
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
66
src/plugins/cpptools/cpphighlightingsupportinternal.cpp
Normal file
66
src/plugins/cpptools/cpphighlightingsupportinternal.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cppchecksymbols.h"
|
||||
#include "cpphighlightingsupportinternal.h"
|
||||
|
||||
#include <cplusplus/LookupContext.h>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
CppHighlightingSupportInternal::CppHighlightingSupportInternal(TextEditor::ITextEditor *editor)
|
||||
: CppHighlightingSupport(editor)
|
||||
{
|
||||
}
|
||||
|
||||
CppHighlightingSupportInternal::~CppHighlightingSupportInternal()
|
||||
{
|
||||
}
|
||||
|
||||
QFuture<CppHighlightingSupport::Use> CppHighlightingSupportInternal::highlightingFuture(
|
||||
const Document::Ptr &doc,
|
||||
const Snapshot &snapshot) const
|
||||
{
|
||||
LookupContext context(doc, snapshot);
|
||||
return CheckSymbols::go(doc, context);
|
||||
}
|
||||
|
||||
CppHighlightingSupportInternalFactory::~CppHighlightingSupportInternalFactory()
|
||||
{
|
||||
}
|
||||
|
||||
CppHighlightingSupport *CppHighlightingSupportInternalFactory::highlightingSupport(TextEditor::ITextEditor *editor)
|
||||
{
|
||||
return new CppHighlightingSupportInternal(editor);
|
||||
}
|
||||
70
src/plugins/cpptools/cpphighlightingsupportinternal.h
Normal file
70
src/plugins/cpptools/cpphighlightingsupportinternal.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
||||
** Please review the following information to ensure the GNU Lesser General
|
||||
** Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** Other Usage
|
||||
**
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CPPTOOLS_CPPHIGHLIGHTINGSUPPORTINTERNAL_H
|
||||
#define CPPTOOLS_CPPHIGHLIGHTINGSUPPORTINTERNAL_H
|
||||
|
||||
#include "cpphighlightingsupport.h"
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <texteditor/semantichighlighter.h>
|
||||
|
||||
#include <QFuture>
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
|
||||
class CppHighlightingSupportInternal: public CppHighlightingSupport
|
||||
{
|
||||
public:
|
||||
typedef TextEditor::SemanticHighlighter::Result Use;
|
||||
|
||||
public:
|
||||
CppHighlightingSupportInternal(TextEditor::ITextEditor *editor);
|
||||
virtual ~CppHighlightingSupportInternal();
|
||||
|
||||
virtual QFuture<Use> highlightingFuture(const CPlusPlus::Document::Ptr &doc,
|
||||
const CPlusPlus::Snapshot &snapshot) const;
|
||||
};
|
||||
|
||||
class CppHighlightingSupportInternalFactory: public CppHighlightingSupportFactory
|
||||
{
|
||||
public:
|
||||
virtual ~CppHighlightingSupportInternalFactory();
|
||||
|
||||
virtual CppHighlightingSupport *highlightingSupport(TextEditor::ITextEditor *editor);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
#endif // CPPTOOLS_CPPHIGHLIGHTINGSUPPORTINTERNAL_H
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <cplusplus/Overview.h>
|
||||
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cppcompletionsupport.h"
|
||||
#include "cppcompletionsupportinternal.h"
|
||||
#include "cpphighlightingsupport.h"
|
||||
#include "cpphighlightingsupportinternal.h"
|
||||
#include "abstracteditorsupport.h"
|
||||
#ifndef ICHECK_BUILD
|
||||
# include "cpptoolsconstants.h"
|
||||
@@ -730,10 +734,18 @@ CppModelManager::CppModelManager(QObject *parent)
|
||||
|
||||
connect(Core::ICore::editorManager(), SIGNAL(editorAboutToClose(Core::IEditor *)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor *)));
|
||||
|
||||
m_completionFallback = new CppCompletionSupportInternalFactory;
|
||||
m_completionFactory = m_completionFallback;
|
||||
m_highlightingFallback = new CppHighlightingSupportInternalFactory;
|
||||
m_highlightingFactory = m_highlightingFallback;
|
||||
}
|
||||
|
||||
CppModelManager::~CppModelManager()
|
||||
{ }
|
||||
{
|
||||
delete m_completionFallback;
|
||||
delete m_highlightingFallback;
|
||||
}
|
||||
|
||||
Snapshot CppModelManager::snapshot() const
|
||||
{
|
||||
@@ -1395,20 +1407,36 @@ void CppModelManager::finishedRefreshingSourceFiles(const QStringList &files)
|
||||
|
||||
CppCompletionSupport *CppModelManager::completionSupport(Core::IEditor *editor) const
|
||||
{
|
||||
if (CppEditorSupport *es = editorSupport(qobject_cast<TextEditor::ITextEditor *>(editor)))
|
||||
return es->completionSupport();
|
||||
if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor))
|
||||
return m_completionFactory->completionSupport(textEditor);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CppModelManager::setCompletionSupportFactory(CppCompletionSupportFactory *completionFactory)
|
||||
{
|
||||
if (completionFactory)
|
||||
m_completionFactory = completionFactory;
|
||||
else
|
||||
m_completionFactory = m_completionFallback;
|
||||
}
|
||||
|
||||
CppHighlightingSupport *CppModelManager::highlightingSupport(Core::IEditor *editor) const
|
||||
{
|
||||
if (CppEditorSupport *es = editorSupport(qobject_cast<TextEditor::ITextEditor *>(editor)))
|
||||
return es->highlightingSupport();
|
||||
if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor))
|
||||
return m_highlightingFactory->highlightingSupport(textEditor);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CppModelManager::setHighlightingSupportFactory(CppHighlightingSupportFactory *highlightingFactory)
|
||||
{
|
||||
if (highlightingFactory)
|
||||
m_highlightingFactory = highlightingFactory;
|
||||
else
|
||||
m_highlightingFactory = m_highlightingFallback;
|
||||
}
|
||||
|
||||
void CppModelManager::setExtraDiagnostics(const QString &fileName, int kind,
|
||||
const QList<Document::DiagnosticMessage> &diagnostics)
|
||||
{
|
||||
|
||||
@@ -76,6 +76,9 @@ namespace CPlusPlus {
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class CppCompletionSupportFactory;
|
||||
class CppHighlightingSupportFactory;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CppEditorSupport;
|
||||
@@ -135,7 +138,10 @@ public:
|
||||
void finishedRefreshingSourceFiles(const QStringList &files);
|
||||
|
||||
virtual CppCompletionSupport *completionSupport(Core::IEditor *editor) const;
|
||||
void setCompletionSupportFactory(CppCompletionSupportFactory *completionFactory);
|
||||
|
||||
virtual CppHighlightingSupport *highlightingSupport(Core::IEditor *editor) const;
|
||||
void setHighlightingSupportFactory(CppHighlightingSupportFactory *highlightingFactory);
|
||||
|
||||
Q_SIGNALS:
|
||||
void projectPathChanged(const QString &projectPath);
|
||||
@@ -240,6 +246,11 @@ private:
|
||||
QHash<QString, QHash<int, QList<CPlusPlus::Document::DiagnosticMessage> > > m_extraDiagnostics;
|
||||
|
||||
QMap<QString, QList<ProjectPart::Ptr> > m_srcToProjectPart;
|
||||
|
||||
CppCompletionSupportFactory *m_completionFactory;
|
||||
CppCompletionSupportFactory *m_completionFallback;
|
||||
CppHighlightingSupportFactory *m_highlightingFactory;
|
||||
CppHighlightingSupportFactory *m_highlightingFallback;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@ HEADERS += completionsettingspage.h \
|
||||
commentssettings.h \
|
||||
symbolfinder.h \
|
||||
cppcompletionsupport.h \
|
||||
cppcompletionsupportinternal.h \
|
||||
cpphighlightingsupport.h \
|
||||
cpphighlightingsupportinternal.h \
|
||||
cppchecksymbols.h \
|
||||
cpplocalsymbols.h \
|
||||
cppsemanticinfo.h
|
||||
@@ -75,7 +77,9 @@ SOURCES += completionsettingspage.cpp \
|
||||
commentssettings.cpp \
|
||||
symbolfinder.cpp \
|
||||
cppcompletionsupport.cpp \
|
||||
cppcompletionsupportinternal.cpp \
|
||||
cpphighlightingsupport.cpp \
|
||||
cpphighlightingsupportinternal.cpp \
|
||||
cppchecksymbols.cpp \
|
||||
cpplocalsymbols.cpp \
|
||||
cppsemanticinfo.cpp
|
||||
|
||||
@@ -53,9 +53,7 @@ using namespace CPlusPlus;
|
||||
CppEditorSupport::CppEditorSupport(CppModelManager *modelManager)
|
||||
: QObject(modelManager),
|
||||
_modelManager(modelManager),
|
||||
_updateDocumentInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL),
|
||||
m_completionSupport(new CppCompletionSupport(this)),
|
||||
m_highlightingSupport(new CppHighlightingSupport)
|
||||
_updateDocumentInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL)
|
||||
{
|
||||
_revision = 0;
|
||||
|
||||
@@ -103,16 +101,6 @@ unsigned CppEditorSupport::editorRevision() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
CppTools::CppCompletionSupport *CppEditorSupport::completionSupport() const
|
||||
{
|
||||
return m_completionSupport.data();
|
||||
}
|
||||
|
||||
CppHighlightingSupport *CppEditorSupport::highlightingSupport() const
|
||||
{
|
||||
return m_highlightingSupport.data();
|
||||
}
|
||||
|
||||
int CppEditorSupport::updateDocumentInterval() const
|
||||
{ return _updateDocumentInterval; }
|
||||
|
||||
|
||||
@@ -57,10 +57,6 @@ namespace TextEditor {
|
||||
} // namespace TextEditor
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class CppCompletionSupport;
|
||||
class CppHighlightingSupport;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CppModelManager;
|
||||
@@ -82,9 +78,6 @@ public:
|
||||
QString contents();
|
||||
unsigned editorRevision() const;
|
||||
|
||||
CppCompletionSupport *completionSupport() const;
|
||||
CppHighlightingSupport *highlightingSupport() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void contentsChanged();
|
||||
|
||||
@@ -102,8 +95,6 @@ private:
|
||||
QFuture<void> _documentParser;
|
||||
QString _cachedContents;
|
||||
unsigned _revision;
|
||||
QScopedPointer<CppCompletionSupport> m_completionSupport;
|
||||
QScopedPointer<CppHighlightingSupport> m_highlightingSupport;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user