forked from qt-creator/qt-creator
CppEditor filters: Reimplement matchers()
They are used only when ClangCodeModel plugin is disabled. Activated with '.', ':', 'c' and 'm' shortcuts. Change-Id: I131473c419e0cb302492cc6d4263bd8ad80769e4 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Internal {
|
||||
|
||||
const int MaxResultCount = 10000;
|
||||
|
||||
// TODO: Remove this class, it's used only internally by ClangGlobalSymbolFilter
|
||||
class CppLocatorFilter : public CppEditor::CppLocatorFilter
|
||||
{
|
||||
public:
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// TODO: Remove this class, it's used only internally by ClangClassesFilter
|
||||
class CppClassesFilter : public CppEditor::CppClassesFilter
|
||||
{
|
||||
public:
|
||||
@@ -98,6 +99,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: Remove this class, it's used only internally by ClangFunctionsFilter
|
||||
class CppFunctionsFilter : public CppEditor::CppFunctionsFilter
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "cppeditorconstants.h"
|
||||
#include "cppeditortr.h"
|
||||
#include "cpplocatorfilter.h"
|
||||
#include "cppmodelmanager.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
@@ -42,6 +43,11 @@ CppCurrentDocumentFilter::CppCurrentDocumentFilter()
|
||||
this, &CppCurrentDocumentFilter::onEditorAboutToClose);
|
||||
}
|
||||
|
||||
LocatorMatcherTasks CppCurrentDocumentFilter::matchers()
|
||||
{
|
||||
return CppEditor::cppMatchers(MatcherType::CurrentDocumentSymbols);
|
||||
}
|
||||
|
||||
void CppCurrentDocumentFilter::makeAuxiliary()
|
||||
{
|
||||
setId({});
|
||||
|
||||
@@ -15,6 +15,7 @@ class CppModelManager;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
// TODO: Move the class into cpplocatorfilter.h
|
||||
class CppCurrentDocumentFilter : public Core::ILocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -28,6 +29,7 @@ public:
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
|
||||
const QString &entry) override;
|
||||
private:
|
||||
Core::LocatorMatcherTasks matchers() final;
|
||||
void onDocumentUpdated(CPlusPlus::Document::Ptr doc);
|
||||
void onCurrentEditorChanged(Core::IEditor *currentEditor);
|
||||
void onEditorAboutToClose(Core::IEditor *currentEditor);
|
||||
|
||||
@@ -339,6 +339,11 @@ CppLocatorFilter::CppLocatorFilter()
|
||||
setDefaultIncludedByDefault(false);
|
||||
}
|
||||
|
||||
LocatorMatcherTasks CppLocatorFilter::matchers()
|
||||
{
|
||||
return {allSymbolsMatcher()};
|
||||
}
|
||||
|
||||
LocatorFilterEntry CppLocatorFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
|
||||
{
|
||||
LocatorFilterEntry filterEntry;
|
||||
@@ -437,6 +442,11 @@ CppClassesFilter::CppClassesFilter()
|
||||
setDefaultIncludedByDefault(false);
|
||||
}
|
||||
|
||||
LocatorMatcherTasks CppClassesFilter::matchers()
|
||||
{
|
||||
return {classMatcher()};
|
||||
}
|
||||
|
||||
LocatorFilterEntry CppClassesFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
|
||||
{
|
||||
LocatorFilterEntry filterEntry;
|
||||
@@ -459,6 +469,11 @@ CppFunctionsFilter::CppFunctionsFilter()
|
||||
setDefaultIncludedByDefault(false);
|
||||
}
|
||||
|
||||
LocatorMatcherTasks CppFunctionsFilter::matchers()
|
||||
{
|
||||
return {functionMatcher()};
|
||||
}
|
||||
|
||||
LocatorFilterEntry CppFunctionsFilter::filterEntryFromIndexItem(IndexItem::Ptr info)
|
||||
{
|
||||
QString name = info->symbolName();
|
||||
|
||||
@@ -24,8 +24,12 @@ public:
|
||||
protected:
|
||||
virtual IndexItem::ItemType matchTypes() const { return IndexItem::All; }
|
||||
virtual Core::LocatorFilterEntry filterEntryFromIndexItem(IndexItem::Ptr info);
|
||||
|
||||
private:
|
||||
Core::LocatorMatcherTasks matchers() override;
|
||||
};
|
||||
|
||||
// TODO: Don't derive, flatten the hierarchy
|
||||
class CPPEDITOR_EXPORT CppClassesFilter : public CppLocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -36,8 +40,12 @@ public:
|
||||
protected:
|
||||
IndexItem::ItemType matchTypes() const override { return IndexItem::Class; }
|
||||
Core::LocatorFilterEntry filterEntryFromIndexItem(IndexItem::Ptr info) override;
|
||||
|
||||
private:
|
||||
Core::LocatorMatcherTasks matchers() final;
|
||||
};
|
||||
|
||||
// TODO: Don't derive, flatten the hierarchy
|
||||
class CPPEDITOR_EXPORT CppFunctionsFilter : public CppLocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -48,6 +56,9 @@ public:
|
||||
protected:
|
||||
IndexItem::ItemType matchTypes() const override { return IndexItem::Function; }
|
||||
Core::LocatorFilterEntry filterEntryFromIndexItem(IndexItem::Ptr info) override;
|
||||
|
||||
private:
|
||||
Core::LocatorMatcherTasks matchers() final;
|
||||
};
|
||||
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <cppeditor/cpplocatordata.h>
|
||||
#include <cppeditor/cpplocatorfilter.h>
|
||||
#include <cppeditor/indexitem.h>
|
||||
#include <cppeditor/searchsymbols.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
Reference in New Issue
Block a user