blob: d171061dc88c1f65ed52e4a516ae0ad930cd1a8d (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// 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 "qmljsquickfixassist.h"
#include "qmljseditor.h"
#include "qmljseditorconstants.h"
#include "qmljseditordocument.h"
//temp
#include "qmljsquickfix.h"
#include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/iassistprocessor.h>
#include <utils/algorithm.h>
using namespace QmlJSTools;
using namespace TextEditor;
namespace QmlJSEditor {
using namespace Internal;
// -----------------------
// QmlJSQuickFixAssistInterface
// -----------------------
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSEditorWidget *editor,
AssistReason reason)
: AssistInterface(editor->textCursor(), editor->textDocument()->filePath(), reason)
, m_semanticInfo(editor->qmlJsEditorDocument()->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(editor, m_semanticInfo.document))
{}
QmlJSQuickFixAssistInterface::~QmlJSQuickFixAssistInterface() = default;
const SemanticInfo &QmlJSQuickFixAssistInterface::semanticInfo() const
{
return m_semanticInfo;
}
QmlJSRefactoringFilePtr QmlJSQuickFixAssistInterface::currentFile() const
{
return m_currentFile;
}
// ---------------------------
// QmlJSQuickFixAssistProcessor
// ---------------------------
class QmlJSQuickFixAssistProcessor : public IAssistProcessor
{
IAssistProposal *perform() override
{
return GenericProposal::createProposal(interface(), findQmlJSQuickFixes(interface()));
}
};
// ---------------------------
// QmlJSQuickFixAssistProvider
// ---------------------------
IAssistProcessor *QmlJSQuickFixAssistProvider::createProcessor(const AssistInterface *) const
{
return new QmlJSQuickFixAssistProcessor;
}
} // namespace QmlJSEditor
|