forked from qt-creator/qt-creator
CppEditor: Remove unneeded CppEditorWidgetInterface
Removes a pseudo-abstraction and simplifies ClangdClient. Change-Id: I5161d069371ff92a517866bb7500517cab6781b7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
#include <cppeditor/cppcodemodelsettings.h>
|
#include <cppeditor/cppcodemodelsettings.h>
|
||||||
#include <cppeditor/cppdoxygen.h>
|
#include <cppeditor/cppdoxygen.h>
|
||||||
#include <cppeditor/cppeditorwidgetinterface.h>
|
#include <cppeditor/cppeditorwidget.h>
|
||||||
#include <cppeditor/cppfindreferences.h>
|
#include <cppeditor/cppfindreferences.h>
|
||||||
#include <cppeditor/cppmodelmanager.h>
|
#include <cppeditor/cppmodelmanager.h>
|
||||||
#include <cppeditor/cpptoolsreuse.h>
|
#include <cppeditor/cpptoolsreuse.h>
|
||||||
@@ -532,7 +532,7 @@ private:
|
|||||||
class ClangdClient::FollowSymbolData {
|
class ClangdClient::FollowSymbolData {
|
||||||
public:
|
public:
|
||||||
FollowSymbolData(ClangdClient *q, quint64 id, const QTextCursor &cursor,
|
FollowSymbolData(ClangdClient *q, quint64 id, const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidgetInterface *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
const DocumentUri &uri, Utils::ProcessLinkCallback &&callback,
|
const DocumentUri &uri, Utils::ProcessLinkCallback &&callback,
|
||||||
bool openInSplit)
|
bool openInSplit)
|
||||||
: q(q), id(id), cursor(cursor), editorWidget(editorWidget), uri(uri),
|
: q(q), id(id), cursor(cursor), editorWidget(editorWidget), uri(uri),
|
||||||
@@ -561,19 +561,10 @@ public:
|
|||||||
openedFiles.clear();
|
openedFiles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEditorWidgetStillAlive() const
|
|
||||||
{
|
|
||||||
return Utils::anyOf(EditorManager::visibleEditors(), [this](IEditor *editor) {
|
|
||||||
const auto textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor);
|
|
||||||
return textEditor && dynamic_cast<CppEditor::CppEditorWidgetInterface *>(
|
|
||||||
textEditor->editorWidget()) == editorWidget;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangdClient * const q;
|
ClangdClient * const q;
|
||||||
const quint64 id;
|
const quint64 id;
|
||||||
const QTextCursor cursor;
|
const QTextCursor cursor;
|
||||||
CppEditor::CppEditorWidgetInterface * const editorWidget;
|
const QPointer<CppEditor::CppEditorWidget> editorWidget;
|
||||||
const DocumentUri uri;
|
const DocumentUri uri;
|
||||||
const Utils::ProcessLinkCallback callback;
|
const Utils::ProcessLinkCallback callback;
|
||||||
VirtualFunctionAssistProvider virtualFuncAssistProvider;
|
VirtualFunctionAssistProvider virtualFuncAssistProvider;
|
||||||
@@ -596,7 +587,7 @@ public:
|
|||||||
class SwitchDeclDefData {
|
class SwitchDeclDefData {
|
||||||
public:
|
public:
|
||||||
SwitchDeclDefData(quint64 id, TextEditor::TextDocument *doc, const QTextCursor &cursor,
|
SwitchDeclDefData(quint64 id, TextEditor::TextDocument *doc, const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidgetInterface *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::ProcessLinkCallback &&callback)
|
Utils::ProcessLinkCallback &&callback)
|
||||||
: id(id), document(doc), uri(DocumentUri::fromFilePath(doc->filePath())),
|
: id(id), document(doc), uri(DocumentUri::fromFilePath(doc->filePath())),
|
||||||
cursor(cursor), editorWidget(editorWidget), callback(std::move(callback)) {}
|
cursor(cursor), editorWidget(editorWidget), callback(std::move(callback)) {}
|
||||||
@@ -639,7 +630,7 @@ public:
|
|||||||
const QPointer<TextEditor::TextDocument> document;
|
const QPointer<TextEditor::TextDocument> document;
|
||||||
const DocumentUri uri;
|
const DocumentUri uri;
|
||||||
const QTextCursor cursor;
|
const QTextCursor cursor;
|
||||||
CppEditor::CppEditorWidgetInterface * const editorWidget;
|
const QPointer<CppEditor::CppEditorWidget> editorWidget;
|
||||||
Utils::ProcessLinkCallback callback;
|
Utils::ProcessLinkCallback callback;
|
||||||
Utils::optional<DocumentSymbolsResult> docSymbols;
|
Utils::optional<DocumentSymbolsResult> docSymbols;
|
||||||
Utils::optional<AstNode> ast;
|
Utils::optional<AstNode> ast;
|
||||||
@@ -1346,10 +1337,9 @@ void ClangdClient::Private::finishSearch(const ReferencesData &refData, bool can
|
|||||||
runningFindUsages.remove(refData.key);
|
runningFindUsages.remove(refData.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdClient::followSymbol(
|
void ClangdClient::followSymbol(TextEditor::TextDocument *document,
|
||||||
TextEditor::TextDocument *document,
|
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidgetInterface *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::ProcessLinkCallback &&callback,
|
Utils::ProcessLinkCallback &&callback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool openInSplit
|
bool openInSplit
|
||||||
@@ -1409,7 +1399,7 @@ void ClangdClient::followSymbol(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClangdClient::switchDeclDef(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
void ClangdClient::switchDeclDef(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidgetInterface *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::ProcessLinkCallback &&callback)
|
Utils::ProcessLinkCallback &&callback)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(documentOpen(document), openDocument(document));
|
QTC_ASSERT(documentOpen(document), openDocument(document));
|
||||||
@@ -1767,7 +1757,7 @@ void ClangdClient::Private::handleGotoImplementationResult(
|
|||||||
// As soon as we know that there is more than one candidate, we start the code assist
|
// As soon as we know that there is more than one candidate, we start the code assist
|
||||||
// procedure, to let the user know that things are happening.
|
// procedure, to let the user know that things are happening.
|
||||||
if (followSymbolData->allLinks.size() > 1 && !followSymbolData->virtualFuncAssistProcessor
|
if (followSymbolData->allLinks.size() > 1 && !followSymbolData->virtualFuncAssistProcessor
|
||||||
&& followSymbolData->isEditorWidgetStillAlive()) {
|
&& followSymbolData->editorWidget) {
|
||||||
followSymbolData->editorWidget->invokeTextEditorWidgetAssist(
|
followSymbolData->editorWidget->invokeTextEditorWidgetAssist(
|
||||||
TextEditor::FollowSymbol, &followSymbolData->virtualFuncAssistProvider);
|
TextEditor::FollowSymbol, &followSymbolData->virtualFuncAssistProvider);
|
||||||
}
|
}
|
||||||
@@ -2745,17 +2735,17 @@ void ClangdClient::VirtualFunctionAssistProcessor::cancel()
|
|||||||
|
|
||||||
void ClangdClient::VirtualFunctionAssistProcessor::update()
|
void ClangdClient::VirtualFunctionAssistProcessor::update()
|
||||||
{
|
{
|
||||||
if (!m_data->followSymbolData->isEditorWidgetStillAlive())
|
if (!m_data->followSymbolData->editorWidget)
|
||||||
return;
|
return;
|
||||||
setAsyncProposalAvailable(createProposal(false));
|
setAsyncProposalAvailable(createProposal(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdClient::VirtualFunctionAssistProcessor::finalize()
|
void ClangdClient::VirtualFunctionAssistProcessor::finalize()
|
||||||
{
|
{
|
||||||
if (!m_data->followSymbolData->isEditorWidgetStillAlive())
|
if (!m_data->followSymbolData->editorWidget)
|
||||||
return;
|
return;
|
||||||
const auto proposal = createProposal(true);
|
const auto proposal = createProposal(true);
|
||||||
if (m_data->followSymbolData->editorWidget->inTestMode) {
|
if (m_data->followSymbolData->editorWidget->isInTestMode()) {
|
||||||
m_data->followSymbolData->symbolsToDisplay.clear();
|
m_data->followSymbolData->symbolsToDisplay.clear();
|
||||||
const auto immediateProposal = createProposal(false);
|
const auto immediateProposal = createProposal(false);
|
||||||
m_data->followSymbolData->editorWidget->setProposals(immediateProposal, proposal);
|
m_data->followSymbolData->editorWidget->setProposals(immediateProposal, proposal);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QVersionNumber>
|
#include <QVersionNumber>
|
||||||
|
|
||||||
namespace Core { class SearchResultItem; }
|
namespace Core { class SearchResultItem; }
|
||||||
namespace CppEditor { class CppEditorWidgetInterface; }
|
namespace CppEditor { class CppEditorWidget; }
|
||||||
namespace ProjectExplorer { class Project; }
|
namespace ProjectExplorer { class Project; }
|
||||||
namespace TextEditor { class BaseTextEditor; }
|
namespace TextEditor { class BaseTextEditor; }
|
||||||
|
|
||||||
@@ -61,14 +61,14 @@ public:
|
|||||||
const Utils::optional<QString> &replacement);
|
const Utils::optional<QString> &replacement);
|
||||||
void followSymbol(TextEditor::TextDocument *document,
|
void followSymbol(TextEditor::TextDocument *document,
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidgetInterface *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::ProcessLinkCallback &&callback,
|
Utils::ProcessLinkCallback &&callback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool openInSplit);
|
bool openInSplit);
|
||||||
|
|
||||||
void switchDeclDef(TextEditor::TextDocument *document,
|
void switchDeclDef(TextEditor::TextDocument *document,
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidgetInterface *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::ProcessLinkCallback &&callback);
|
Utils::ProcessLinkCallback &&callback);
|
||||||
|
|
||||||
void findLocalUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
void findLocalUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ add_qtc_plugin(CppEditor
|
|||||||
cppeditoroutline.cpp cppeditoroutline.h
|
cppeditoroutline.cpp cppeditoroutline.h
|
||||||
cppeditorplugin.cpp cppeditorplugin.h
|
cppeditorplugin.cpp cppeditorplugin.h
|
||||||
cppeditorwidget.cpp cppeditorwidget.h
|
cppeditorwidget.cpp cppeditorwidget.h
|
||||||
cppeditorwidgetinterface.h
|
|
||||||
cppelementevaluator.cpp cppelementevaluator.h
|
cppelementevaluator.cpp cppelementevaluator.h
|
||||||
cppfileiterationorder.cpp cppfileiterationorder.h
|
cppfileiterationorder.cpp cppfileiterationorder.h
|
||||||
cppfilesettingspage.cpp cppfilesettingspage.h cppfilesettingspage.ui
|
cppfilesettingspage.cpp cppfilesettingspage.h cppfilesettingspage.ui
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ HEADERS += \
|
|||||||
cppeditoroutline.h \
|
cppeditoroutline.h \
|
||||||
cppeditorplugin.h \
|
cppeditorplugin.h \
|
||||||
cppeditorwidget.h \
|
cppeditorwidget.h \
|
||||||
cppeditorwidgetinterface.h \
|
|
||||||
cppelementevaluator.h \
|
cppelementevaluator.h \
|
||||||
cppfileiterationorder.h \
|
cppfileiterationorder.h \
|
||||||
cppfilesettingspage.h \
|
cppfilesettingspage.h \
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ QtcPlugin {
|
|||||||
"cppeditoroutline.h",
|
"cppeditoroutline.h",
|
||||||
"cppeditorplugin.cpp",
|
"cppeditorplugin.cpp",
|
||||||
"cppeditorplugin.h",
|
"cppeditorplugin.h",
|
||||||
"cppeditorwidgetinterface.h",
|
|
||||||
"cppelementevaluator.cpp",
|
"cppelementevaluator.cpp",
|
||||||
"cppelementevaluator.h",
|
"cppelementevaluator.h",
|
||||||
"cppfileiterationorder.cpp",
|
"cppfileiterationorder.cpp",
|
||||||
|
|||||||
@@ -32,9 +32,9 @@
|
|||||||
namespace TextEditor { class BaseTextEditor; }
|
namespace TextEditor { class BaseTextEditor; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
|
||||||
class CppEditorWidget;
|
class CppEditorWidget;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
namespace Tests {
|
namespace Tests {
|
||||||
|
|
||||||
class GenericCppTestDocument : public CppEditor::Tests::BaseCppTestDocument
|
class GenericCppTestDocument : public CppEditor::Tests::BaseCppTestDocument
|
||||||
|
|||||||
@@ -427,6 +427,7 @@ public:
|
|||||||
CppLocalRenaming m_localRenaming;
|
CppLocalRenaming m_localRenaming;
|
||||||
CppUseSelectionsUpdater m_useSelectionsUpdater;
|
CppUseSelectionsUpdater m_useSelectionsUpdater;
|
||||||
CppSelectionChanger m_cppSelectionChanger;
|
CppSelectionChanger m_cppSelectionChanger;
|
||||||
|
bool inTestMode = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
|
CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
|
||||||
@@ -437,6 +438,9 @@ CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q)
|
|||||||
, m_useSelectionsUpdater(q)
|
, m_useSelectionsUpdater(q)
|
||||||
, m_cppSelectionChanger()
|
, m_cppSelectionChanger()
|
||||||
{}
|
{}
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
|
using namespace Internal;
|
||||||
|
|
||||||
CppEditorWidget::CppEditorWidget()
|
CppEditorWidget::CppEditorWidget()
|
||||||
: d(new CppEditorWidgetPrivate(this))
|
: d(new CppEditorWidgetPrivate(this))
|
||||||
@@ -594,7 +598,7 @@ void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *o
|
|||||||
void CppEditorWidget::setProposals(const TextEditor::IAssistProposal *immediateProposal,
|
void CppEditorWidget::setProposals(const TextEditor::IAssistProposal *immediateProposal,
|
||||||
const TextEditor::IAssistProposal *finalProposal)
|
const TextEditor::IAssistProposal *finalProposal)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(inTestMode, return);
|
QTC_ASSERT(isInTestMode(), return);
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
emit proposalsReady(immediateProposal, finalProposal);
|
emit proposalsReady(immediateProposal, finalProposal);
|
||||||
#endif
|
#endif
|
||||||
@@ -1504,7 +1508,12 @@ const QList<QTextEdit::ExtraSelection> CppEditorWidget::unselectLeadingWhitespac
|
|||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
bool CppEditorWidget::isInTestMode() const { return d->inTestMode; }
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
void CppEditorWidget::enableTestMode() { d->inTestMode = true; }
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
|
||||||
#include "cppeditorwidget.moc"
|
#include "cppeditorwidget.moc"
|
||||||
|
|||||||
@@ -25,12 +25,18 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "cppeditor_global.h"
|
||||||
|
|
||||||
|
#include <texteditor/codeassist/assistenums.h>
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
|
||||||
#include "cppeditorwidgetinterface.h"
|
|
||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
class IAssistProposal;
|
||||||
|
class IAssistProvider;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
class FollowSymbolInterface;
|
class FollowSymbolInterface;
|
||||||
class SemanticInfo;
|
class SemanticInfo;
|
||||||
@@ -41,8 +47,9 @@ class CppEditorDocument;
|
|||||||
class CppEditorOutline;
|
class CppEditorOutline;
|
||||||
class CppEditorWidgetPrivate;
|
class CppEditorWidgetPrivate;
|
||||||
class FunctionDeclDefLink;
|
class FunctionDeclDefLink;
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
class CppEditorWidget : public TextEditor::TextEditorWidget, public CppEditorWidgetInterface
|
class CPPEDITOR_EXPORT CppEditorWidget : public TextEditor::TextEditorWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -50,14 +57,14 @@ public:
|
|||||||
CppEditorWidget();
|
CppEditorWidget();
|
||||||
~CppEditorWidget() override;
|
~CppEditorWidget() override;
|
||||||
|
|
||||||
CppEditorDocument *cppEditorDocument() const;
|
Internal::CppEditorDocument *cppEditorDocument() const;
|
||||||
CppEditorOutline *outline() const;
|
Internal::CppEditorOutline *outline() const;
|
||||||
|
|
||||||
bool isSemanticInfoValidExceptLocalUses() const;
|
bool isSemanticInfoValidExceptLocalUses() const;
|
||||||
bool isSemanticInfoValid() const;
|
bool isSemanticInfoValid() const;
|
||||||
bool isRenaming() const;
|
bool isRenaming() const;
|
||||||
|
|
||||||
QSharedPointer<FunctionDeclDefLink> declDefLink() const;
|
QSharedPointer<Internal::FunctionDeclDefLink> declDefLink() const;
|
||||||
void applyDeclDefLinkChanges(bool jumpToMatch);
|
void applyDeclDefLinkChanges(bool jumpToMatch);
|
||||||
|
|
||||||
TextEditor::AssistInterface *createAssistInterface(
|
TextEditor::AssistInterface *createAssistInterface(
|
||||||
@@ -71,7 +78,7 @@ public:
|
|||||||
void selectAll() override;
|
void selectAll() override;
|
||||||
|
|
||||||
void switchDeclarationDefinition(bool inNextSplit);
|
void switchDeclarationDefinition(bool inNextSplit);
|
||||||
void showPreProcessorWidget() override;
|
void showPreProcessorWidget();
|
||||||
|
|
||||||
void findUsages() override;
|
void findUsages() override;
|
||||||
void findUsages(QTextCursor cursor);
|
void findUsages(QTextCursor cursor);
|
||||||
@@ -85,15 +92,19 @@ public:
|
|||||||
static void updateWidgetHighlighting(QWidget *widget, bool highlight);
|
static void updateWidgetHighlighting(QWidget *widget, bool highlight);
|
||||||
static bool isWidgetHighlighted(QWidget *widget);
|
static bool isWidgetHighlighted(QWidget *widget);
|
||||||
|
|
||||||
SemanticInfo semanticInfo() const override;
|
SemanticInfo semanticInfo() const;
|
||||||
void updateSemanticInfo() override;
|
void updateSemanticInfo();
|
||||||
void invokeTextEditorWidgetAssist(TextEditor::AssistKind assistKind,
|
void invokeTextEditorWidgetAssist(TextEditor::AssistKind assistKind,
|
||||||
TextEditor::IAssistProvider *provider) override;
|
TextEditor::IAssistProvider *provider);
|
||||||
|
|
||||||
static const QList<QTextEdit::ExtraSelection>
|
static const QList<QTextEdit::ExtraSelection>
|
||||||
unselectLeadingWhitespace(const QList<QTextEdit::ExtraSelection> &selections);
|
unselectLeadingWhitespace(const QList<QTextEdit::ExtraSelection> &selections);
|
||||||
|
|
||||||
|
bool isInTestMode() const;
|
||||||
|
void setProposals(const TextEditor::IAssistProposal *immediateProposal,
|
||||||
|
const TextEditor::IAssistProposal *finalProposal);
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
void enableTestMode();
|
||||||
signals:
|
signals:
|
||||||
void proposalsReady(const TextEditor::IAssistProposal *immediateProposal,
|
void proposalsReady(const TextEditor::IAssistProposal *immediateProposal,
|
||||||
const TextEditor::IAssistProposal *finalProposal);
|
const TextEditor::IAssistProposal *finalProposal);
|
||||||
@@ -116,7 +127,7 @@ private:
|
|||||||
void updateFunctionDeclDefLink();
|
void updateFunctionDeclDefLink();
|
||||||
void updateFunctionDeclDefLinkNow();
|
void updateFunctionDeclDefLinkNow();
|
||||||
void abortDeclDefLink();
|
void abortDeclDefLink();
|
||||||
void onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefLink> link);
|
void onFunctionDeclDefLinkFound(QSharedPointer<Internal::FunctionDeclDefLink> link);
|
||||||
|
|
||||||
void onCppDocumentUpdated();
|
void onCppDocumentUpdated();
|
||||||
|
|
||||||
@@ -137,9 +148,6 @@ private:
|
|||||||
void finalizeInitialization() override;
|
void finalizeInitialization() override;
|
||||||
void finalizeInitializationAfterDuplication(TextEditorWidget *other) override;
|
void finalizeInitializationAfterDuplication(TextEditorWidget *other) override;
|
||||||
|
|
||||||
void setProposals(const TextEditor::IAssistProposal *immediateProposal,
|
|
||||||
const TextEditor::IAssistProposal *finalProposal) override;
|
|
||||||
|
|
||||||
unsigned documentRevision() const;
|
unsigned documentRevision() const;
|
||||||
|
|
||||||
QMenu *createRefactorMenu(QWidget *parent) const;
|
QMenu *createRefactorMenu(QWidget *parent) const;
|
||||||
@@ -149,8 +157,7 @@ private:
|
|||||||
const ProjectPart *projectPart() const;
|
const ProjectPart *projectPart() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<CppEditorWidgetPrivate> d;
|
QScopedPointer<Internal::CppEditorWidgetPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace CppEditor
|
} // namespace CppEditor
|
||||||
|
|||||||
@@ -1,60 +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 "cppeditor_global.h"
|
|
||||||
|
|
||||||
#include <texteditor/codeassist/assistenums.h>
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
namespace TextEditor {
|
|
||||||
class IAssistProposal;
|
|
||||||
class IAssistProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CppEditor {
|
|
||||||
|
|
||||||
class SemanticInfo;
|
|
||||||
|
|
||||||
// FIXME: Remove
|
|
||||||
class CPPEDITOR_EXPORT CppEditorWidgetInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void showPreProcessorWidget() = 0;
|
|
||||||
virtual SemanticInfo semanticInfo() const = 0;
|
|
||||||
virtual void updateSemanticInfo() = 0;
|
|
||||||
|
|
||||||
virtual void invokeTextEditorWidgetAssist(TextEditor::AssistKind assistKind,
|
|
||||||
TextEditor::IAssistProvider *provider) = 0;
|
|
||||||
|
|
||||||
virtual void setProposals(const TextEditor::IAssistProposal *immediateProposal,
|
|
||||||
const TextEditor::IAssistProposal *finalProposal) = 0;
|
|
||||||
|
|
||||||
bool inTestMode = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace CppEditor
|
|
||||||
@@ -24,10 +24,12 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "cppfollowsymbolundercursor.h"
|
#include "cppfollowsymbolundercursor.h"
|
||||||
#include "cppvirtualfunctionassistprovider.h"
|
|
||||||
|
#include "cppeditorwidget.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "functionutils.h"
|
|
||||||
#include "cpptoolsreuse.h"
|
#include "cpptoolsreuse.h"
|
||||||
|
#include "cppvirtualfunctionassistprovider.h"
|
||||||
|
#include "functionutils.h"
|
||||||
#include "symbolfinder.h"
|
#include "symbolfinder.h"
|
||||||
|
|
||||||
#include <cplusplus/ASTPath.h>
|
#include <cplusplus/ASTPath.h>
|
||||||
@@ -613,7 +615,7 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CppEditorWidgetInterface *editorWidget = data.editorWidget();
|
CppEditorWidget *editorWidget = data.editorWidget();
|
||||||
if (!editorWidget)
|
if (!editorWidget)
|
||||||
return processLinkCallback(link);
|
return processLinkCallback(link);
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,10 @@
|
|||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
|
class CppEditorWidget;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppEditorWidget;
|
|
||||||
class FunctionDeclDefLink;
|
class FunctionDeclDefLink;
|
||||||
|
|
||||||
class FunctionDeclDefLinkFinder : public QObject
|
class FunctionDeclDefLinkFinder : public QObject
|
||||||
|
|||||||
@@ -34,13 +34,12 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
|
class CppEditorWidget;
|
||||||
class CppRefactoringFile;
|
class CppRefactoringFile;
|
||||||
using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>;
|
using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CppEditorWidget;
|
|
||||||
|
|
||||||
class CppQuickFixInterface : public TextEditor::AssistInterface
|
class CppQuickFixInterface : public TextEditor::AssistInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "cpprefactoringengine.h"
|
#include "cpprefactoringengine.h"
|
||||||
|
|
||||||
#include "cppcanonicalsymbol.h"
|
#include "cppcanonicalsymbol.h"
|
||||||
|
#include "cppeditorwidget.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "cppsemanticinfo.h"
|
#include "cppsemanticinfo.h"
|
||||||
#include "cpptoolsreuse.h"
|
#include "cpptoolsreuse.h"
|
||||||
@@ -42,7 +43,7 @@ void CppRefactoringEngine::startLocalRenaming(const CursorInEditor &data,
|
|||||||
const ProjectPart *,
|
const ProjectPart *,
|
||||||
RenameCallback &&renameSymbolsCallback)
|
RenameCallback &&renameSymbolsCallback)
|
||||||
{
|
{
|
||||||
CppEditorWidgetInterface *editorWidget = data.editorWidget();
|
CppEditorWidget *editorWidget = data.editorWidget();
|
||||||
QTC_ASSERT(editorWidget, renameSymbolsCallback(QString(),
|
QTC_ASSERT(editorWidget, renameSymbolsCallback(QString(),
|
||||||
ClangBackEnd::SourceLocationsContainer(),
|
ClangBackEnd::SourceLocationsContainer(),
|
||||||
0); return;);
|
0); return;);
|
||||||
@@ -61,7 +62,7 @@ void CppRefactoringEngine::globalRename(const CursorInEditor &data,
|
|||||||
if (!modelManager)
|
if (!modelManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CppEditorWidgetInterface *editorWidget = data.editorWidget();
|
CppEditorWidget *editorWidget = data.editorWidget();
|
||||||
QTC_ASSERT(editorWidget, return;);
|
QTC_ASSERT(editorWidget, return;);
|
||||||
|
|
||||||
SemanticInfo info = editorWidget->semanticInfo();
|
SemanticInfo info = editorWidget->semanticInfo();
|
||||||
@@ -85,7 +86,7 @@ void CppRefactoringEngine::findUsages(const CursorInEditor &data,
|
|||||||
if (!modelManager)
|
if (!modelManager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CppEditorWidgetInterface *editorWidget = data.editorWidget();
|
CppEditorWidget *editorWidget = data.editorWidget();
|
||||||
QTC_ASSERT(editorWidget, return;);
|
QTC_ASSERT(editorWidget, return;);
|
||||||
|
|
||||||
SemanticInfo info = editorWidget->semanticInfo();
|
SemanticInfo info = editorWidget->semanticInfo();
|
||||||
|
|||||||
@@ -53,9 +53,10 @@ class ProgressIndicator;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
|
class CppEditorWidget;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class CppClass;
|
class CppClass;
|
||||||
class CppEditorWidget;
|
|
||||||
class CppElement;
|
class CppElement;
|
||||||
|
|
||||||
class CppTypeHierarchyModel : public QStandardItemModel
|
class CppTypeHierarchyModel : public QStandardItemModel
|
||||||
|
|||||||
@@ -33,10 +33,10 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class CppEditorWidget;
|
class CppEditorWidget;
|
||||||
|
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
class CppUseSelectionsUpdater : public QObject
|
class CppUseSelectionsUpdater : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cppeditorwidgetinterface.h"
|
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
#include <QTextCursor>
|
#include <QTextCursor>
|
||||||
@@ -34,26 +32,27 @@
|
|||||||
namespace TextEditor { class TextDocument; }
|
namespace TextEditor { class TextDocument; }
|
||||||
|
|
||||||
namespace CppEditor {
|
namespace CppEditor {
|
||||||
|
class CppEditorWidget;
|
||||||
|
|
||||||
class CursorInEditor
|
class CursorInEditor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CursorInEditor(const QTextCursor &cursor, const Utils::FilePath &filePath,
|
CursorInEditor(const QTextCursor &cursor, const Utils::FilePath &filePath,
|
||||||
CppEditorWidgetInterface *editorWidget = nullptr,
|
CppEditorWidget *editorWidget = nullptr,
|
||||||
TextEditor::TextDocument *textDocument = nullptr)
|
TextEditor::TextDocument *textDocument = nullptr)
|
||||||
: m_cursor(cursor)
|
: m_cursor(cursor)
|
||||||
, m_filePath(filePath)
|
, m_filePath(filePath)
|
||||||
, m_editorWidget(editorWidget)
|
, m_editorWidget(editorWidget)
|
||||||
, m_textDocument(textDocument)
|
, m_textDocument(textDocument)
|
||||||
{}
|
{}
|
||||||
CppEditorWidgetInterface *editorWidget() const { return m_editorWidget; }
|
CppEditorWidget *editorWidget() const { return m_editorWidget; }
|
||||||
TextEditor::TextDocument *textDocument() const { return m_textDocument; }
|
TextEditor::TextDocument *textDocument() const { return m_textDocument; }
|
||||||
const QTextCursor &cursor() const { return m_cursor; }
|
const QTextCursor &cursor() const { return m_cursor; }
|
||||||
const Utils::FilePath &filePath() const { return m_filePath; }
|
const Utils::FilePath &filePath() const { return m_filePath; }
|
||||||
private:
|
private:
|
||||||
QTextCursor m_cursor;
|
QTextCursor m_cursor;
|
||||||
Utils::FilePath m_filePath;
|
Utils::FilePath m_filePath;
|
||||||
CppEditorWidgetInterface *m_editorWidget = nullptr;
|
CppEditorWidget *m_editorWidget = nullptr;
|
||||||
TextEditor::TextDocument * const m_textDocument;
|
TextEditor::TextDocument * const m_textDocument;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ F2TestCase::F2TestCase(CppEditorAction action,
|
|||||||
if (!builtinFollowSymbol) {
|
if (!builtinFollowSymbol) {
|
||||||
if (curTestName == "testFollowSymbolQTCREATORBUG7903")
|
if (curTestName == "testFollowSymbolQTCREATORBUG7903")
|
||||||
QSKIP((curTestName + " is not supported by Clang FollowSymbol").toLatin1());
|
QSKIP((curTestName + " is not supported by Clang FollowSymbol").toLatin1());
|
||||||
widget->inTestMode = true;
|
widget->enableTestMode();
|
||||||
widget->openLinkUnderCursor();
|
widget->openLinkUnderCursor();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user