forked from qt-creator/qt-creator
Utils: Rename ProcessLinkCallback to something less clumsy
Change-Id: Icce4995f4aa886524dc3eedb7cf9ba72adbe8783 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -78,7 +78,7 @@ public:
|
|||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT QHashValueType qHash(const Link &l);
|
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>;
|
using Links = QList<Link>;
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
@@ -359,7 +359,7 @@ 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::ProcessLinkCallback &&callback,
|
const DocumentUri &uri, 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(std::move(callback)), virtualFuncAssistProvider(q->d),
|
||||||
@@ -395,7 +395,7 @@ public:
|
|||||||
const QTextCursor cursor;
|
const QTextCursor cursor;
|
||||||
const QPointer<CppEditor::CppEditorWidget> editorWidget;
|
const QPointer<CppEditor::CppEditorWidget> editorWidget;
|
||||||
const DocumentUri uri;
|
const DocumentUri uri;
|
||||||
const Utils::ProcessLinkCallback callback;
|
const Utils::LinkHandler callback;
|
||||||
VirtualFunctionAssistProvider virtualFuncAssistProvider;
|
VirtualFunctionAssistProvider virtualFuncAssistProvider;
|
||||||
QList<MessageId> pendingSymbolInfoRequests;
|
QList<MessageId> pendingSymbolInfoRequests;
|
||||||
QList<MessageId> pendingGotoImplRequests;
|
QList<MessageId> pendingGotoImplRequests;
|
||||||
@@ -418,7 +418,7 @@ 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::ProcessLinkCallback &&callback)
|
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(std::move(callback)) {}
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ public:
|
|||||||
const DocumentUri uri;
|
const DocumentUri uri;
|
||||||
const QTextCursor cursor;
|
const QTextCursor cursor;
|
||||||
const QPointer<CppEditor::CppEditorWidget> editorWidget;
|
const QPointer<CppEditor::CppEditorWidget> editorWidget;
|
||||||
Utils::ProcessLinkCallback callback;
|
Utils::LinkHandler callback;
|
||||||
Utils::optional<DocumentSymbolsResult> docSymbols;
|
Utils::optional<DocumentSymbolsResult> docSymbols;
|
||||||
Utils::optional<ClangdAstNode> ast;
|
Utils::optional<ClangdAstNode> ast;
|
||||||
};
|
};
|
||||||
@@ -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::ProcessLinkCallback &&callback,
|
Utils::LinkHandler &&callback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool openInSplit
|
bool openInSplit
|
||||||
)
|
)
|
||||||
@@ -1777,7 +1777,7 @@ 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::ProcessLinkCallback &&callback)
|
Utils::LinkHandler &&callback)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(documentOpen(document), openDocument(document));
|
QTC_ASSERT(documentOpen(document), openDocument(document));
|
||||||
|
|
||||||
|
@@ -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::ProcessLinkCallback &&callback,
|
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::ProcessLinkCallback &&callback);
|
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,7 +191,7 @@ CppEditor::CppCompletionAssistProvider *ClangModelManagerSupport::functionHintAs
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data,
|
void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget,
|
Utils::LinkHandler &&processLinkCallback, bool resolveTarget,
|
||||||
bool inNextSplit)
|
bool inNextSplit)
|
||||||
{
|
{
|
||||||
if (ClangdClient * const client = clientForFile(data.filePath());
|
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,
|
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback)
|
Utils::LinkHandler &&processLinkCallback)
|
||||||
{
|
{
|
||||||
if (ClangdClient * const client = clientForFile(data.filePath());
|
if (ClangdClient * const client = clientForFile(data.filePath());
|
||||||
client && client->isFullyIndexed()) {
|
client && client->isFullyIndexed()) {
|
||||||
|
@@ -80,10 +80,10 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void followSymbol(const CppEditor::CursorInEditor &data,
|
void followSymbol(const CppEditor::CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget,
|
Utils::LinkHandler &&processLinkCallback, bool resolveTarget,
|
||||||
bool inNextSplit) override;
|
bool inNextSplit) override;
|
||||||
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback) override;
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
Utils::LinkHandler &&processLinkCallback,
|
||||||
bool/* resolveTarget*/,
|
bool/* resolveTarget*/,
|
||||||
bool /*inNextSplit*/)
|
bool /*inNextSplit*/)
|
||||||
{
|
{
|
||||||
|
@@ -140,7 +140,7 @@ std::unique_ptr<AbstractOverviewModel> BuiltinModelManagerSupport::createOvervie
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
|
void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
Utils::LinkHandler &&processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit)
|
bool resolveTarget, bool inNextSplit)
|
||||||
{
|
{
|
||||||
SymbolFinder finder;
|
SymbolFinder finder;
|
||||||
@@ -150,7 +150,7 @@ void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
|
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback)
|
Utils::LinkHandler &&processLinkCallback)
|
||||||
{
|
{
|
||||||
SymbolFinder finder;
|
SymbolFinder finder;
|
||||||
m_followSymbol->switchDeclDef(data, std::move(processLinkCallback),
|
m_followSymbol->switchDeclDef(data, std::move(processLinkCallback),
|
||||||
|
@@ -51,10 +51,10 @@ public:
|
|||||||
FollowSymbolUnderCursor &followSymbolInterface() { return *m_followSymbol; }
|
FollowSymbolUnderCursor &followSymbolInterface() { return *m_followSymbol; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void followSymbol(const CursorInEditor &data, Utils::ProcessLinkCallback &&processLinkCallback,
|
void followSymbol(const CursorInEditor &data, Utils::LinkHandler &&processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit) override;
|
bool resolveTarget, bool inNextSplit) override;
|
||||||
void switchDeclDef(const CursorInEditor &data,
|
void switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback) override;
|
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,
|
||||||
ProcessLinkCallback &&processLinkCallback,
|
LinkHandler &&processLinkCallback,
|
||||||
bool resolveTarget,
|
bool resolveTarget,
|
||||||
bool inNextSplit)
|
bool inNextSplit)
|
||||||
{
|
{
|
||||||
@@ -902,7 +902,7 @@ void CppEditorWidget::findLinkAt(const QTextCursor &cursor,
|
|||||||
// UI header.
|
// UI header.
|
||||||
QTextCursor c(cursor);
|
QTextCursor c(cursor);
|
||||||
c.select(QTextCursor::WordUnderCursor);
|
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),
|
doc = QPointer(cursor.document()), callback = std::move(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)
|
||||||
|
@@ -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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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,7 +1631,7 @@ TextEditor::BaseHoverHandler *CppModelManager::createHoverHandler() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CppModelManager::followSymbol(const CursorInEditor &data,
|
void CppModelManager::followSymbol(const CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
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, std::move(processLinkCallback),
|
||||||
@@ -1639,7 +1639,7 @@ void CppModelManager::followSymbol(const CursorInEditor &data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CppModelManager::switchDeclDef(const CursorInEditor &data,
|
void CppModelManager::switchDeclDef(const CursorInEditor &data,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
Utils::LinkHandler &&processLinkCallback,
|
||||||
Backend backend)
|
Backend backend)
|
||||||
{
|
{
|
||||||
instance()->modelManagerSupport(backend)->switchDeclDef(data, std::move(processLinkCallback));
|
instance()->modelManagerSupport(backend)->switchDeclDef(data, std::move(processLinkCallback));
|
||||||
|
@@ -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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback) = 0;
|
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::ProcessLinkCallback &callback, bool resolveTarget) {
|
(const QTextCursor &cursor, 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);
|
||||||
});
|
});
|
||||||
|
@@ -75,7 +75,7 @@ static void sendTextDocumentPositionParamsRequest(Client *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void handleGotoDefinitionResponse(const GotoDefinitionRequest::Response &response,
|
static void handleGotoDefinitionResponse(const GotoDefinitionRequest::Response &response,
|
||||||
Utils::ProcessLinkCallback callback,
|
Utils::LinkHandler callback,
|
||||||
Utils::optional<Utils::Link> linkUnderCursor)
|
Utils::optional<Utils::Link> linkUnderCursor)
|
||||||
{
|
{
|
||||||
if (Utils::optional<GotoResult> result = response.result()) {
|
if (Utils::optional<GotoResult> result = response.result()) {
|
||||||
@@ -105,7 +105,7 @@ static TextDocumentPositionParams generateDocPosParams(TextEditor::TextDocument
|
|||||||
|
|
||||||
void SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
|
void SymbolSupport::findLinkAt(TextEditor::TextDocument *document,
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
Utils::ProcessLinkCallback callback,
|
Utils::LinkHandler callback,
|
||||||
const bool resolveTarget)
|
const bool resolveTarget)
|
||||||
{
|
{
|
||||||
if (!m_client->reachable())
|
if (!m_client->reachable())
|
||||||
|
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
void findLinkAt(TextEditor::TextDocument *document,
|
void findLinkAt(TextEditor::TextDocument *document,
|
||||||
const QTextCursor &cursor,
|
const QTextCursor &cursor,
|
||||||
Utils::ProcessLinkCallback callback,
|
Utils::LinkHandler callback,
|
||||||
const bool resolveTarget);
|
const bool resolveTarget);
|
||||||
|
|
||||||
using ResultHandler = std::function<void(const QList<LanguageServerProtocol::Location> &)>;
|
using ResultHandler = std::function<void(const QList<LanguageServerProtocol::Location> &)>;
|
||||||
|
@@ -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::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();
|
const Utils::FilePath &path = textDocument()->filePath();
|
||||||
|
|
||||||
|
@@ -36,13 +36,13 @@ public:
|
|||||||
NimTextEditorWidget(QWidget* parent = nullptr);
|
NimTextEditorWidget(QWidget* parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void findLinkAt(const QTextCursor &, Utils::ProcessLinkCallback &&processLinkCallback, bool resolveTarget, bool inNextSplit);
|
void findLinkAt(const QTextCursor &, Utils::LinkHandler &&processLinkCallback, bool resolveTarget, bool inNextSplit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onFindLinkFinished();
|
void onFindLinkFinished();
|
||||||
|
|
||||||
std::shared_ptr<Nim::Suggest::NimSuggestClientRequest> m_request;
|
std::shared_ptr<Nim::Suggest::NimSuggestClientRequest> m_request;
|
||||||
Utils::ProcessLinkCallback m_callback;
|
Utils::LinkHandler m_callback;
|
||||||
std::unique_ptr<QTemporaryFile> m_dirtyFile;
|
std::unique_ptr<QTemporaryFile> m_dirtyFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -62,7 +62,7 @@ class ProFileEditorWidget : public TextEditorWidget
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void findLinkAt(const QTextCursor &,
|
void findLinkAt(const QTextCursor &,
|
||||||
Utils::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
Utils::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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&processLinkCallback,
|
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::ProcessLinkCallback &&callback,
|
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::ProcessLinkCallback &callback,
|
void requestLinkAt(const QTextCursor &cursor, 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::ProcessLinkCallback &&processLinkCallback,
|
Utils::LinkHandler &&processLinkCallback,
|
||||||
bool resolveTarget = true,
|
bool resolveTarget = true,
|
||||||
bool inNextSplit = false);
|
bool inNextSplit = false);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user