forked from qt-creator/qt-creator
C++: Moved completion/highlighting into the model manager.
This way the editor does not need to know all the details of instantiating or maintaining classes for highlighting and/or completion, it can just ask the model manager. The change also enables different highlighting- or completion-engines without changes to the cppeditor. Change-Id: I8000d9d9fe446b292defddb2295493cf77d0f14a Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -55,6 +55,8 @@ namespace ProjectExplorer {
|
|||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
class AbstractEditorSupport;
|
class AbstractEditorSupport;
|
||||||
|
class CppCompletionSupport;
|
||||||
|
class CppHighlightingSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
@@ -151,6 +153,9 @@ public:
|
|||||||
virtual QList<CPlusPlus::Document::DiagnosticMessage> extraDiagnostics(
|
virtual QList<CPlusPlus::Document::DiagnosticMessage> extraDiagnostics(
|
||||||
const QString &fileName, int key = AllExtraDiagnostics) const = 0;
|
const QString &fileName, int key = AllExtraDiagnostics) const = 0;
|
||||||
|
|
||||||
|
virtual CppTools::CppCompletionSupport *completionSupport(Core::IEditor *editor) const = 0;
|
||||||
|
virtual CppTools::CppHighlightingSupport *highlightingSupport(Core::IEditor *editor) const = 0;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
void documentUpdated(CPlusPlus::Document::Ptr doc);
|
||||||
void sourceFilesRefreshed(const QStringList &files);
|
void sourceFilesRefreshed(const QStringList &files);
|
||||||
|
@@ -34,8 +34,6 @@
|
|||||||
#include "cppeditorconstants.h"
|
#include "cppeditorconstants.h"
|
||||||
#include "cppplugin.h"
|
#include "cppplugin.h"
|
||||||
#include "cpphighlighter.h"
|
#include "cpphighlighter.h"
|
||||||
#include "cppchecksymbols.h"
|
|
||||||
#include "cpplocalsymbols.h"
|
|
||||||
#include "cppautocompleter.h"
|
#include "cppautocompleter.h"
|
||||||
#include "cppquickfixassistant.h"
|
#include "cppquickfixassistant.h"
|
||||||
|
|
||||||
@@ -63,8 +61,11 @@
|
|||||||
|
|
||||||
#include <cpptools/cpptoolsplugin.h>
|
#include <cpptools/cpptoolsplugin.h>
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
|
#include <cpptools/cppchecksymbols.h>
|
||||||
#include <cpptools/cppcodeformatter.h>
|
#include <cpptools/cppcodeformatter.h>
|
||||||
#include <cpptools/cppcompletionassist.h>
|
#include <cpptools/cppcompletionsupport.h>
|
||||||
|
#include <cpptools/cpphighlightingsupport.h>
|
||||||
|
#include <cpptools/cpplocalsymbols.h>
|
||||||
#include <cpptools/cppqtstyleindenter.h>
|
#include <cpptools/cppqtstyleindenter.h>
|
||||||
#include <cpptools/cppcodestylesettings.h>
|
#include <cpptools/cppcodestylesettings.h>
|
||||||
#include <cpptools/cpprefactoringchanges.h>
|
#include <cpptools/cpprefactoringchanges.h>
|
||||||
@@ -124,6 +125,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
using namespace CppTools;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppEditor::Internal;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -424,7 +426,7 @@ CPPEditorWidget::CPPEditorWidget(QWidget *parent)
|
|||||||
, m_commentsSettings(CppTools::CppToolsSettings::instance()->commentsSettings())
|
, m_commentsSettings(CppTools::CppToolsSettings::instance()->commentsSettings())
|
||||||
{
|
{
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
qRegisterMetaType<CppEditor::Internal::SemanticInfo>("CppEditor::Internal::SemanticInfo");
|
qRegisterMetaType<SemanticInfo>("CppTools::SemanticInfo");
|
||||||
|
|
||||||
m_semanticHighlighter = new SemanticHighlighter(this);
|
m_semanticHighlighter = new SemanticHighlighter(this);
|
||||||
m_semanticHighlighter->start();
|
m_semanticHighlighter->start();
|
||||||
@@ -552,8 +554,8 @@ void CPPEditorWidget::createToolBar(CPPEditor *editor)
|
|||||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateUses()));
|
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateUses()));
|
||||||
connect(this, SIGNAL(textChanged()), this, SLOT(updateUses()));
|
connect(this, SIGNAL(textChanged()), this, SLOT(updateUses()));
|
||||||
|
|
||||||
connect(m_semanticHighlighter, SIGNAL(changed(CppEditor::Internal::SemanticInfo)),
|
connect(m_semanticHighlighter, SIGNAL(changed(CppTools::SemanticInfo)),
|
||||||
this, SLOT(updateSemanticInfo(CppEditor::Internal::SemanticInfo)));
|
this, SLOT(updateSemanticInfo(CppTools::SemanticInfo)));
|
||||||
|
|
||||||
editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
|
editor->insertExtraToolBarWidget(TextEditor::BaseTextEditor::Left, m_outlineCombo);
|
||||||
}
|
}
|
||||||
@@ -1849,13 +1851,13 @@ void CPPEditorWidget::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
|||||||
|
|
||||||
if (! semanticHighlighterDisabled && semanticInfo.doc) {
|
if (! semanticHighlighterDisabled && semanticInfo.doc) {
|
||||||
if (Core::EditorManager::instance()->currentEditor() == editor()) {
|
if (Core::EditorManager::instance()->currentEditor() == editor()) {
|
||||||
LookupContext context(semanticInfo.doc, semanticInfo.snapshot);
|
if (CppTools::CppHighlightingSupport *hs = modelManager()->highlightingSupport(editor())) {
|
||||||
CheckSymbols::Future f = CheckSymbols::go(semanticInfo.doc, context);
|
m_highlighter = hs->highlightingFuture(semanticInfo.doc, semanticInfo.snapshot);
|
||||||
m_highlighter = f;
|
|
||||||
m_highlightRevision = semanticInfo.revision;
|
m_highlightRevision = semanticInfo.revision;
|
||||||
m_highlightWatcher.setFuture(m_highlighter);
|
m_highlightWatcher.setFuture(m_highlighter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 // ### TODO: enable objc semantic highlighting
|
#if 0 // ### TODO: enable objc semantic highlighting
|
||||||
setExtraSelections(ObjCSelection, createSelections(document(),
|
setExtraSelections(ObjCSelection, createSelections(document(),
|
||||||
@@ -2154,21 +2156,9 @@ TextEditor::IAssistInterface *CPPEditorWidget::createAssistInterface(
|
|||||||
TextEditor::AssistReason reason) const
|
TextEditor::AssistReason reason) const
|
||||||
{
|
{
|
||||||
if (kind == TextEditor::Completion) {
|
if (kind == TextEditor::Completion) {
|
||||||
QStringList includePaths;
|
if (CppTools::CppCompletionSupport *cs = m_modelManager->completionSupport(editor()))
|
||||||
QStringList frameworkPaths;
|
return cs->createAssistInterface(ProjectExplorer::ProjectExplorerPlugin::currentProject(),
|
||||||
if (ProjectExplorer::Project *project =
|
document(), position(), reason);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::currentProject()) {
|
|
||||||
includePaths = m_modelManager->projectInfo(project).includePaths;
|
|
||||||
frameworkPaths = m_modelManager->projectInfo(project).frameworkPaths;
|
|
||||||
}
|
|
||||||
return new CppTools::Internal::CppCompletionAssistInterface(
|
|
||||||
document(),
|
|
||||||
position(),
|
|
||||||
editor()->file(),
|
|
||||||
reason,
|
|
||||||
m_modelManager->snapshot(),
|
|
||||||
includePaths,
|
|
||||||
frameworkPaths);
|
|
||||||
} else if (kind == TextEditor::QuickFix) {
|
} else if (kind == TextEditor::QuickFix) {
|
||||||
if (!semanticInfo().doc || isOutdated())
|
if (!semanticInfo().doc || isOutdated())
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
#define CPPEDITOR_H
|
#define CPPEDITOR_H
|
||||||
|
|
||||||
#include "cppeditorenums.h"
|
#include "cppeditorenums.h"
|
||||||
#include "cppsemanticinfo.h"
|
|
||||||
#include "cppfunctiondecldeflink.h"
|
#include "cppfunctiondecldeflink.h"
|
||||||
|
|
||||||
#include <cplusplus/ModelManagerInterface.h>
|
#include <cplusplus/ModelManagerInterface.h>
|
||||||
@@ -43,6 +42,7 @@
|
|||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <texteditor/quickfix.h>
|
#include <texteditor/quickfix.h>
|
||||||
#include <cpptools/commentssettings.h>
|
#include <cpptools/commentssettings.h>
|
||||||
|
#include <cpptools/cppsemanticinfo.h>
|
||||||
|
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
#include <QtCore/QMutex>
|
#include <QtCore/QMutex>
|
||||||
@@ -124,12 +124,12 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SemanticInfo semanticInfo(const Source &source);
|
CppTools::SemanticInfo semanticInfo(const Source &source);
|
||||||
|
|
||||||
void rehighlight(const Source &source);
|
void rehighlight(const Source &source);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void changed(const CppEditor::Internal::SemanticInfo &semanticInfo);
|
void changed(const CppTools::SemanticInfo &semanticInfo);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void run();
|
virtual void run();
|
||||||
@@ -142,7 +142,7 @@ private:
|
|||||||
QWaitCondition m_condition;
|
QWaitCondition m_condition;
|
||||||
bool m_done;
|
bool m_done;
|
||||||
Source m_source;
|
Source m_source;
|
||||||
SemanticInfo m_lastSemanticInfo;
|
CppTools::SemanticInfo m_lastSemanticInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPPEditor : public TextEditor::BaseTextEditor
|
class CPPEditor : public TextEditor::BaseTextEditor
|
||||||
@@ -172,7 +172,7 @@ public:
|
|||||||
|
|
||||||
unsigned editorRevision() const;
|
unsigned editorRevision() const;
|
||||||
bool isOutdated() const;
|
bool isOutdated() const;
|
||||||
SemanticInfo semanticInfo() const;
|
CppTools::SemanticInfo semanticInfo() const;
|
||||||
|
|
||||||
CPlusPlus::OverviewModel *outlineModel() const;
|
CPlusPlus::OverviewModel *outlineModel() const;
|
||||||
QModelIndex outlineModelIndex();
|
QModelIndex outlineModelIndex();
|
||||||
@@ -242,7 +242,7 @@ private Q_SLOTS:
|
|||||||
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
||||||
void onContentsChanged(int position, int charsRemoved, int charsAdded);
|
void onContentsChanged(int position, int charsRemoved, int charsAdded);
|
||||||
|
|
||||||
void updateSemanticInfo(const CppEditor::Internal::SemanticInfo &semanticInfo);
|
void updateSemanticInfo(const CppTools::SemanticInfo &semanticInfo);
|
||||||
void highlightSymbolUsages(int from, int to);
|
void highlightSymbolUsages(int from, int to);
|
||||||
void finishHighlightSymbolUsages();
|
void finishHighlightSymbolUsages();
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ private Q_SLOTS:
|
|||||||
void onCommentsSettingsChanged(const CppTools::CommentsSettings &settings);
|
void onCommentsSettingsChanged(const CppTools::CommentsSettings &settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void markSymbols(const QTextCursor &tc, const SemanticInfo &info);
|
void markSymbols(const QTextCursor &tc, const CppTools::SemanticInfo &info);
|
||||||
bool sortedOutline() const;
|
bool sortedOutline() const;
|
||||||
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol, const CPlusPlus::Snapshot &snapshot) const;
|
CPlusPlus::Symbol *findDefinition(CPlusPlus::Symbol *symbol, const CPlusPlus::Snapshot &snapshot) const;
|
||||||
|
|
||||||
@@ -264,8 +264,8 @@ private:
|
|||||||
|
|
||||||
SemanticHighlighter::Source currentSource(bool force = false);
|
SemanticHighlighter::Source currentSource(bool force = false);
|
||||||
|
|
||||||
void highlightUses(const QList<SemanticInfo::Use> &uses,
|
void highlightUses(const QList<TextEditor::SemanticHighlighter::Result> &uses,
|
||||||
const SemanticInfo &semanticInfo,
|
const CppTools::SemanticInfo &semanticInfo,
|
||||||
QList<QTextEdit::ExtraSelection> *selections);
|
QList<QTextEdit::ExtraSelection> *selections);
|
||||||
|
|
||||||
void createToolBar(CPPEditor *editable);
|
void createToolBar(CPPEditor *editable);
|
||||||
@@ -315,13 +315,13 @@ private:
|
|||||||
QTextCursor m_currentRenameSelectionEnd;
|
QTextCursor m_currentRenameSelectionEnd;
|
||||||
|
|
||||||
SemanticHighlighter *m_semanticHighlighter;
|
SemanticHighlighter *m_semanticHighlighter;
|
||||||
SemanticInfo m_lastSemanticInfo;
|
CppTools::SemanticInfo m_lastSemanticInfo;
|
||||||
QList<TextEditor::QuickFixOperation::Ptr> m_quickFixes;
|
QList<TextEditor::QuickFixOperation::Ptr> m_quickFixes;
|
||||||
bool m_objcEnabled;
|
bool m_objcEnabled;
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
|
|
||||||
QFuture<SemanticInfo::Use> m_highlighter;
|
QFuture<TextEditor::SemanticHighlighter::Result> m_highlighter;
|
||||||
QFutureWatcher<SemanticInfo::Use> m_highlightWatcher;
|
QFutureWatcher<TextEditor::SemanticHighlighter::Result> m_highlightWatcher;
|
||||||
unsigned m_highlightRevision; // the editor revision that requested the highlight
|
unsigned m_highlightRevision; // the editor revision that requested the highlight
|
||||||
|
|
||||||
QFuture<QList<int> > m_references;
|
QFuture<QList<int> > m_references;
|
||||||
|
@@ -14,11 +14,8 @@ HEADERS += cppplugin.h \
|
|||||||
cppeditorenums.h \
|
cppeditorenums.h \
|
||||||
cppeditor_global.h \
|
cppeditor_global.h \
|
||||||
cppclasswizard.h \
|
cppclasswizard.h \
|
||||||
cppchecksymbols.h \
|
|
||||||
cppsemanticinfo.h \
|
|
||||||
cppoutline.h \
|
cppoutline.h \
|
||||||
cppinsertdecldef.h \
|
cppinsertdecldef.h \
|
||||||
cpplocalsymbols.h \
|
|
||||||
cpptypehierarchy.h \
|
cpptypehierarchy.h \
|
||||||
cppelementevaluator.h \
|
cppelementevaluator.h \
|
||||||
cppautocompleter.h \
|
cppautocompleter.h \
|
||||||
@@ -36,11 +33,8 @@ SOURCES += cppplugin.cpp \
|
|||||||
cppfilewizard.cpp \
|
cppfilewizard.cpp \
|
||||||
cppclasswizard.cpp \
|
cppclasswizard.cpp \
|
||||||
cppquickfixes.cpp \
|
cppquickfixes.cpp \
|
||||||
cppchecksymbols.cpp \
|
|
||||||
cppsemanticinfo.cpp \
|
|
||||||
cppoutline.cpp \
|
cppoutline.cpp \
|
||||||
cppinsertdecldef.cpp \
|
cppinsertdecldef.cpp \
|
||||||
cpplocalsymbols.cpp \
|
|
||||||
cpptypehierarchy.cpp \
|
cpptypehierarchy.cpp \
|
||||||
cppelementevaluator.cpp \
|
cppelementevaluator.cpp \
|
||||||
cppautocompleter.cpp \
|
cppautocompleter.cpp \
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#include "cppeditor.h"
|
#include "cppeditor.h"
|
||||||
#include "cppquickfixassistant.h"
|
#include "cppquickfixassistant.h"
|
||||||
#include "cpplocalsymbols.h"
|
|
||||||
|
|
||||||
#include <cplusplus/CppRewriter.h>
|
#include <cplusplus/CppRewriter.h>
|
||||||
#include <cplusplus/ASTPath.h>
|
#include <cplusplus/ASTPath.h>
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
#include <cplusplus/TranslationUnit.h>
|
#include <cplusplus/TranslationUnit.h>
|
||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
|
#include <cpptools/cpplocalsymbols.h>
|
||||||
#include <cpptools/cpprefactoringchanges.h>
|
#include <cpptools/cpprefactoringchanges.h>
|
||||||
#include <cpptools/symbolfinder.h>
|
#include <cpptools/symbolfinder.h>
|
||||||
#include <texteditor/refactoroverlay.h>
|
#include <texteditor/refactoroverlay.h>
|
||||||
@@ -61,6 +61,7 @@
|
|||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor;
|
using namespace CppEditor;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppEditor::Internal;
|
||||||
|
using namespace CppTools;
|
||||||
|
|
||||||
FunctionDeclDefLinkFinder::FunctionDeclDefLinkFinder(QObject *parent)
|
FunctionDeclDefLinkFinder::FunctionDeclDefLinkFinder(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#ifndef CPPQUICKFIXASSISTANT_H
|
#ifndef CPPQUICKFIXASSISTANT_H
|
||||||
#define CPPQUICKFIXASSISTANT_H
|
#define CPPQUICKFIXASSISTANT_H
|
||||||
|
|
||||||
#include "cppsemanticinfo.h"
|
#include <cpptools/cppsemanticinfo.h>
|
||||||
|
|
||||||
#include <ASTfwd.h>
|
#include <ASTfwd.h>
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
const QList<CPlusPlus::AST *> &path() const;
|
const QList<CPlusPlus::AST *> &path() const;
|
||||||
CPlusPlus::Snapshot snapshot() const;
|
CPlusPlus::Snapshot snapshot() const;
|
||||||
CppEditor::Internal::SemanticInfo semanticInfo() const;
|
CppTools::SemanticInfo semanticInfo() const;
|
||||||
const CPlusPlus::LookupContext &context() const;
|
const CPlusPlus::LookupContext &context() const;
|
||||||
CPPEditorWidget *editor() const;
|
CPPEditorWidget *editor() const;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CPPEditorWidget *m_editor;
|
CPPEditorWidget *m_editor;
|
||||||
CppEditor::Internal::SemanticInfo m_semanticInfo;
|
CppTools::SemanticInfo m_semanticInfo;
|
||||||
CPlusPlus::Snapshot m_snapshot;
|
CPlusPlus::Snapshot m_snapshot;
|
||||||
CppTools::CppRefactoringFilePtr m_currentFile;
|
CppTools::CppRefactoringFilePtr m_currentFile;
|
||||||
CPlusPlus::LookupContext m_context;
|
CPlusPlus::LookupContext m_context;
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
#include <qtconcurrent/runextensions.h>
|
#include <qtconcurrent/runextensions.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppTools;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
@@ -39,6 +39,8 @@
|
|||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
#include <cplusplus/TypeOfExpression.h>
|
#include <cplusplus/TypeOfExpression.h>
|
||||||
|
|
||||||
|
#include <texteditor/semantichighlighter.h>
|
||||||
|
|
||||||
#include <ASTVisitor.h>
|
#include <ASTVisitor.h>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QFuture>
|
#include <QtCore/QFuture>
|
||||||
@@ -49,13 +51,13 @@ namespace CPlusPlus {
|
|||||||
class CheckSymbols:
|
class CheckSymbols:
|
||||||
protected ASTVisitor,
|
protected ASTVisitor,
|
||||||
public QRunnable,
|
public QRunnable,
|
||||||
public QFutureInterface<CppEditor::Internal::SemanticInfo::Use>
|
public QFutureInterface<TextEditor::SemanticHighlighter::Result>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CheckSymbols();
|
virtual ~CheckSymbols();
|
||||||
|
|
||||||
typedef CppEditor::Internal::SemanticInfo::Use Use;
|
typedef TextEditor::SemanticHighlighter::Result Use;
|
||||||
typedef CppEditor::Internal::SemanticInfo::UseKind UseKind;
|
typedef CppTools::SemanticInfo::UseKind UseKind;
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
|
72
src/plugins/cpptools/cppcompletionsupport.cpp
Normal file
72
src/plugins/cpptools/cppcompletionsupport.cpp
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "cppcompletionsupport.h"
|
||||||
|
#include "cppmodelmanager.h"
|
||||||
|
#include "cpptoolseditorsupport.h"
|
||||||
|
|
||||||
|
#include <coreplugin/ifile.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)
|
||||||
|
{
|
||||||
|
Q_ASSERT(editorSupport);
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditor::IAssistInterface *CppCompletionSupport::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,
|
||||||
|
m_editorSupport->textEditor()->file(),
|
||||||
|
reason,
|
||||||
|
modelManager->snapshot(),
|
||||||
|
includePaths,
|
||||||
|
frameworkPaths);
|
||||||
|
}
|
77
src/plugins/cpptools/cppcompletionsupport.h
Normal file
77
src/plugins/cpptools/cppcompletionsupport.h
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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_CPPCOMPLETIONSUPPORT_H
|
||||||
|
#define CPPTOOLS_CPPCOMPLETIONSUPPORT_H
|
||||||
|
|
||||||
|
#include "cpptools_global.h"
|
||||||
|
|
||||||
|
#include <texteditor/codeassist/assistenums.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QTextDocument;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
class IFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ProjectExplorer {
|
||||||
|
class Project;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
class IAssistInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CppTools {
|
||||||
|
namespace Internal {
|
||||||
|
class CppEditorSupport;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CPPTOOLS_EXPORT CppCompletionSupport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CppCompletionSupport(Internal::CppEditorSupport *editorSupport);
|
||||||
|
|
||||||
|
TextEditor::IAssistInterface *createAssistInterface(ProjectExplorer::Project *project,
|
||||||
|
QTextDocument *document,
|
||||||
|
int position,
|
||||||
|
TextEditor::AssistReason reason) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Internal::CppEditorSupport *m_editorSupport;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace CppTools
|
||||||
|
|
||||||
|
#endif // CPPTOOLS_CPPCOMPLETIONSUPPORT_H
|
52
src/plugins/cpptools/cpphighlightingsupport.cpp
Normal file
52
src/plugins/cpptools/cpphighlightingsupport.cpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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 "cpphighlightingsupport.h"
|
||||||
|
#include "cpptoolseditorsupport.h"
|
||||||
|
|
||||||
|
#include <cplusplus/LookupContext.h>
|
||||||
|
|
||||||
|
using namespace CPlusPlus;
|
||||||
|
using namespace CppTools;
|
||||||
|
using namespace CppTools::Internal;
|
||||||
|
|
||||||
|
CppHighlightingSupport::CppHighlightingSupport()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QFuture<CppHighlightingSupport::Use> CppHighlightingSupport::highlightingFuture(
|
||||||
|
const Document::Ptr &doc, const Snapshot &snapshot) const
|
||||||
|
{
|
||||||
|
LookupContext context(doc, snapshot);
|
||||||
|
return CheckSymbols::go(doc, context);
|
||||||
|
}
|
62
src/plugins/cpptools/cpphighlightingsupport.h
Normal file
62
src/plugins/cpptools/cpphighlightingsupport.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** 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_CPPHIGHLIGHTINGSUPPORT_H
|
||||||
|
#define CPPTOOLS_CPPHIGHLIGHTINGSUPPORT_H
|
||||||
|
|
||||||
|
#include "cpptools_global.h"
|
||||||
|
|
||||||
|
#include <cplusplus/CppDocument.h>
|
||||||
|
#include <texteditor/semantichighlighter.h>
|
||||||
|
|
||||||
|
#include <QtCore/QFuture>
|
||||||
|
|
||||||
|
namespace CppTools {
|
||||||
|
namespace Internal {
|
||||||
|
class CppEditorSupport;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CPPTOOLS_EXPORT CppHighlightingSupport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef TextEditor::SemanticHighlighter::Result Use;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CppHighlightingSupport();
|
||||||
|
|
||||||
|
QFuture<Use> highlightingFuture(const CPlusPlus::Document::Ptr &doc,
|
||||||
|
const CPlusPlus::Snapshot &snapshot) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace CppTools
|
||||||
|
|
||||||
|
#endif // CPPTOOLS_CPPHIGHLIGHTINGSUPPORT_H
|
@@ -43,7 +43,7 @@
|
|||||||
#include <Literals.h>
|
#include <Literals.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppTools;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
@@ -33,14 +33,15 @@
|
|||||||
#ifndef CPPLOCALSYMBOLS_H
|
#ifndef CPPLOCALSYMBOLS_H
|
||||||
#define CPPLOCALSYMBOLS_H
|
#define CPPLOCALSYMBOLS_H
|
||||||
|
|
||||||
|
#include "cpptools_global.h"
|
||||||
#include "cppsemanticinfo.h"
|
#include "cppsemanticinfo.h"
|
||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <ASTfwd.h>
|
#include <ASTfwd.h>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppTools {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class LocalSymbols
|
class CPPTOOLS_EXPORT LocalSymbols
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY(LocalSymbols)
|
Q_DISABLE_COPY(LocalSymbols)
|
||||||
|
|
||||||
@@ -52,7 +53,6 @@ public:
|
|||||||
SemanticInfo::LocalUseMap uses;
|
SemanticInfo::LocalUseMap uses;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace CppTools
|
||||||
} // namespace CppEditor
|
|
||||||
|
|
||||||
#endif // CPPLOCALSYMBOLS_H
|
#endif // CPPLOCALSYMBOLS_H
|
@@ -1308,6 +1308,21 @@ void CppModelManager::finishedRefreshingSourceFiles(const QStringList &files)
|
|||||||
emit sourceFilesRefreshed(files);
|
emit sourceFilesRefreshed(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CppCompletionSupport *CppModelManager::completionSupport(Core::IEditor *editor) const
|
||||||
|
{
|
||||||
|
if (CppEditorSupport *es = editorSupport(qobject_cast<TextEditor::ITextEditor *>(editor)))
|
||||||
|
return es->completionSupport();
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CppHighlightingSupport *CppModelManager::highlightingSupport(Core::IEditor *editor) const
|
||||||
|
{
|
||||||
|
if (CppEditorSupport *es = editorSupport(qobject_cast<TextEditor::ITextEditor *>(editor)))
|
||||||
|
return es->highlightingSupport();
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void CppModelManager::setExtraDiagnostics(const QString &fileName, int kind,
|
void CppModelManager::setExtraDiagnostics(const QString &fileName, int kind,
|
||||||
const QList<Document::DiagnosticMessage> &diagnostics)
|
const QList<Document::DiagnosticMessage> &diagnostics)
|
||||||
|
@@ -131,9 +131,11 @@ public:
|
|||||||
virtual QList<CPlusPlus::Document::DiagnosticMessage> extraDiagnostics(
|
virtual QList<CPlusPlus::Document::DiagnosticMessage> extraDiagnostics(
|
||||||
const QString &fileName, int key = AllExtraDiagnostics) const;
|
const QString &fileName, int key = AllExtraDiagnostics) const;
|
||||||
|
|
||||||
|
|
||||||
void finishedRefreshingSourceFiles(const QStringList &files);
|
void finishedRefreshingSourceFiles(const QStringList &files);
|
||||||
|
|
||||||
|
virtual CppCompletionSupport *completionSupport(Core::IEditor *editor) const;
|
||||||
|
virtual CppHighlightingSupport *highlightingSupport(Core::IEditor *editor) const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void projectPathChanged(const QString &projectPath);
|
void projectPathChanged(const QString &projectPath);
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "cppsemanticinfo.h"
|
#include "cppsemanticinfo.h"
|
||||||
|
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppTools;
|
||||||
|
|
||||||
SemanticInfo::SemanticInfo()
|
SemanticInfo::SemanticInfo()
|
||||||
: revision(0), hasQ(false), hasD(false), forced(false)
|
: revision(0), hasQ(false), hasD(false), forced(false)
|
@@ -33,20 +33,18 @@
|
|||||||
#ifndef CPPSEMANTICINFO_H
|
#ifndef CPPSEMANTICINFO_H
|
||||||
#define CPPSEMANTICINFO_H
|
#define CPPSEMANTICINFO_H
|
||||||
|
|
||||||
|
#include "cpptools_global.h"
|
||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
#include <texteditor/semantichighlighter.h>
|
#include <texteditor/semantichighlighter.h>
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppTools {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CPPEditorWidget;
|
class CPPTOOLS_EXPORT SemanticInfo
|
||||||
|
|
||||||
class SemanticInfo
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef TextEditor::SemanticHighlighter::Result Use;
|
|
||||||
enum UseKind {
|
enum UseKind {
|
||||||
TypeUse = 0,
|
TypeUse = 0,
|
||||||
LocalUse,
|
LocalUse,
|
||||||
@@ -54,6 +52,7 @@ public:
|
|||||||
StaticUse,
|
StaticUse,
|
||||||
VirtualMethodUse
|
VirtualMethodUse
|
||||||
};
|
};
|
||||||
|
typedef TextEditor::SemanticHighlighter::Result Use;
|
||||||
|
|
||||||
typedef QHash<CPlusPlus::Symbol *, QList<Use> > LocalUseMap;
|
typedef QHash<CPlusPlus::Symbol *, QList<Use> > LocalUseMap;
|
||||||
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;
|
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;
|
||||||
@@ -70,7 +69,6 @@ public:
|
|||||||
QList<Use> objcKeywords;
|
QList<Use> objcKeywords;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace CppTools
|
||||||
} // namespace CppEditor;
|
|
||||||
|
|
||||||
#endif // CPPSEMANTICINFO_H
|
#endif // CPPSEMANTICINFO_H
|
@@ -38,7 +38,12 @@ HEADERS += completionsettingspage.h \
|
|||||||
cpptoolsreuse.h \
|
cpptoolsreuse.h \
|
||||||
doxygengenerator.h \
|
doxygengenerator.h \
|
||||||
commentssettings.h \
|
commentssettings.h \
|
||||||
symbolfinder.h
|
symbolfinder.h \
|
||||||
|
cppcompletionsupport.h \
|
||||||
|
cpphighlightingsupport.h \
|
||||||
|
cppchecksymbols.h \
|
||||||
|
cpplocalsymbols.h \
|
||||||
|
cppsemanticinfo.h
|
||||||
|
|
||||||
SOURCES += completionsettingspage.cpp \
|
SOURCES += completionsettingspage.cpp \
|
||||||
cppclassesfilter.cpp \
|
cppclassesfilter.cpp \
|
||||||
@@ -68,7 +73,12 @@ SOURCES += completionsettingspage.cpp \
|
|||||||
cpptoolsreuse.cpp \
|
cpptoolsreuse.cpp \
|
||||||
doxygengenerator.cpp \
|
doxygengenerator.cpp \
|
||||||
commentssettings.cpp \
|
commentssettings.cpp \
|
||||||
symbolfinder.cpp
|
symbolfinder.cpp \
|
||||||
|
cppcompletionsupport.cpp \
|
||||||
|
cpphighlightingsupport.cpp \
|
||||||
|
cppchecksymbols.cpp \
|
||||||
|
cpplocalsymbols.cpp \
|
||||||
|
cppsemanticinfo.cpp
|
||||||
|
|
||||||
FORMS += completionsettingspage.ui \
|
FORMS += completionsettingspage.ui \
|
||||||
cppfilesettingspage.ui \
|
cppfilesettingspage.ui \
|
||||||
|
@@ -30,6 +30,8 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include "cppcompletionsupport.h"
|
||||||
|
#include "cpphighlightingsupport.h"
|
||||||
#include "cpptoolseditorsupport.h"
|
#include "cpptoolseditorsupport.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
|
|
||||||
@@ -44,13 +46,16 @@
|
|||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
|
using namespace CppTools;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
CppEditorSupport::CppEditorSupport(CppModelManager *modelManager)
|
CppEditorSupport::CppEditorSupport(CppModelManager *modelManager)
|
||||||
: QObject(modelManager),
|
: QObject(modelManager),
|
||||||
_modelManager(modelManager),
|
_modelManager(modelManager),
|
||||||
_updateDocumentInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL)
|
_updateDocumentInterval(UPDATE_DOCUMENT_DEFAULT_INTERVAL),
|
||||||
|
m_completionSupport(new CppCompletionSupport(this)),
|
||||||
|
m_highlightingSupport(new CppHighlightingSupport)
|
||||||
{
|
{
|
||||||
_revision = 0;
|
_revision = 0;
|
||||||
|
|
||||||
@@ -98,6 +103,16 @@ unsigned CppEditorSupport::editorRevision() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CppTools::CppCompletionSupport *CppEditorSupport::completionSupport() const
|
||||||
|
{
|
||||||
|
return m_completionSupport.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
CppHighlightingSupport *CppEditorSupport::highlightingSupport() const
|
||||||
|
{
|
||||||
|
return m_highlightingSupport.data();
|
||||||
|
}
|
||||||
|
|
||||||
int CppEditorSupport::updateDocumentInterval() const
|
int CppEditorSupport::updateDocumentInterval() const
|
||||||
{ return _updateDocumentInterval; }
|
{ return _updateDocumentInterval; }
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
#include <QtCore/QFuture>
|
#include <QtCore/QFuture>
|
||||||
|
#include <QtCore/QScopedPointer>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
|
|
||||||
#include <QtGui/QTextCursor>
|
#include <QtGui/QTextCursor>
|
||||||
@@ -56,6 +57,10 @@ namespace TextEditor {
|
|||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
|
class CppCompletionSupport;
|
||||||
|
class CppHighlightingSupport;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppModelManager;
|
class CppModelManager;
|
||||||
@@ -77,6 +82,9 @@ public:
|
|||||||
QString contents();
|
QString contents();
|
||||||
unsigned editorRevision() const;
|
unsigned editorRevision() const;
|
||||||
|
|
||||||
|
CppCompletionSupport *completionSupport() const;
|
||||||
|
CppHighlightingSupport *highlightingSupport() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void contentsChanged();
|
void contentsChanged();
|
||||||
|
|
||||||
@@ -94,6 +102,8 @@ private:
|
|||||||
QFuture<void> _documentParser;
|
QFuture<void> _documentParser;
|
||||||
QString _cachedContents;
|
QString _cachedContents;
|
||||||
unsigned _revision;
|
unsigned _revision;
|
||||||
|
QScopedPointer<CppCompletionSupport> m_completionSupport;
|
||||||
|
QScopedPointer<CppHighlightingSupport> m_highlightingSupport;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user