Utils: Rename ProcessLinkCallback to something less clumsy

Change-Id: Icce4995f4aa886524dc3eedb7cf9ba72adbe8783
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2022-06-03 14:58:37 +02:00
parent 21c215f83c
commit 5693c518bc
25 changed files with 46 additions and 46 deletions

View File

@@ -78,7 +78,7 @@ public:
QTCREATOR_UTILS_EXPORT QHashValueType qHash(const Link &l);
using ProcessLinkCallback = std::function<void(const Link &)>;
using LinkHandler = std::function<void(const Link &)>;
using Links = QList<Link>;
} // namespace Utils

View File

@@ -359,7 +359,7 @@ class ClangdClient::FollowSymbolData {
public:
FollowSymbolData(ClangdClient *q, quint64 id, const QTextCursor &cursor,
CppEditor::CppEditorWidget *editorWidget,
const DocumentUri &uri, Utils::ProcessLinkCallback &&callback,
const DocumentUri &uri, Utils::LinkHandler &&callback,
bool openInSplit)
: q(q), id(id), cursor(cursor), editorWidget(editorWidget), uri(uri),
callback(std::move(callback)), virtualFuncAssistProvider(q->d),
@@ -395,7 +395,7 @@ public:
const QTextCursor cursor;
const QPointer<CppEditor::CppEditorWidget> editorWidget;
const DocumentUri uri;
const Utils::ProcessLinkCallback callback;
const Utils::LinkHandler callback;
VirtualFunctionAssistProvider virtualFuncAssistProvider;
QList<MessageId> pendingSymbolInfoRequests;
QList<MessageId> pendingGotoImplRequests;
@@ -418,7 +418,7 @@ class SwitchDeclDefData {
public:
SwitchDeclDefData(quint64 id, TextDocument *doc, const QTextCursor &cursor,
CppEditor::CppEditorWidget *editorWidget,
Utils::ProcessLinkCallback &&callback)
Utils::LinkHandler &&callback)
: id(id), document(doc), uri(DocumentUri::fromFilePath(doc->filePath())),
cursor(cursor), editorWidget(editorWidget), callback(std::move(callback)) {}
@@ -461,7 +461,7 @@ public:
const DocumentUri uri;
const QTextCursor cursor;
const QPointer<CppEditor::CppEditorWidget> editorWidget;
Utils::ProcessLinkCallback callback;
Utils::LinkHandler callback;
Utils::optional<DocumentSymbolsResult> docSymbols;
Utils::optional<ClangdAstNode> ast;
};
@@ -1726,7 +1726,7 @@ void ClangdClient::Private::finishSearch(const ReferencesData &refData, bool can
void ClangdClient::followSymbol(TextDocument *document,
const QTextCursor &cursor,
CppEditor::CppEditorWidget *editorWidget,
Utils::ProcessLinkCallback &&callback,
Utils::LinkHandler &&callback,
bool resolveTarget,
bool openInSplit
)
@@ -1777,7 +1777,7 @@ void ClangdClient::followSymbol(TextDocument *document,
void ClangdClient::switchDeclDef(TextDocument *document, const QTextCursor &cursor,
CppEditor::CppEditorWidget *editorWidget,
Utils::ProcessLinkCallback &&callback)
Utils::LinkHandler &&callback)
{
QTC_ASSERT(documentOpen(document), openDocument(document));

View File

@@ -70,14 +70,14 @@ public:
void followSymbol(TextEditor::TextDocument *document,
const QTextCursor &cursor,
CppEditor::CppEditorWidget *editorWidget,
Utils::ProcessLinkCallback &&callback,
Utils::LinkHandler &&callback,
bool resolveTarget,
bool openInSplit);
void switchDeclDef(TextEditor::TextDocument *document,
const QTextCursor &cursor,
CppEditor::CppEditorWidget *editorWidget,
Utils::ProcessLinkCallback &&callback);
Utils::LinkHandler &&callback);
void switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit);
void findLocalUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,

View File

