forked from qt-creator/qt-creator
QMLJSEditor Exporting few classes
These changes are required for the new Binding Editor Change-Id: Ic1e833819c69831aa1a930ab668a644ae4ccdd6f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -46,6 +46,7 @@ namespace QmlJS { class Value; }
|
||||
namespace QmlJSEditor {
|
||||
|
||||
class QmlJSCompletionAssistInterface;
|
||||
class QmlJSCompletionAssistProvider;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -72,19 +73,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class QmlJSCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TextEditor::IAssistProcessor *createProcessor() const override;
|
||||
|
||||
int activationCharSequenceLength() const override;
|
||||
bool isActivationCharSequence(const QString &sequence) const override;
|
||||
bool isContinuationChar(const QChar &c) const override;
|
||||
};
|
||||
|
||||
|
||||
class QmlJSCompletionAssistProcessor : public TextEditor::IAssistProcessor
|
||||
{
|
||||
public:
|
||||
@@ -131,6 +119,20 @@ private:
|
||||
QmlJSTools::SemanticInfo m_semanticInfo;
|
||||
};
|
||||
|
||||
|
||||
class QMLJSEDITOR_EXPORT QmlJSCompletionAssistProvider : public TextEditor::CompletionAssistProvider
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TextEditor::IAssistProcessor *createProcessor() const override;
|
||||
|
||||
int activationCharSequenceLength() const override;
|
||||
bool isActivationCharSequence(const QString &sequence) const override;
|
||||
bool isContinuationChar(const QChar &c) const override;
|
||||
};
|
||||
|
||||
|
||||
QStringList QMLJSEDITOR_EXPORT qmlJSAutoComplete(QTextDocument *textDocument,
|
||||
int position,
|
||||
const QString &fileName,
|
||||
|
||||
@@ -102,7 +102,6 @@ using namespace QmlJSTools;
|
||||
using namespace TextEditor;
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
//
|
||||
// QmlJSEditorWidget
|
||||
@@ -132,7 +131,7 @@ void QmlJSEditorWidget::finalizeInitialization()
|
||||
textDocument()->setCodec(QTextCodec::codecForName("UTF-8")); // qml files are defined to be utf-8
|
||||
|
||||
m_modelManager = ModelManagerInterface::instance();
|
||||
m_contextPane = QmlJSEditorPlugin::quickToolBar();
|
||||
m_contextPane = Internal::QmlJSEditorPlugin::quickToolBar();
|
||||
|
||||
m_modelManager->activateScan();
|
||||
|
||||
@@ -269,12 +268,11 @@ void QmlJSEditorWidget::updateOutlineIndexNow()
|
||||
m_outlineCombo->setRootModelIndex(QModelIndex());
|
||||
}
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
void QmlJSEditorWidget::updateContextPane()
|
||||
{
|
||||
@@ -507,7 +505,7 @@ void QmlJSEditorWidget::createToolBar()
|
||||
|
||||
auto itemDelegate = new Utils::AnnotatedItemDelegate(this);
|
||||
itemDelegate->setDelimiter(QLatin1String(" "));
|
||||
itemDelegate->setAnnotationRole(QmlOutlineModel::AnnotationRole);
|
||||
itemDelegate->setAnnotationRole(Internal::QmlOutlineModel::AnnotationRole);
|
||||
treeView->setItemDelegateForColumn(0, itemDelegate);
|
||||
|
||||
treeView->header()->hide();
|
||||
@@ -525,7 +523,7 @@ void QmlJSEditorWidget::createToolBar()
|
||||
|
||||
connect(m_outlineCombo, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &QmlJSEditorWidget::jumpToOutlineElement);
|
||||
connect(m_qmlJsEditorDocument->outlineModel(), &QmlOutlineModel::updated,
|
||||
connect(m_qmlJsEditorDocument->outlineModel(), &Internal::QmlOutlineModel::updated,
|
||||
static_cast<QTreeView *>(m_outlineCombo->view()), &QTreeView::expandAll);
|
||||
|
||||
connect(this, &QmlJSEditorWidget::cursorPositionChanged,
|
||||
@@ -830,7 +828,7 @@ void QmlJSEditorWidget::contextMenuEvent(QContextMenuEvent *e)
|
||||
AssistInterface *interface = createAssistInterface(QuickFix, ExplicitlyInvoked);
|
||||
if (interface) {
|
||||
QScopedPointer<IAssistProcessor> processor(
|
||||
QmlJSEditorPlugin::quickFixAssistProvider()->createProcessor());
|
||||
Internal::QmlJSEditorPlugin::quickFixAssistProvider()->createProcessor());
|
||||
QScopedPointer<IAssistProposal> proposal(processor->perform(interface));
|
||||
if (!proposal.isNull()) {
|
||||
GenericProposalModelPtr model = proposal->model().staticCast<GenericProposalModel>();
|
||||
@@ -939,7 +937,7 @@ QModelIndex QmlJSEditorWidget::indexForPosition(unsigned cursorPosition, const Q
|
||||
{
|
||||
QModelIndex lastIndex = rootIndex;
|
||||
|
||||
QmlOutlineModel *model = m_qmlJsEditorDocument->outlineModel();
|
||||
Internal::QmlOutlineModel *model = m_qmlJsEditorDocument->outlineModel();
|
||||
const int rowCount = model->rowCount(rootIndex);
|
||||
for (int i = 0; i < rowCount; ++i) {
|
||||
QModelIndex childIndex = model->index(i, 0, rootIndex);
|
||||
@@ -979,7 +977,7 @@ AssistInterface *QmlJSEditorWidget::createAssistInterface(
|
||||
reason,
|
||||
m_qmlJsEditorDocument->semanticInfo());
|
||||
} else if (assistKind == QuickFix) {
|
||||
return new QmlJSQuickFixAssistInterface(const_cast<QmlJSEditorWidget *>(this), reason);
|
||||
return new Internal::QmlJSQuickFixAssistInterface(const_cast<QmlJSEditorWidget *>(this), reason);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1043,7 +1041,7 @@ QmlJSEditorFactory::QmlJSEditorFactory()
|
||||
setDocumentCreator([]() { return new QmlJSEditorDocument; });
|
||||
setEditorWidgetCreator([]() { return new QmlJSEditorWidget; });
|
||||
setEditorCreator([]() { return new QmlJSEditor; });
|
||||
setAutoCompleterCreator([]() { return new AutoCompleter; });
|
||||
setAutoCompleterCreator([]() { return new Internal::AutoCompleter; });
|
||||
setCommentDefinition(Utils::CommentDefinition::CppStyle);
|
||||
setParenthesesMatchingEnabled(true);
|
||||
setCodeFoldingSupported(true);
|
||||
@@ -1060,9 +1058,8 @@ QmlJSEditorFactory::QmlJSEditorFactory()
|
||||
void QmlJSEditorFactory::decorateEditor(TextEditorWidget *editor)
|
||||
{
|
||||
editor->textDocument()->setSyntaxHighlighter(new QmlJSHighlighter);
|
||||
editor->textDocument()->setIndenter(new Indenter(editor->textDocument()->document()));
|
||||
editor->setAutoCompleter(new AutoCompleter);
|
||||
editor->textDocument()->setIndenter(new Internal::Indenter(editor->textDocument()->document()));
|
||||
editor->setAutoCompleter(new Internal::AutoCompleter);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
@@ -52,9 +52,7 @@ class QmlJSEditorDocument;
|
||||
class QuickToolBar;
|
||||
class FindReferences;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSEditorWidget : public TextEditor::TextEditorWidget
|
||||
class QMLJSEDITOR_EXPORT QmlJSEditorWidget : public TextEditor::TextEditorWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -131,7 +129,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class QmlJSEditor : public TextEditor::BaseTextEditor
|
||||
class QMLJSEDITOR_EXPORT QmlJSEditor : public TextEditor::BaseTextEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -141,7 +139,7 @@ public:
|
||||
bool isDesignModePreferred() const override;
|
||||
};
|
||||
|
||||
class QmlJSEditorFactory : public TextEditor::TextEditorFactory
|
||||
class QMLJSEDITOR_EXPORT QmlJSEditorFactory : public TextEditor::TextEditorFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -151,5 +149,4 @@ public:
|
||||
static void decorateEditor(TextEditor::TextEditorWidget *editor);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
@@ -37,11 +37,12 @@ namespace TextEditor { class TextMark; }
|
||||
namespace QmlJSEditor {
|
||||
|
||||
class QmlJSEditorDocument;
|
||||
class SemanticHighlighter;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QmlOutlineModel;
|
||||
class SemanticHighlighter;
|
||||
|
||||
class SemanticInfoUpdater;
|
||||
|
||||
class QmlJSEditorDocumentPrivate : public QObject
|
||||
@@ -72,7 +73,7 @@ public:
|
||||
SemanticInfoUpdater *m_semanticInfoUpdater;
|
||||
QmlJSTools::SemanticInfo m_semanticInfo;
|
||||
QVector<QTextLayout::FormatRange> m_diagnosticRanges;
|
||||
Internal::SemanticHighlighter *m_semanticHighlighter = nullptr;
|
||||
SemanticHighlighter *m_semanticHighlighter = nullptr;
|
||||
bool m_semanticHighlightingNecessary = false;
|
||||
bool m_outlineModelNeedsUpdate = false;
|
||||
bool m_firstSementicInfo = true;
|
||||
|
||||
@@ -59,7 +59,6 @@ using namespace QmlJS;
|
||||
using namespace TextEditor;
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -517,6 +516,5 @@ bool QmlJSHoverHandler::setQmlHelpItem(const ScopeChain &scopeChain,
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qmljseditor/qmljseditor_global.h>
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
#include <texteditor/basehoverhandler.h>
|
||||
|
||||
@@ -44,11 +45,10 @@ class ObjectValue;
|
||||
}
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSEditorWidget;
|
||||
|
||||
class QmlJSHoverHandler : public TextEditor::BaseHoverHandler
|
||||
class QMLJSEDITOR_EXPORT QmlJSHoverHandler : public TextEditor::BaseHoverHandler
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QmlJSHoverHandler)
|
||||
|
||||
@@ -86,5 +86,4 @@ private:
|
||||
QColor m_colorTip;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
@@ -38,9 +38,11 @@ namespace Core { class IEditor; }
|
||||
namespace QmlJS { class Editor; }
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSEditorWidget;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSOutlineTreeView;
|
||||
|
||||
class QmlJSOutlineFilterModel : public QSortFilterProxyModel
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
#include <texteditor/codeassist/iassistprovider.h>
|
||||
|
||||
namespace QmlJSEditor {
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSEditorWidget;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QmlJSQuickFixAssistInterface : public TextEditor::AssistInterface
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -54,8 +54,6 @@ using namespace QmlJS::AST;
|
||||
|
||||
namespace QmlJSEditor {
|
||||
|
||||
using namespace Internal;
|
||||
|
||||
namespace {
|
||||
|
||||
static bool isIdScope(const ObjectValue *scope, const QList<const QmlComponentChain *> &chain)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <qmljseditor/qmljseditor_global.h>
|
||||
#include <texteditor/semantichighlighter.h>
|
||||
#include <QFutureWatcher>
|
||||
#include <QTextLayout>
|
||||
@@ -42,9 +43,7 @@ namespace QmlJSEditor {
|
||||
|
||||
class QmlJSEditorDocument;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class SemanticHighlighter : public QObject
|
||||
class QMLJSEDITOR_EXPORT SemanticHighlighter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -92,5 +91,4 @@ private:
|
||||
QVector<QTextLayout::FormatRange> m_diagnosticRanges;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmlJSEditor
|
||||
|
||||
Reference in New Issue
Block a user