summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cpptoolsreuse.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2022-05-18 15:16:40 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2022-05-19 09:54:34 +0000
commit70ec0cfff12befa1e2be0f915464220ba8f8b363 (patch)
treeeba890e481ea7ce3e158d0ecf468dd499adc2249 /src/plugins/cppeditor/cpptoolsreuse.cpp
parent0422233af4c6110b37cb60f6885960037631b863 (diff)
downloadqt-creator-70ec0cfff12befa1e2be0f915464220ba8f8b363.tar.gz
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>
Diffstat (limited to 'src/plugins/cppeditor/cpptoolsreuse.cpp')
-rw-r--r--src/plugins/cppeditor/cpptoolsreuse.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/plugins/cppeditor/cpptoolsreuse.cpp b/src/plugins/cppeditor/cpptoolsreuse.cpp
index 7f94a6e05c..e2362efa58 100644
--- a/src/plugins/cppeditor/cpptoolsreuse.cpp
+++ b/src/plugins/cppeditor/cpptoolsreuse.cpp
@@ -270,16 +270,6 @@ bool isQtKeyword(QStringView text)
return false;
}
-void switchHeaderSource()
-{
- const Core::IDocument *currentDocument = Core::EditorManager::currentDocument();
- QTC_ASSERT(currentDocument, return);
- const auto otherFile = Utils::FilePath::fromString(
- correspondingHeaderOrSource(currentDocument->filePath().toString()));
- if (!otherFile.isEmpty())
- Core::EditorManager::openEditor(otherFile);
-}
-
QString identifierUnderCursor(QTextCursor *cursor)
{
cursor->movePosition(QTextCursor::StartOfWord);
@@ -633,6 +623,13 @@ ProjectExplorer::Project *projectForProjectInfo(const ProjectInfo &info)
return ProjectExplorer::SessionManager::projectWithProjectFilePath(info.projectFilePath());
}
+void openEditor(const Utils::FilePath &filePath, bool inNextSplit)
+{
+ using Core::EditorManager;
+ EditorManager::openEditor(filePath, {}, inNextSplit ? EditorManager::OpenInOtherSplit
+ : EditorManager::NoFlags);
+}
+
namespace Internal {
void decorateCppEditor(TextEditor::TextEditorWidget *editor)