@@ -191,7 +191,7 @@ CppEditor::CppCompletionAssistProvider *ClangModelManagerSupport::functionHintAs
}
void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget,
Utils::LinkHandler &&processLinkCallback, bool resolveTarget,
bool inNextSplit)
{
if (ClangdClient * const client = clientForFile(data.filePath());
@@ -206,7 +206,7 @@ void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &dat
}
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback)
Utils::LinkHandler &&processLinkCallback)
{
if (ClangdClient * const client = clientForFile(data.filePath());
client && client->isFullyIndexed()) {

View File

@@ -80,10 +80,10 @@ signals:
private:
void followSymbol(const CppEditor::CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget,
Utils::LinkHandler &&processLinkCallback, bool resolveTarget,
bool inNextSplit) override;
void switchDeclDef(const CppEditor::CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback) override;
Utils::LinkHandler &&processLinkCallback) override;
void startLocalRenaming(const CppEditor::CursorInEditor &data,
const CppEditor::ProjectPart *projectPart,
CppEditor::RenameCallback &&renameSymbolsCallback) override;

View File

@@ -108,7 +108,7 @@ public:
private:
bool save(const QString &fileName = QString());
void findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget = true,
bool inNextSplit = false) override;
void contextMenuEvent(QContextMenuEvent *e) override;
@@ -152,7 +152,7 @@ static QString unescape(const QString &s)
}
void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool/* resolveTarget*/,
bool /*inNextSplit*/)
{

View File

@@ -140,7 +140,7 @@ std::unique_ptr<AbstractOverviewModel> BuiltinModelManagerSupport::createOvervie
}
void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget, bool inNextSplit)
{
SymbolFinder finder;
@@ -150,7 +150,7 @@ void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
}
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback)
Utils::LinkHandler &&processLinkCallback)
{
SymbolFinder finder;
m_followSymbol->switchDeclDef(data, std::move(processLinkCallback),

View File

@@ -51,10 +51,10 @@ public:
FollowSymbolUnderCursor &followSymbolInterface() { return *m_followSymbol; }
private:
void followSymbol(const CursorInEditor &data, Utils::ProcessLinkCallback &&processLinkCallback,
void followSymbol(const CursorInEditor &data, Utils::LinkHandler &&processLinkCallback,
bool resolveTarget, bool inNextSplit) override;
void switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback) override;
Utils::LinkHandler &&processLinkCallback) override;
void startLocalRenaming(const CursorInEditor &data,
const ProjectPart *projectPart,
RenameCallback &&renameSymbolsCallback) override;

View File

@@ -889,7 +889,7 @@ void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit)
}
void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
ProcessLinkCallback &&processLinkCallback,
LinkHandler &&processLinkCallback,
bool resolveTarget,
bool inNextSplit)
{
@@ -902,7 +902,7 @@ void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
// UI header.
QTextCursor c(cursor);
c.select(QTextCursor::WordUnderCursor);
ProcessLinkCallback callbackWrapper = [start = c.selectionStart(), end = c.selectionEnd(),
LinkHandler callbackWrapper = [start = c.selectionStart(), end = c.selectionEnd(),
doc = QPointer(cursor.document()), callback = std::move(processLinkCallback),
filePath](const Link &link) {
const int linkPos = doc ? Text::positionInText(doc, link.targetLine, link.targetColumn + 1)

View File

@@ -116,7 +116,7 @@ protected:
bool handleStringSplitting(QKeyEvent *e) const;
void findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget = true,
bool inNextSplit = false) override;

View File

@@ -492,7 +492,7 @@ static int skipMatchingParentheses(const Tokens &tokens, int idx, int initialDep
void FollowSymbolUnderCursor::findLink(
const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget,
const Snapshot &theSnapshot,
const Document::Ptr &documentFromSemanticInfo,
@@ -803,7 +803,7 @@ void FollowSymbolUnderCursor::findLink(
void FollowSymbolUnderCursor::switchDeclDef(
const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
const CPlusPlus::Snapshot &snapshot,
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
SymbolFinder *symbolFinder)

View File

@@ -42,7 +42,7 @@ public:
FollowSymbolUnderCursor();
void findLink(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget,
const CPlusPlus::Snapshot &snapshot,
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
@@ -50,7 +50,7 @@ public:
bool inNextSplit);
void switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
const CPlusPlus::Snapshot &snapshot,
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
SymbolFinder *symbolFinder);

View File

@@ -1631,7 +1631,7 @@ TextEditor::BaseHoverHandler *CppModelManager::createHoverHandler() const
}
void CppModelManager::followSymbol(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget, bool inNextSplit, Backend backend)
{
instance()->modelManagerSupport(backend)->followSymbol(data, std::move(processLinkCallback),
@@ -1639,7 +1639,7 @@ void CppModelManager::followSymbol(const CursorInEditor &data,
}
void CppModelManager::switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
Backend backend)
{
instance()->modelManagerSupport(backend)->switchDeclDef(data, std::move(processLinkCallback));

View File

@@ -170,10 +170,10 @@ public:
enum class Backend { Builtin, Best };
static void followSymbol(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget, bool inNextSplit, Backend backend = Backend::Best);
static void switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
Backend backend = Backend::Best);
static void startLocalRenaming(const CursorInEditor &data, const ProjectPart *projectPart,
RenameCallback &&renameSymbolsCallback,

View File

@@ -65,10 +65,10 @@ public:
virtual bool usesClangd(const TextEditor::TextDocument *) const { return false; }
virtual void followSymbol(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget, bool inNextSplit) = 0;
virtual void switchDeclDef(const CursorInEditor &data,
Utils::ProcessLinkCallback &&processLinkCallback) = 0;
Utils::LinkHandler &&processLinkCallback) = 0;
virtual void startLocalRenaming(const CursorInEditor &data,
const ProjectPart *projectPart,
RenameCallback &&renameSymbolsCallback) = 0;

View File

@@ -456,7 +456,7 @@ void LanguageClientManager::editorOpened(Core::IEditor *editor)
if (TextEditorWidget *widget = textEditor->editorWidget()) {
connect(widget, &TextEditorWidget::requestLinkAt, this,
[document = textEditor->textDocument()]
(const QTextCursor &cursor, Utils::ProcessLinkCallback &callback, bool resolveTarget) {
(const QTextCursor &cursor, Utils::LinkHandler &callback, bool resolveTarget) {
if (auto client = clientForDocument(document))
client->symbolSupport().findLinkAt(document, cursor, callback, resolveTarget);
});

View File

@@ -75,7 +75,7 @@ static void sendTextDocumentPositionParamsRequest(Client *client,
}
static void handleGotoDefinitionResponse(const GotoDefinitionRequest::Response &response,
Utils::ProcessLinkCallback callback,
Utils::LinkHandler callback,
Utils::optional<Utils::Link> linkUnderCursor)
{
if (Utils::optional<GotoResult> result = response.result()) {
@@ -105,7 +105,7 @@ static TextDocumentPositionParams generateDocPosParams(TextEditor::TextDocument
void SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
const QTextCursor &cursor,
Utils::ProcessLinkCallback callback,
Utils::LinkHandler callback,
const bool resolveTarget)
{
if (!m_client->reachable())

View File

@@ -51,7 +51,7 @@ public:
void findLinkAt(TextEditor::TextDocument *document,
const QTextCursor &cursor,
Utils::ProcessLinkCallback callback,
Utils::LinkHandler callback,
const bool resolveTarget);
using ResultHandler = std::function<void(const QList<LanguageServerProtocol::Location> &)>;

View File

@@ -60,7 +60,7 @@ NimTextEditorWidget::NimTextEditorWidget(QWidget *parent)
setLanguageSettingsId(Nim::Constants::C_NIMLANGUAGE_ID);
}
void NimTextEditorWidget::findLinkAt(const QTextCursor &c, Utils::ProcessLinkCallback &&processLinkCallback, bool /*resolveTarget*/, bool /*inNextSplit*/)
void NimTextEditorWidget::findLinkAt(const QTextCursor &c, Utils::LinkHandler &&processLinkCallback, bool /*resolveTarget*/, bool /*inNextSplit*/)
{
const Utils::FilePath &path = textDocument()->filePath();

View File

@@ -36,13 +36,13 @@ public:
NimTextEditorWidget(QWidget* parent = nullptr);
protected:
void findLinkAt(const QTextCursor &, Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget, bool inNextSplit);
void findLinkAt(const QTextCursor &, Utils::LinkHandler &&processLinkCallback, bool resolveTarget, bool inNextSplit);
private:
void onFindLinkFinished();
std::shared_ptr<Nim::Suggest::NimSuggestClientRequest> m_request;
Utils::ProcessLinkCallback m_callback;
Utils::LinkHandler m_callback;
std::unique_ptr<QTemporaryFile> m_dirtyFile;
};

View File

@@ -62,7 +62,7 @@ class ProFileEditorWidget : public TextEditorWidget
{
private:
void findLinkAt(const QTextCursor &,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget = true,
bool inNextSplit = false) override;
void contextMenuEvent(QContextMenuEvent *) override;
@@ -125,7 +125,7 @@ QString ProFileEditorWidget::checkForPrfFile(const QString &baseName) const
}
void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool /*resolveTarget*/,
bool /*inNextSplit*/)
{

View File

@@ -753,7 +753,7 @@ void QmlJSEditorWidget::inspectElementUnderCursor() const
}
void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool /*resolveTarget*/,
bool /*inNextSplit*/)
{

View File

@@ -102,7 +102,7 @@ protected:
void applyFontSettings() override;
void createToolBar();
void findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget = true,
bool inNextSplit = false) override;
QString foldReplacementText(const QTextBlock &block) const override;

View File

@@ -6081,7 +6081,7 @@ void TextEditorWidget::zoomReset()
}
void TextEditorWidget::findLinkAt(const QTextCursor &cursor,
Utils::ProcessLinkCallback &&callback,
Utils::LinkHandler &&callback,
bool resolveTarget,
bool inNextSplit)
{

View File

@@ -496,7 +496,7 @@ signals:
void requestBlockUpdate(const QTextBlock &);
void requestLinkAt(const QTextCursor &cursor, Utils::ProcessLinkCallback &callback,
void requestLinkAt(const QTextCursor &cursor, Utils::LinkHandler &callback,
bool resolveTarget, bool inNextSplit);
void requestUsages(const QTextCursor &cursor);
void requestRename(const QTextCursor &cursor);
@@ -582,7 +582,7 @@ protected:
(it isn't until the link is used).
*/
virtual void findLinkAt(const QTextCursor &,
Utils::ProcessLinkCallback &&processLinkCallback,
Utils::LinkHandler &&processLinkCallback,
bool resolveTarget = true,
bool inNextSplit = false);