diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2023-03-10 10:11:10 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2023-03-10 12:55:26 +0000 |
commit | b63713a84f524e0b05fa001351cabfa7866f071b (patch) | |
tree | 9bca682e21dc52e8ebda467dc5633f7fc98b703f | |
parent | 423b485a36f678c224ed25a919afa2449bd3abee (diff) | |
download | qt-creator-b63713a84f524e0b05fa001351cabfa7866f071b.tar.gz |
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>
-rw-r--r-- | src/plugins/clangcodemodel/clangmodelmanagersupport.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 64a8dac7bd..5cc123ac91 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -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, |