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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user