Line length for QML/JS editing automatic formatting

Adding parameters to functions in the QML/JS formatter
Adding widget and setting to the QML/JS editing settings

Fixes: QTCREATORBUG-23411
Change-Id: Ib9d3ac3b22443e81cd636fbc276c6544dab1511b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
Xavier BESSON
2022-04-02 12:15:26 +02:00
parent 4762d54401
commit 87e52ad189
21 changed files with 780 additions and 61 deletions

View File

@@ -25,10 +25,10 @@
#include "qmljstoolssettings.h"
#include "qmljstoolsconstants.h"
#include "qmljscodestylepreferences.h"
#include "qmljscodestylepreferencesfactory.h"
#include <texteditor/texteditorsettings.h>
#include <texteditor/simplecodestylepreferences.h>
#include <texteditor/tabsettings.h>
#include <texteditor/codestylepool.h>
@@ -44,7 +44,7 @@ namespace QmlJSTools {
const char idKey[] = "QmlJSGlobal";
static SimpleCodeStylePreferences *m_globalCodeStyle = nullptr;
static QmlJSCodeStylePreferences *m_globalCodeStyle = nullptr;
QmlJSToolsSettings::QmlJSToolsSettings()
{
@@ -59,7 +59,7 @@ QmlJSToolsSettings::QmlJSToolsSettings()
TextEditorSettings::registerCodeStylePool(Constants::QML_JS_SETTINGS_ID, pool);
// global code style settings
m_globalCodeStyle = new SimpleCodeStylePreferences(this);
m_globalCodeStyle = new QmlJSCodeStylePreferences(this);
m_globalCodeStyle->setDelegatingPool(pool);
m_globalCodeStyle->setDisplayName(tr("Global", "Settings"));
m_globalCodeStyle->setId(idKey);
@@ -68,7 +68,7 @@ QmlJSToolsSettings::QmlJSToolsSettings()
// built-in settings
// Qt style
auto qtCodeStyle = new SimpleCodeStylePreferences;
auto qtCodeStyle = new QmlJSCodeStylePreferences;
qtCodeStyle->setId("qt");
qtCodeStyle->setDisplayName(tr("Qt"));
qtCodeStyle->setReadOnly(true);
@@ -78,6 +78,9 @@ QmlJSToolsSettings::QmlJSToolsSettings()
qtTabSettings.m_indentSize = 4;
qtTabSettings.m_continuationAlignBehavior = TabSettings::ContinuationAlignWithIndent;
qtCodeStyle->setTabSettings(qtTabSettings);
QmlJSCodeStyleSettings qtQmlJSSetings;
qtQmlJSSetings.lineLength = 80;
qtCodeStyle->setCodeStyleSettings(qtQmlJSSetings);
pool->addCodeStyle(qtCodeStyle);
// default delegate for global preferences
@@ -148,7 +151,7 @@ QmlJSToolsSettings::~QmlJSToolsSettings()
m_globalCodeStyle = nullptr;
}
SimpleCodeStylePreferences *QmlJSToolsSettings::globalCodeStyle()
QmlJSCodeStylePreferences *QmlJSToolsSettings::globalCodeStyle()
{
return m_globalCodeStyle;
}