forked from qt-creator/qt-creator
Do not pass Utils::LinkHandler by rvalue ref
There is nothing special about this type that justifies it sticking out everywhere it appears. Change-Id: Iccdc95163d477db8a031d0d520f28fea26432a44 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -359,10 +359,10 @@ class ClangdClient::FollowSymbolData {
|
|||||||
public:
|
public:
|
||||||
FollowSymbolData(ClangdClient *q, quint64 id, const QTextCursor &cursor,
|
FollowSymbolData(ClangdClient *q, quint64 id, const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidget *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
const DocumentUri &uri, Utils::LinkHandler &&callback,
|
const DocumentUri &uri, const Utils::LinkHandler &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),
|
||||||
callback(std::move(callback)), virtualFuncAssistProvider(q->d),
|
callback(callback), virtualFuncAssistProvider(q->d),
|
||||||
docRevision(editorWidget ? editorWidget->textDocument()->document()->revision() : -1),
|
docRevision(editorWidget ? editorWidget->textDocument()->document()->revision() : -1),
|
||||||
openInSplit(openInSplit) {}
|
openInSplit(openInSplit) {}
|
||||||
|
|
||||||
@@ -418,9 +418,9 @@ class SwitchDeclDefData {
|
|||||||
public:
|
public:
|
||||||
SwitchDeclDefData(quint64 id, TextDocument *doc, const QTextCursor &cursor,
|
SwitchDeclDefData(quint64 id, TextDocument *doc, const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidget *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::LinkHandler &&callback)
|
const Utils::LinkHandler &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(callback) {}
|
||||||
|
|
||||||
Utils::optional<ClangdAstNode> getFunctionNode() const
|
Utils::optional<ClangdAstNode> getFunctionNode() const
|
||||||
{
|
{
|
||||||
@@ -1726,7 +1726,7 @@ void ClangdClient::Private::finishSearch(const ReferencesData &refData, bool can
|
|||||||
void ClangdClient::followSymbol(TextDocument *document,
|
void ClangdClient::followSymbol(TextDocument *document,
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidget *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::LinkHandler &&callback,
|
const Utils::LinkHandler &callback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool openInSplit
|
bool openInSplit
|
||||||
)
|
)
|
||||||
@@ -1735,7 +1735,7 @@ void ClangdClient::followSymbol(TextDocument *document,
|
|||||||
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
||||||
if (!resolveTarget) {
|
if (!resolveTarget) {
|
||||||
d->followSymbolData.reset();
|
d->followSymbolData.reset();
|
||||||
symbolSupport().findLinkAt(document, adjustedCursor, std::move(callback), false);
|
symbolSupport().findLinkAt(document, adjustedCursor, callback, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1743,7 +1743,7 @@ void ClangdClient::followSymbol(TextDocument *document,
|
|||||||
<< adjustedCursor.blockNumber() << adjustedCursor.positionInBlock();
|
<< adjustedCursor.blockNumber() << adjustedCursor.positionInBlock();
|
||||||
d->followSymbolData.emplace(this, ++d->nextJobId, adjustedCursor, editorWidget,
|
d->followSymbolData.emplace(this, ++d->nextJobId, adjustedCursor, editorWidget,
|
||||||
DocumentUri::fromFilePath(document->filePath()),
|
DocumentUri::fromFilePath(document->filePath()),
|
||||||
std::move(callback), openInSplit);
|
callback, openInSplit);
|
||||||
|
|
||||||
// Step 1: Follow the symbol via "Go to Definition". At the same time, request the
|
// Step 1: Follow the symbol via "Go to Definition". At the same time, request the
|
||||||
// AST node corresponding to the cursor position, so we can find out whether
|
// AST node corresponding to the cursor position, so we can find out whether
|
||||||
@@ -1777,14 +1777,13 @@ void ClangdClient::followSymbol(TextDocument *document,
|
|||||||
|
|
||||||
void ClangdClient::switchDeclDef(TextDocument *document, const QTextCursor &cursor,
|
void ClangdClient::switchDeclDef(TextDocument *document, const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidget *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::LinkHandler &&callback)
|
const Utils::LinkHandler &callback)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(documentOpen(document), openDocument(document));
|
QTC_ASSERT(documentOpen(document), openDocument(document));
|
||||||
|
|
||||||
qCDebug(clangdLog) << "switch decl/dev requested" << document->filePath()
|
qCDebug(clangdLog) << "switch decl/dev requested" << document->filePath()
|
||||||
<< cursor.blockNumber() << cursor.positionInBlock();
|
<< cursor.blockNumber() << cursor.positionInBlock();
|
||||||
d->switchDeclDefData.emplace(++d->nextJobId, document, cursor, editorWidget,
|
d->switchDeclDefData.emplace(++d->nextJobId, document, cursor, editorWidget, callback);
|
||||||
std::move(callback));
|
|
||||||
|
|
||||||
// Retrieve AST and document symbols.
|
// Retrieve AST and document symbols.
|
||||||
const auto astHandler = [this, id = d->switchDeclDefData->id](const ClangdAstNode &ast,
|
const auto astHandler = [this, id = d->switchDeclDefData->id](const ClangdAstNode &ast,
|
||||||
|
@@ -70,14 +70,14 @@ public:
|
|||||||
void followSymbol(TextEditor::TextDocument *document,
|
void followSymbol(TextEditor::TextDocument *document,
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
CppEditor::CppEditorWidget *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::LinkHandler &&callback,
|
const Utils::LinkHandler &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::CppEditorWidget *editorWidget,
|
CppEditor::CppEditorWidget *editorWidget,
|
||||||
Utils::LinkHandler &&callback);
|
const Utils::LinkHandler &callback);
|
||||||
void switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit);
|
void switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit);
|
||||||
|
|
||||||
void findLocalUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
void findLocalUsages(TextEditor::TextDocument *document, const QTextCursor &cursor,
|
||||||
|
@@ -191,32 +191,31 @@ CppEditor::CppCompletionAssistProvider *ClangModelManagerSupport::functionHintAs
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data,
|
void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback, bool resolveTarget,
|
const Utils::LinkHandler &processLinkCallback, bool resolveTarget,
|
||||||
bool inNextSplit)
|
bool inNextSplit)
|
||||||
{
|
{
|
||||||
if (ClangdClient * const client = clientForFile(data.filePath());
|
if (ClangdClient * const client = clientForFile(data.filePath());
|
||||||
client && client->isFullyIndexed()) {
|
client && client->isFullyIndexed()) {
|
||||||
client->followSymbol(data.textDocument(), data.cursor(), data.editorWidget(),
|
client->followSymbol(data.textDocument(), data.cursor(), data.editorWidget(),
|
||||||
std::move(processLinkCallback), resolveTarget, inNextSplit);
|
processLinkCallback, resolveTarget, inNextSplit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CppModelManager::followSymbol(data, std::move(processLinkCallback), resolveTarget, inNextSplit,
|
CppModelManager::followSymbol(data, processLinkCallback, resolveTarget, inNextSplit,
|
||||||
CppModelManager::Backend::Builtin);
|
CppModelManager::Backend::Builtin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
|
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback)
|
const Utils::LinkHandler &processLinkCallback)
|
||||||
{
|
{
|
||||||
if (ClangdClient * const client = clientForFile(data.filePath());
|
if (ClangdClient * const client = clientForFile(data.filePath());
|
||||||
client && client->isFullyIndexed()) {
|
client && client->isFullyIndexed()) {
|
||||||
client->switchDeclDef(data.textDocument(), data.cursor(), data.editorWidget(),
|
client->switchDeclDef(data.textDocument(), data.cursor(), data.editorWidget(),
|
||||||
std::move(processLinkCallback));
|
processLinkCallback);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CppModelManager::switchDeclDef(data, std::move(processLinkCallback),
|
CppModelManager::switchDeclDef(data, processLinkCallback, CppModelManager::Backend::Builtin);
|
||||||
CppModelManager::Backend::Builtin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangModelManagerSupport::startLocalRenaming(const CppEditor::CursorInEditor &data,
|
void ClangModelManagerSupport::startLocalRenaming(const CppEditor::CursorInEditor &data,
|
||||||
|
@@ -80,10 +80,10 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void followSymbol(const CppEditor::CursorInEditor &data,
|
void followSymbol(const CppEditor::CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback, bool resolveTarget,
|
const Utils::LinkHandler &processLinkCallback, bool resolveTarget,
|
||||||
bool inNextSplit) override;
|
bool inNextSplit) override;
|
||||||
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback) override;
|
const Utils::LinkHandler &processLinkCallback) override;
|
||||||
void startLocalRenaming(const CppEditor::CursorInEditor &data,
|
void startLocalRenaming(const CppEditor::CursorInEditor &data,
|
||||||
const CppEditor::ProjectPart *projectPart,
|
const CppEditor::ProjectPart *projectPart,
|
||||||
CppEditor::RenameCallback &&renameSymbolsCallback) override;
|
CppEditor::RenameCallback &&renameSymbolsCallback) override;
|
||||||
|
@@ -108,7 +108,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool save(const QString &fileName = QString());
|
bool save(const QString &fileName = QString());
|
||||||
void findLinkAt(const QTextCursor &cursor,
|
void findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget = true,
|
bool resolveTarget = true,
|
||||||
bool inNextSplit = false) override;
|
bool inNextSplit = false) override;
|
||||||
void contextMenuEvent(QContextMenuEvent *e) override;
|
void contextMenuEvent(QContextMenuEvent *e) override;
|
||||||
@@ -152,7 +152,7 @@ static QString unescape(const QString &s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool/* resolveTarget*/,
|
bool/* resolveTarget*/,
|
||||||
bool /*inNextSplit*/)
|
bool /*inNextSplit*/)
|
||||||
{
|
{
|
||||||
|
@@ -140,20 +140,20 @@ std::unique_ptr<AbstractOverviewModel> BuiltinModelManagerSupport::createOvervie
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
|
void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit)
|
bool resolveTarget, bool inNextSplit)
|
||||||
{
|
{
|
||||||
SymbolFinder finder;
|
SymbolFinder finder;
|
||||||
m_followSymbol->findLink(data, std::move(processLinkCallback),
|
m_followSymbol->findLink(data, processLinkCallback,
|
||||||
resolveTarget, CppModelManager::instance()->snapshot(),
|
resolveTarget, CppModelManager::instance()->snapshot(),
|
||||||
data.editorWidget()->semanticInfo().doc, &finder, inNextSplit);
|
data.editorWidget()->semanticInfo().doc, &finder, inNextSplit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
|
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback)
|
const Utils::LinkHandler &processLinkCallback)
|
||||||
{
|
{
|
||||||
SymbolFinder finder;
|
SymbolFinder finder;
|
||||||
m_followSymbol->switchDeclDef(data, std::move(processLinkCallback),
|
m_followSymbol->switchDeclDef(data, processLinkCallback,
|
||||||
CppModelManager::instance()->snapshot(), data.editorWidget()->semanticInfo().doc,
|
CppModelManager::instance()->snapshot(), data.editorWidget()->semanticInfo().doc,
|
||||||
&finder);
|
&finder);
|
||||||
}
|
}
|
||||||
|
@@ -51,10 +51,10 @@ public:
|
|||||||
FollowSymbolUnderCursor &followSymbolInterface() { return *m_followSymbol; }
|
FollowSymbolUnderCursor &followSymbolInterface() { return *m_followSymbol; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void followSymbol(const CursorInEditor &data, Utils::LinkHandler &&processLinkCallback,
|
void followSymbol(const CursorInEditor &data, const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit) override;
|
bool resolveTarget, bool inNextSplit) override;
|
||||||
void switchDeclDef(const CursorInEditor &data,
|
void switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback) override;
|
const Utils::LinkHandler &processLinkCallback) override;
|
||||||
void startLocalRenaming(const CursorInEditor &data,
|
void startLocalRenaming(const CursorInEditor &data,
|
||||||
const ProjectPart *projectPart,
|
const ProjectPart *projectPart,
|
||||||
RenameCallback &&renameSymbolsCallback) override;
|
RenameCallback &&renameSymbolsCallback) override;
|
||||||
|
@@ -889,7 +889,7 @@ void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
|
void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||||
LinkHandler &&processLinkCallback,
|
const LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool inNextSplit)
|
bool inNextSplit)
|
||||||
{
|
{
|
||||||
@@ -903,7 +903,7 @@ void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
QTextCursor c(cursor);
|
QTextCursor c(cursor);
|
||||||
c.select(QTextCursor::WordUnderCursor);
|
c.select(QTextCursor::WordUnderCursor);
|
||||||
LinkHandler callbackWrapper = [start = c.selectionStart(), end = c.selectionEnd(),
|
LinkHandler callbackWrapper = [start = c.selectionStart(), end = c.selectionEnd(),
|
||||||
doc = QPointer(cursor.document()), callback = std::move(processLinkCallback),
|
doc = QPointer(cursor.document()), callback = processLinkCallback,
|
||||||
filePath](const Link &link) {
|
filePath](const Link &link) {
|
||||||
const int linkPos = doc ? Text::positionInText(doc, link.targetLine, link.targetColumn + 1)
|
const int linkPos = doc ? Text::positionInText(doc, link.targetLine, link.targetColumn + 1)
|
||||||
: -1;
|
: -1;
|
||||||
@@ -927,7 +927,7 @@ void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
};
|
};
|
||||||
CppModelManager::followSymbol(
|
CppModelManager::followSymbol(
|
||||||
CursorInEditor{cursor, filePath, this, textDocument()},
|
CursorInEditor{cursor, filePath, this, textDocument()},
|
||||||
std::move(callbackWrapper),
|
callbackWrapper,
|
||||||
resolveTarget,
|
resolveTarget,
|
||||||
inNextSplit);
|
inNextSplit);
|
||||||
}
|
}
|
||||||
|
@@ -116,7 +116,7 @@ protected:
|
|||||||
bool handleStringSplitting(QKeyEvent *e) const;
|
bool handleStringSplitting(QKeyEvent *e) const;
|
||||||
|
|
||||||
void findLinkAt(const QTextCursor &cursor,
|
void findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget = true,
|
bool resolveTarget = true,
|
||||||
bool inNextSplit = false) override;
|
bool inNextSplit = false) override;
|
||||||
|
|
||||||
|
@@ -492,7 +492,7 @@ static int skipMatchingParentheses(const Tokens &tokens, int idx, int initialDep
|
|||||||
|
|
||||||
void FollowSymbolUnderCursor::findLink(
|
void FollowSymbolUnderCursor::findLink(
|
||||||
const CursorInEditor &data,
|
const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
const Snapshot &theSnapshot,
|
const Snapshot &theSnapshot,
|
||||||
const Document::Ptr &documentFromSemanticInfo,
|
const Document::Ptr &documentFromSemanticInfo,
|
||||||
@@ -803,7 +803,7 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
|
|
||||||
void FollowSymbolUnderCursor::switchDeclDef(
|
void FollowSymbolUnderCursor::switchDeclDef(
|
||||||
const CursorInEditor &data,
|
const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
const CPlusPlus::Snapshot &snapshot,
|
const CPlusPlus::Snapshot &snapshot,
|
||||||
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
||||||
SymbolFinder *symbolFinder)
|
SymbolFinder *symbolFinder)
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
FollowSymbolUnderCursor();
|
FollowSymbolUnderCursor();
|
||||||
|
|
||||||
void findLink(const CursorInEditor &data,
|
void findLink(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
const CPlusPlus::Snapshot &snapshot,
|
const CPlusPlus::Snapshot &snapshot,
|
||||||
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
bool inNextSplit);
|
bool inNextSplit);
|
||||||
|
|
||||||
void switchDeclDef(const CursorInEditor &data,
|
void switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
const CPlusPlus::Snapshot &snapshot,
|
const CPlusPlus::Snapshot &snapshot,
|
||||||
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
const CPlusPlus::Document::Ptr &documentFromSemanticInfo,
|
||||||
SymbolFinder *symbolFinder);
|
SymbolFinder *symbolFinder);
|
||||||
|
@@ -1631,18 +1631,18 @@ TextEditor::BaseHoverHandler *CppModelManager::createHoverHandler() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CppModelManager::followSymbol(const CursorInEditor &data,
|
void CppModelManager::followSymbol(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit, Backend backend)
|
bool resolveTarget, bool inNextSplit, Backend backend)
|
||||||
{
|
{
|
||||||
instance()->modelManagerSupport(backend)->followSymbol(data, std::move(processLinkCallback),
|
instance()->modelManagerSupport(backend)->followSymbol(data, processLinkCallback,
|
||||||
resolveTarget, inNextSplit);
|
resolveTarget, inNextSplit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppModelManager::switchDeclDef(const CursorInEditor &data,
|
void CppModelManager::switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
Backend backend)
|
Backend backend)
|
||||||
{
|
{
|
||||||
instance()->modelManagerSupport(backend)->switchDeclDef(data, std::move(processLinkCallback));
|
instance()->modelManagerSupport(backend)->switchDeclDef(data, processLinkCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::ILocatorFilter *CppModelManager::createAuxiliaryCurrentDocumentFilter()
|
Core::ILocatorFilter *CppModelManager::createAuxiliaryCurrentDocumentFilter()
|
||||||
|
@@ -170,10 +170,10 @@ public:
|
|||||||
|
|
||||||
enum class Backend { Builtin, Best };
|
enum class Backend { Builtin, Best };
|
||||||
static void followSymbol(const CursorInEditor &data,
|
static void followSymbol(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit, Backend backend = Backend::Best);
|
bool resolveTarget, bool inNextSplit, Backend backend = Backend::Best);
|
||||||
static void switchDeclDef(const CursorInEditor &data,
|
static void switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
Backend backend = Backend::Best);
|
Backend backend = Backend::Best);
|
||||||
static void startLocalRenaming(const CursorInEditor &data, const ProjectPart *projectPart,
|
static void startLocalRenaming(const CursorInEditor &data, const ProjectPart *projectPart,
|
||||||
RenameCallback &&renameSymbolsCallback,
|
RenameCallback &&renameSymbolsCallback,
|
||||||
|
@@ -65,10 +65,10 @@ public:
|
|||||||
virtual bool usesClangd(const TextEditor::TextDocument *) const { return false; }
|
virtual bool usesClangd(const TextEditor::TextDocument *) const { return false; }
|
||||||
|
|
||||||
virtual void followSymbol(const CursorInEditor &data,
|
virtual void followSymbol(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit) = 0;
|
bool resolveTarget, bool inNextSplit) = 0;
|
||||||
virtual void switchDeclDef(const CursorInEditor &data,
|
virtual void switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::LinkHandler &&processLinkCallback) = 0;
|
const Utils::LinkHandler &processLinkCallback) = 0;
|
||||||
virtual void startLocalRenaming(const CursorInEditor &data,
|
virtual void startLocalRenaming(const CursorInEditor &data,
|
||||||
const ProjectPart *projectPart,
|
const ProjectPart *projectPart,
|
||||||
RenameCallback &&renameSymbolsCallback) = 0;
|
RenameCallback &&renameSymbolsCallback) = 0;
|
||||||
|
@@ -456,7 +456,7 @@ void LanguageClientManager::editorOpened(Core::IEditor *editor)
|
|||||||
if (TextEditorWidget *widget = textEditor->editorWidget()) {
|
if (TextEditorWidget *widget = textEditor->editorWidget()) {
|
||||||
connect(widget, &TextEditorWidget::requestLinkAt, this,
|
connect(widget, &TextEditorWidget::requestLinkAt, this,
|
||||||
[document = textEditor->textDocument()]
|
[document = textEditor->textDocument()]
|
||||||
(const QTextCursor &cursor, Utils::LinkHandler &callback, bool resolveTarget) {
|
(const QTextCursor &cursor, const Utils::LinkHandler &callback, bool resolveTarget) {
|
||||||
if (auto client = clientForDocument(document))
|
if (auto client = clientForDocument(document))
|
||||||
client->symbolSupport().findLinkAt(document, cursor, callback, resolveTarget);
|
client->symbolSupport().findLinkAt(document, cursor, callback, resolveTarget);
|
||||||
});
|
});
|
||||||
|
@@ -60,7 +60,7 @@ NimTextEditorWidget::NimTextEditorWidget(QWidget *parent)
|
|||||||
setLanguageSettingsId(Nim::Constants::C_NIMLANGUAGE_ID);
|
setLanguageSettingsId(Nim::Constants::C_NIMLANGUAGE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NimTextEditorWidget::findLinkAt(const QTextCursor &c, Utils::LinkHandler &&processLinkCallback, bool /*resolveTarget*/, bool /*inNextSplit*/)
|
void NimTextEditorWidget::findLinkAt(const QTextCursor &c, const Utils::LinkHandler &processLinkCallback, bool /*resolveTarget*/, bool /*inNextSplit*/)
|
||||||
{
|
{
|
||||||
const Utils::FilePath &path = textDocument()->filePath();
|
const Utils::FilePath &path = textDocument()->filePath();
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ void NimTextEditorWidget::findLinkAt(const QTextCursor &c, Utils::LinkHandler &&
|
|||||||
m_callback(Utils::Link());
|
m_callback(Utils::Link());
|
||||||
|
|
||||||
m_dirtyFile = std::move(dirtyFile);
|
m_dirtyFile = std::move(dirtyFile);
|
||||||
m_callback = std::move(processLinkCallback);
|
m_callback = processLinkCallback;
|
||||||
m_request = std::move(request);
|
m_request = std::move(request);
|
||||||
|
|
||||||
QObject::connect(m_request.get(), &NimSuggestClientRequest::finished, this, &NimTextEditorWidget::onFindLinkFinished);
|
QObject::connect(m_request.get(), &NimSuggestClientRequest::finished, this, &NimTextEditorWidget::onFindLinkFinished);
|
||||||
|
@@ -36,7 +36,7 @@ public:
|
|||||||
NimTextEditorWidget(QWidget* parent = nullptr);
|
NimTextEditorWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void findLinkAt(const QTextCursor &, Utils::LinkHandler &&processLinkCallback, bool resolveTarget, bool inNextSplit);
|
void findLinkAt(const QTextCursor &, const Utils::LinkHandler &processLinkCallback, bool resolveTarget, bool inNextSplit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onFindLinkFinished();
|
void onFindLinkFinished();
|
||||||
|
@@ -62,7 +62,7 @@ class ProFileEditorWidget : public TextEditorWidget
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void findLinkAt(const QTextCursor &,
|
void findLinkAt(const QTextCursor &,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget = true,
|
bool resolveTarget = true,
|
||||||
bool inNextSplit = false) override;
|
bool inNextSplit = false) override;
|
||||||
void contextMenuEvent(QContextMenuEvent *) override;
|
void contextMenuEvent(QContextMenuEvent *) override;
|
||||||
@@ -125,7 +125,7 @@ QString ProFileEditorWidget::checkForPrfFile(const QString &baseName) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
void ProFileEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const LinkHandler &processLinkCallback,
|
||||||
bool /*resolveTarget*/,
|
bool /*resolveTarget*/,
|
||||||
bool /*inNextSplit*/)
|
bool /*inNextSplit*/)
|
||||||
{
|
{
|
||||||
|
@@ -753,7 +753,7 @@ void QmlJSEditorWidget::inspectElementUnderCursor() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
void QmlJSEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool /*resolveTarget*/,
|
bool /*resolveTarget*/,
|
||||||
bool /*inNextSplit*/)
|
bool /*inNextSplit*/)
|
||||||
{
|
{
|
||||||
|
@@ -102,7 +102,7 @@ protected:
|
|||||||
void applyFontSettings() override;
|
void applyFontSettings() override;
|
||||||
void createToolBar();
|
void createToolBar();
|
||||||
void findLinkAt(const QTextCursor &cursor,
|
void findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget = true,
|
bool resolveTarget = true,
|
||||||
bool inNextSplit = false) override;
|
bool inNextSplit = false) override;
|
||||||
QString foldReplacementText(const QTextBlock &block) const override;
|
QString foldReplacementText(const QTextBlock &block) const override;
|
||||||
|
@@ -6081,7 +6081,7 @@ void TextEditorWidget::zoomReset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextEditorWidget::findLinkAt(const QTextCursor &cursor,
|
void TextEditorWidget::findLinkAt(const QTextCursor &cursor,
|
||||||
Utils::LinkHandler &&callback,
|
const Utils::LinkHandler &callback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool inNextSplit)
|
bool inNextSplit)
|
||||||
{
|
{
|
||||||
|
@@ -496,7 +496,7 @@ signals:
|
|||||||
|
|
||||||
void requestBlockUpdate(const QTextBlock &);
|
void requestBlockUpdate(const QTextBlock &);
|
||||||
|
|
||||||
void requestLinkAt(const QTextCursor &cursor, Utils::LinkHandler &callback,
|
void requestLinkAt(const QTextCursor &cursor, const Utils::LinkHandler &callback,
|
||||||
bool resolveTarget, bool inNextSplit);
|
bool resolveTarget, bool inNextSplit);
|
||||||
void requestUsages(const QTextCursor &cursor);
|
void requestUsages(const QTextCursor &cursor);
|
||||||
void requestRename(const QTextCursor &cursor);
|
void requestRename(const QTextCursor &cursor);
|
||||||
@@ -582,7 +582,7 @@ protected:
|
|||||||
(it isn't until the link is used).
|
(it isn't until the link is used).
|
||||||
*/
|
*/
|
||||||
virtual void findLinkAt(const QTextCursor &,
|
virtual void findLinkAt(const QTextCursor &,
|
||||||
Utils::LinkHandler &&processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget = true,
|
bool resolveTarget = true,
|
||||||
bool inNextSplit = false);
|
bool inNextSplit = false);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user