diff options
Diffstat (limited to 'src/plugins/clangcodemodel/clangmodelmanagersupport.cpp')
-rw-r--r-- | src/plugins/clangcodemodel/clangmodelmanagersupport.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 1dd66db3cd..8aea72ce0e 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -352,10 +352,24 @@ void ClangModelManagerSupport::findUsages(const CursorInEditor &cursor) const void ClangModelManagerSupport::switchHeaderSource(const FilePath &filePath, bool inNextSplit) { - if (ClangdClient * const client = clientForFile(filePath)) - client->switchHeaderSource(filePath, inNextSplit); - else - CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin); + if (ClangdClient * const client = clientForFile(filePath)) { + switch (ClangdProjectSettings(client->project()).settings().headerSourceSwitchMode) { + case ClangdSettings::HeaderSourceSwitchMode::BuiltinOnly: + CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin); + return; + case ClangdSettings::HeaderSourceSwitchMode::ClangdOnly: + client->switchHeaderSource(filePath, inNextSplit); + return; + case ClangdSettings::HeaderSourceSwitchMode::Both: + const FilePath otherFile = correspondingHeaderOrSource(filePath); + if (!otherFile.isEmpty()) + openEditor(otherFile, inNextSplit); + else + client->switchHeaderSource(filePath, inNextSplit); + return; + } + } + CppModelManager::switchHeaderSource(inNextSplit, CppModelManager::Backend::Builtin); } void ClangModelManagerSupport::checkUnused(const Link &link, SearchResult *search, |