forked from qt-creator/qt-creator
ClangFormat: Refactor indenter to allow ClangFormat unit-tests
We do not build texteditor files in unit-tests so some tricks were required to make ClangFormatIndenter available. First simple unit-test proofs it builds and runs. Change-Id: I81d5ea099bd27fd1c1ed8b5b7877299dcc62a67f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -1071,7 +1071,7 @@ QmlJSEditorFactory::QmlJSEditorFactory()
|
||||
void QmlJSEditorFactory::decorateEditor(TextEditorWidget *editor)
|
||||
{
|
||||
editor->textDocument()->setSyntaxHighlighter(new QmlJSHighlighter);
|
||||
editor->textDocument()->setIndenter(new Indenter);
|
||||
editor->textDocument()->setIndenter(new Indenter(editor->textDocument()->document()));
|
||||
editor->setAutoCompleter(new AutoCompleter);
|
||||
}
|
||||
|
||||
|
||||
@@ -653,7 +653,7 @@ QmlJSEditorDocument::QmlJSEditorDocument()
|
||||
connect(this, &TextEditor::TextDocument::tabSettingsChanged,
|
||||
d, &Internal::QmlJSEditorDocumentPrivate::invalidateFormatterCache);
|
||||
setSyntaxHighlighter(new QmlJSHighlighter(document()));
|
||||
setIndenter(new Internal::Indenter);
|
||||
setIndenter(new Internal::Indenter(document()));
|
||||
}
|
||||
|
||||
QmlJSEditorDocument::~QmlJSEditorDocument()
|
||||
|
||||
@@ -421,8 +421,8 @@ void QuickToolBar::indentLines(int startLine, int endLine)
|
||||
QTextBlock start = m_editorWidget->document()->findBlockByNumber(i);
|
||||
|
||||
if (start.isValid()) {
|
||||
QmlJSEditor::Internal::Indenter indenterMy;
|
||||
indenterMy.indentBlock(m_editorWidget->document(), start, QChar::Null, tabSettings);
|
||||
QmlJSEditor::Internal::Indenter indenterMy(m_editorWidget->document());
|
||||
indenterMy.indentBlock(start, QChar::Null, tabSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user