2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2010-06-03 15:49:29 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-06-03 15:49:29 +02:00
|
|
|
|
|
|
|
|
#include <texteditor/quickfix.h>
|
2010-06-04 11:02:01 +02:00
|
|
|
#include <qmljs/parser/qmljsastfwd_p.h>
|
2010-06-07 12:12:07 +02:00
|
|
|
#include <qmljs/qmljsdocument.h>
|
2010-11-11 10:05:05 +01:00
|
|
|
#include <qmljstools/qmljsrefactoringchanges.h>
|
2023-02-06 15:32:00 +01:00
|
|
|
#include <qmljstools/qmljssemanticinfo.h>
|
2010-06-03 15:49:29 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QSharedPointer>
|
2011-04-15 16:19:23 +02:00
|
|
|
|
2010-06-09 15:56:03 +02:00
|
|
|
namespace QmlJSEditor {
|
2010-06-03 15:49:29 +02:00
|
|
|
|
2012-10-10 23:27:16 +02:00
|
|
|
namespace Internal { class QmlJSQuickFixAssistInterface; }
|
2010-06-03 15:49:29 +02:00
|
|
|
|
2018-11-24 02:45:30 +01:00
|
|
|
using TextEditor::QuickFixOperation;
|
|
|
|
|
using TextEditor::QuickFixOperations;
|
|
|
|
|
using TextEditor::QuickFixInterface;
|
2010-07-26 13:06:33 +02:00
|
|
|
|
2010-07-28 17:33:21 +02:00
|
|
|
/*!
|
2011-04-15 16:19:23 +02:00
|
|
|
A quick-fix operation for the QML/JavaScript editor.
|
2010-07-28 17:33:21 +02:00
|
|
|
*/
|
2010-07-26 17:38:13 +02:00
|
|
|
class QmlJSQuickFixOperation: public TextEditor::QuickFixOperation
|
2010-07-26 13:06:33 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2010-07-28 17:33:21 +02:00
|
|
|
/*!
|
|
|
|
|
Creates a new QmlJSQuickFixOperation.
|
|
|
|
|
|
2011-04-15 16:19:23 +02:00
|
|
|
\param interface The interface on which the operation is performed.
|
2010-07-28 17:33:21 +02:00
|
|
|
\param priority The priority for this operation.
|
|
|
|
|
*/
|
2023-02-06 15:32:00 +01:00
|
|
|
explicit QmlJSQuickFixOperation(const Internal::QmlJSQuickFixAssistInterface *interface,
|
|
|
|
|
int priority = -1);
|
2010-07-26 13:06:33 +02:00
|
|
|
|
2018-05-07 15:11:45 +02:00
|
|
|
void perform() override;
|
2010-08-12 13:46:18 +02:00
|
|
|
|
2010-07-28 17:33:21 +02:00
|
|
|
protected:
|
2018-11-24 02:45:30 +01:00
|
|
|
using Range = Utils::ChangeSet::Range;
|
2010-08-13 12:49:11 +02:00
|
|
|
|
2011-08-17 11:35:57 +02:00
|
|
|
virtual void performChanges(QmlJSTools::QmlJSRefactoringFilePtr currentFile,
|
|
|
|
|
const QmlJSTools::QmlJSRefactoringChanges &refactoring) = 0;
|
2010-08-12 13:46:18 +02:00
|
|
|
|
2023-02-06 15:32:00 +01:00
|
|
|
const QmlJSTools::SemanticInfo &semanticInfo() const;
|
2010-06-07 12:12:07 +02:00
|
|
|
|
2023-03-24 12:07:30 +01:00
|
|
|
/// Returns The name of the file for for which this operation is invoked.
|
2022-06-20 12:35:13 +02:00
|
|
|
Utils::FilePath fileName() const;
|
2010-06-14 17:15:53 +02:00
|
|
|
|
2010-06-07 12:12:07 +02:00
|
|
|
private:
|
2023-02-06 15:32:00 +01:00
|
|
|
const QmlJSTools::SemanticInfo m_semanticInfo;
|
2010-07-26 13:06:33 +02:00
|
|
|
};
|
|
|
|
|
|
2017-12-18 12:23:28 +01:00
|
|
|
TextEditor::QuickFixOperations findQmlJSQuickFixes(const TextEditor::AssistInterface *interface);
|
2010-06-04 11:02:01 +02:00
|
|
|
|
2011-02-04 09:52:39 +01:00
|
|
|
} // namespace QmlJSEditor
|