ClangCodeModel: Prefer clangd's switch header/source

It's more reliable than the built-in code model with non-trivial
directory layouts.

Fixes: QTCREATORBUG-28878
Change-Id: I02a058e7efb54e6af0998948a20d990e10293f03
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2023-03-10 10:11:10 +01:00
parent 423b485a36
commit b63713a84f

View File

@@ -341,16 +341,10 @@ void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &curso
void ClangModelManagerSupport::switchHeaderSource(const 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 FilePath otherFile = correspondingHeaderOrSource(filePath);
if (!otherFile.isEmpty())
openEditor(otherFile, inNextSplit);
else
client->switchHeaderSource(filePath, inNextSplit);
return;
}
CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin);
if (ClangdClient * const client = clientForFile(filePath))
client->switchHeaderSource(filePath, inNextSplit);
else
CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin);
}
void ClangModelManagerSupport::checkUnused(const Link &link, Core::SearchResult *search,