ModelManagerSupport: Get rid of UsagesCallback from findUsages()

It's not used currently.

Change-Id: Ic3625b0f3c53c09089a361453f29ac639692cffb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-06-02 00:42:28 +02:00
parent b9f0663741
commit 8cd9a2dd12
8 changed files with 12 additions and 25 deletions

View File

@@ -223,8 +223,7 @@ void ClangModelManagerSupport::globalRename(const CppEditor::CursorInEditor &cur
CppModelManager::globalRename(cursor, replacement, CppModelManager::Backend::Builtin);
}
void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &cursor,
CppEditor::UsagesCallback &&callback) const
void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &cursor) const
{
if (ClangdClient * const client = clientForFile(cursor.filePath());
client && client->isFullyIndexed()) {
@@ -234,7 +233,7 @@ void ClangModelManagerSupport::findUsages(const CppEditor::CursorInEditor &curso
return;
}
CppModelManager::findUsages(cursor, std::move(callback), CppModelManager::Backend::Builtin);
CppModelManager::findUsages(cursor, CppModelManager::Backend::Builtin);
}
void ClangModelManagerSupport::switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit)

View File

@@ -91,8 +91,7 @@ private:
const CppEditor::ProjectPart *projectPart,
CppEditor::RenameCallback &&renameSymbolsCallback) override;
void globalRename(const CppEditor::CursorInEditor &cursor, const QString &replacement) override;
void findUsages(const CppEditor::CursorInEditor &cursor,
CppEditor::UsagesCallback &&callback) const override;
void findUsages(const CppEditor::CursorInEditor &cursor) const override;
void switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit) override;
void onEditorOpened(Core::IEditor *editor);

View File

@@ -193,8 +193,7 @@ void BuiltinModelManagerSupport::globalRename(const CursorInEditor &data,
}
}
void BuiltinModelManagerSupport::findUsages(const CursorInEditor &data,
UsagesCallback &&) const
void BuiltinModelManagerSupport::findUsages(const CursorInEditor &data) const
{
CppModelManager *modelManager = CppModelManager::instance();
if (!modelManager)

View File

@@ -59,7 +59,7 @@ private:
const ProjectPart *projectPart,
RenameCallback &&renameSymbolsCallback) override;
void globalRename(const CursorInEditor &data, const QString &replacement) override;
void findUsages(const CursorInEditor &data, UsagesCallback &&) const override;
void findUsages(const CursorInEditor &data) const override;
void switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit) override;
QScopedPointer<CppCompletionAssistProvider> m_completionAssistProvider;

View File

@@ -792,23 +792,16 @@ void CppEditorWidget::findUsages()
void CppEditorWidget::findUsages(QTextCursor cursor)
{
// 'this' in cursorInEditor is never used (and must never be used) asynchronously.
const CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this,
textDocument()};
const CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this, textDocument()};
QPointer<CppEditorWidget> cppEditorWidget = this;
d->m_modelManager->findUsages(cursorInEditor,
[=](const Usages &usages) {
if (!cppEditorWidget)
return;
findRenameCallback(cppEditorWidget.data(), cursor, usages);
});
d->m_modelManager->findUsages(cursorInEditor);
}
void CppEditorWidget::renameUsages(const QString &replacement, QTextCursor cursor)
{
if (cursor.isNull())
cursor = textCursor();
CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this,
textDocument()};
CursorInEditor cursorInEditor{cursor, textDocument()->filePath(), this, textDocument()};
QPointer<CppEditorWidget> cppEditorWidget = this;
d->m_modelManager->globalRename(cursorInEditor, replacement);
}

View File

@@ -322,10 +322,9 @@ void CppModelManager::globalRename(const CursorInEditor &data, const QString &re
instance()->modelManagerSupport(backend)->globalRename(data, replacement);
}
void CppModelManager::findUsages(const CursorInEditor &data,
UsagesCallback &&showUsagesCallback, Backend backend)
void CppModelManager::findUsages(const CursorInEditor &data, Backend backend)
{
instance()->modelManagerSupport(backend)->findUsages(data, std::move(showUsagesCallback));
instance()->modelManagerSupport(backend)->findUsages(data);
}
void CppModelManager::switchHeaderSource(bool inNextSplit, Backend backend)

View File

@@ -181,8 +181,7 @@ public:
Backend backend = Backend::Best);
static void globalRename(const CursorInEditor &data, const QString &replacement,
Backend backend = Backend::Best);
static void findUsages(const CursorInEditor &data, UsagesCallback &&showUsagesCallback,
Backend backend = Backend::Best);
static void findUsages(const CursorInEditor &data, Backend backend = Backend::Best);
static void switchHeaderSource(bool inNextSplit, Backend backend = Backend::Best);
static Core::ILocatorFilter *createAuxiliaryCurrentDocumentFilter();

View File

@@ -74,8 +74,7 @@ public:
const ProjectPart *projectPart,
RenameCallback &&renameSymbolsCallback) = 0;
virtual void globalRename(const CursorInEditor &data, const QString &replacement) = 0;
virtual void findUsages(const CursorInEditor &data,
UsagesCallback &&showUsagesCallback) const = 0;
virtual void findUsages(const CursorInEditor &data) const = 0;
virtual void switchHeaderSource(const Utils::FilePath &filePath, bool inNextSplit) = 0;
};