forked from qt-creator/qt-creator
LanguageClient: support additional goto targets in symbol support
Allow to follow to the symbol definition as well as to the type definition for the symbol under the cursor position. Change-Id: I8ff50b33a1e739f81b0832b1b28ffc525e1f7177 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1013,7 +1013,11 @@ void ClangdClient::followSymbol(TextDocument *document,
|
||||
|
||||
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
||||
if (followTo == FollowTo::SymbolDef && !resolveTarget) {
|
||||
symbolSupport().findLinkAt(document, adjustedCursor, callback, false);
|
||||
symbolSupport().findLinkAt(document,
|
||||
adjustedCursor,
|
||||
callback,
|
||||
false,
|
||||
LanguageClient::LinkTarget::SymbolDef);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -714,7 +714,11 @@ void ClangdFindLocalReferences::Private::findDefinition()
|
||||
if (sentinel)
|
||||
getDefinitionAst(l);
|
||||
};
|
||||
client()->symbolSupport().findLinkAt(document, cursor, linkHandler, true);
|
||||
client()->symbolSupport().findLinkAt(document,
|
||||
cursor,
|
||||
linkHandler,
|
||||
true,
|
||||
LanguageClient::LinkTarget::SymbolDef);
|
||||
}
|
||||
|
||||
void ClangdFindLocalReferences::Private::getDefinitionAst(const Link &link)
|
||||
|
||||
@@ -154,7 +154,11 @@ ClangdFollowSymbol::ClangdFollowSymbol(ClangdClient *client, const QTextCursor &
|
||||
if (self->d->cursorNode)
|
||||
self->d->handleGotoDefinitionResult();
|
||||
};
|
||||
client->symbolSupport().findLinkAt(document, cursor, std::move(gotoDefCallback), true);
|
||||
client->symbolSupport().findLinkAt(document,
|
||||
cursor,
|
||||
std::move(gotoDefCallback),
|
||||
true,
|
||||
LanguageClient::LinkTarget::SymbolDef);
|
||||
|
||||
const auto astHandler = [self = QPointer(this)](const ClangdAstNode &ast, const MessageId &) {
|
||||
qCDebug(clangdLog) << "received ast response for cursor";
|
||||
|
||||
Reference in New Issue
Block a user