blob: e260c2bb8a64bb131365528f7d32b2158067ee78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qmljsquickfix.h"
#include "qmljsquickfixassist.h"
#include <extensionsystem/iplugin.h>
#include <extensionsystem/pluginmanager.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljs/parser/qmljsast_p.h>
#include <utils/algorithm.h>
using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJSTools;
using TextEditor::RefactoringFileFactory;
namespace QmlJSEditor {
using namespace Internal;
QmlJSQuickFixOperation::QmlJSQuickFixOperation(const QmlJSQuickFixAssistInterface *interface,
int priority)
: QuickFixOperation(priority)
, m_semanticInfo(interface->semanticInfo())
{
}
void QmlJSQuickFixOperation::perform()
{
QmlJSRefactoringChanges refactoring(ModelManagerInterface::instance(), semanticInfo().snapshot);
QmlJSRefactoringFilePtr current = refactoring.qmlJSFile(fileName());
performChanges(current, refactoring);
}
const QmlJSTools::SemanticInfo &QmlJSQuickFixOperation::semanticInfo() const
{
return m_semanticInfo;
}
Utils::FilePath QmlJSQuickFixOperation::fileName() const
{
return semanticInfo().document->fileName();
}
} // namespace QmlJSEditor
|