forked from qt-creator/qt-creator
LanguageClient: Rename jsonEditor()
Also adds QObject *parent argument for ease of use. Change-Id: I25d23186d398d35ebc8519b5964da637bf4d028d Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1073,7 +1073,7 @@ bool LanguageFilter::operator!=(const LanguageFilter &other) const
|
|||||||
return this->filePattern != other.filePattern || this->mimeTypes != other.mimeTypes;
|
return this->filePattern != other.filePattern || this->mimeTypes != other.mimeTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::BaseTextEditor *jsonEditor()
|
TextEditor::BaseTextEditor *createJsonEditor(QObject *parent)
|
||||||
{
|
{
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace Utils::Text;
|
using namespace Utils::Text;
|
||||||
@@ -1085,6 +1085,8 @@ TextEditor::BaseTextEditor *jsonEditor()
|
|||||||
delete editor;
|
delete editor;
|
||||||
}
|
}
|
||||||
QTC_ASSERT(textEditor, textEditor = createPlainTextEditor());
|
QTC_ASSERT(textEditor, textEditor = createPlainTextEditor());
|
||||||
|
textEditor->setParent(parent);
|
||||||
|
|
||||||
TextDocument *document = textEditor->textDocument();
|
TextDocument *document = textEditor->textDocument();
|
||||||
TextEditorWidget *widget = textEditor->editorWidget();
|
TextEditorWidget *widget = textEditor->editorWidget();
|
||||||
widget->configureGenericHighlighter(mimeTypeForName(Utils::Constants::JSON_MIMETYPE));
|
widget->configureGenericHighlighter(mimeTypeForName(Utils::Constants::JSON_MIMETYPE));
|
||||||
@@ -1162,7 +1164,7 @@ public:
|
|||||||
setGlobalSettingsId(Constants::LANGUAGECLIENT_SETTINGS_PAGE);
|
setGlobalSettingsId(Constants::LANGUAGECLIENT_SETTINGS_PAGE);
|
||||||
setExpanding(true);
|
setExpanding(true);
|
||||||
|
|
||||||
TextEditor::BaseTextEditor *editor = jsonEditor();
|
TextEditor::BaseTextEditor *editor = createJsonEditor(this);
|
||||||
editor->document()->setContents(m_settings.json());
|
editor->document()->setContents(m_settings.json());
|
||||||
|
|
||||||
auto layout = new QVBoxLayout;
|
auto layout = new QVBoxLayout;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ private:
|
|||||||
QByteArray m_json;
|
QByteArray m_json;
|
||||||
};
|
};
|
||||||
|
|
||||||
LANGUAGECLIENT_EXPORT TextEditor::BaseTextEditor *jsonEditor();
|
LANGUAGECLIENT_EXPORT TextEditor::BaseTextEditor *createJsonEditor(QObject *parent = nullptr);
|
||||||
|
|
||||||
void setupLanguageClientProjectPanel();
|
void setupLanguageClientProjectPanel();
|
||||||
|
|
||||||
|
|||||||
@@ -462,8 +462,7 @@ LspInspectorWidget::LspInspectorWidget(LspInspector *inspector)
|
|||||||
currentClientChanged(m_clients->currentText());
|
currentClientChanged(m_clients->currentText());
|
||||||
});
|
});
|
||||||
|
|
||||||
TextEditor::BaseTextEditor *messageEditor = LanguageClient::jsonEditor();
|
TextEditor::BaseTextEditor *messageEditor = LanguageClient::createJsonEditor(this);
|
||||||
messageEditor->setParent(this);
|
|
||||||
messageEditor->editorWidget()->setVisible(false);
|
messageEditor->editorWidget()->setVisible(false);
|
||||||
messageEditor->document()->setContents(R"({
|
messageEditor->document()->setContents(R"({
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
|
|||||||
@@ -412,13 +412,11 @@ class PyLSConfigureWidget : public Core::IOptionsPageWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PyLSConfigureWidget()
|
PyLSConfigureWidget()
|
||||||
: m_editor(LanguageClient::jsonEditor())
|
: m_editor(LanguageClient::createJsonEditor(this))
|
||||||
, m_advancedLabel(new QLabel)
|
, m_advancedLabel(new QLabel)
|
||||||
, m_pluginsGroup(new QGroupBox(Tr::tr("Plugins:")))
|
, m_pluginsGroup(new QGroupBox(Tr::tr("Plugins:")))
|
||||||
, m_mainGroup(new QGroupBox(Tr::tr("Use Python Language Server")))
|
, m_mainGroup(new QGroupBox(Tr::tr("Use Python Language Server")))
|
||||||
|
|
||||||
{
|
{
|
||||||
m_editor->setParent(this);
|
|
||||||
m_mainGroup->setCheckable(true);
|
m_mainGroup->setCheckable(true);
|
||||||
|
|
||||||
auto mainGroupLayout = new QVBoxLayout;
|
auto mainGroupLayout = new QVBoxLayout;
|
||||||
|
|||||||
Reference in New Issue
Block a user