forked from qt-creator/qt-creator
ClangCodeModel: Make use of clangd's "switchSourceHeader" extension
This allows us to switch between headers and sources with different base names and/or locations, using symbol matching heuristics. Task-number: QTCREATORBUG-16385 Change-Id: I2d9c07f412d70b75322ed65d491982d78674483d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -248,6 +248,21 @@ void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &curso
|
||||
CppModelManager::findUsages(cursor, std::move(callback), CppModelManager::Backend::Builtin);
|
||||
}
|
||||
|
||||
void ClangModelManagerSupport::switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit)
|
||||
{
|
||||
if (ClangdClient * const client = clientForFile(filePath)) {
|
||||
// The fast, synchronous approach works most of the time, so let's try that one first.
|
||||
const auto otherFile = Utils::FilePath::fromString(
|
||||
correspondingHeaderOrSource(filePath.toString()));
|
||||
if (!otherFile.isEmpty())
|
||||
openEditor(otherFile, inNextSplit);
|
||||
else
|
||||
client->switchHeaderSource(filePath, inNextSplit);
|
||||
return;
|
||||
}
|
||||
CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin);
|
||||
}
|
||||
|
||||
std::unique_ptr<CppEditor::AbstractOverviewModel> ClangModelManagerSupport::createOverviewModel()
|
||||
{
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user