forked from qt-creator/qt-creator
QmlJSEditor: Create QuickFixes directly
So far there have been factories instantiated and maintained to get a list of 'matching' operation by iterating over the factories' match() functions. The same effect can be achieved more directly by calling stand-alone functions. Change-Id: I868489d36f9d8339e0d8855d832df8400501026c Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
@@ -42,22 +42,6 @@ namespace QmlJSEditor {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
// -----------------------
|
||||
// QmlJSQuickFixFactory
|
||||
// -----------------------
|
||||
|
||||
static QList<QmlJSQuickFixFactory *> g_qmlJSQuickFixFactories;
|
||||
|
||||
QmlJSQuickFixFactory::QmlJSQuickFixFactory()
|
||||
{
|
||||
g_qmlJSQuickFixFactories.append(this);
|
||||
}
|
||||
|
||||
QmlJSQuickFixFactory::~QmlJSQuickFixFactory()
|
||||
{
|
||||
g_qmlJSQuickFixFactories.removeOne(this);
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
// QmlJSQuickFixAssistInterface
|
||||
// -----------------------
|
||||
@@ -89,15 +73,7 @@ class QmlJSQuickFixAssistProcessor : public IAssistProcessor
|
||||
{
|
||||
IAssistProposal *perform(const AssistInterface *interface) override
|
||||
{
|
||||
QSharedPointer<const AssistInterface> assistInterface(interface);
|
||||
auto qmlJSInterface = assistInterface.staticCast<const QmlJSQuickFixAssistInterface>();
|
||||
|
||||
QuickFixOperations quickFixes;
|
||||
|
||||
for (QmlJSQuickFixFactory *factory : g_qmlJSQuickFixFactories)
|
||||
factory->match(qmlJSInterface, quickFixes);
|
||||
|
||||
return GenericProposal::createProposal(interface, quickFixes);
|
||||
return GenericProposal::createProposal(interface, findQmlJSQuickFixes(interface));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user