Commit 2fbb003a authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

lspclient: make highlight goto location optional

parent 8224b6fd
......@@ -58,6 +58,7 @@ LSPClientConfigPage::LSPClientConfigPage(QWidget *parent, LSPClientPlugin *plugi
ui->chkMessages,
ui->chkOnTypeFormatting,
ui->chkIncrementalSync,
ui->chkHighlightGoto,
ui->chkSemanticHighlighting,
ui->chkAutoHover,
ui->chkSignatureHelp}) {
......@@ -132,6 +133,7 @@ void LSPClientConfigPage::apply()
m_plugin->m_autoHover = ui->chkAutoHover->isChecked();
m_plugin->m_onTypeFormatting = ui->chkOnTypeFormatting->isChecked();
m_plugin->m_incrementalSync = ui->chkIncrementalSync->isChecked();
m_plugin->m_highlightGoto = ui->chkHighlightGoto->isChecked();
m_plugin->m_semanticHighlighting = ui->chkSemanticHighlighting->isChecked();
m_plugin->m_signatureHelp = ui->chkSignatureHelp->isChecked();
......@@ -170,6 +172,7 @@ void LSPClientConfigPage::reset()
ui->chkAutoHover->setChecked(m_plugin->m_autoHover);
ui->chkOnTypeFormatting->setChecked(m_plugin->m_onTypeFormatting);
ui->chkIncrementalSync->setChecked(m_plugin->m_incrementalSync);
ui->chkHighlightGoto->setChecked(m_plugin->m_highlightGoto);
ui->chkSemanticHighlighting->setChecked(m_plugin->m_semanticHighlighting);
ui->chkSignatureHelp->setChecked(m_plugin->m_signatureHelp);
......
......@@ -28,6 +28,7 @@ static const QString CONFIG_REFERENCES_DECLARATION{QStringLiteral("ReferencesDec
static const QString CONFIG_AUTO_HOVER{QStringLiteral("AutoHover")};
static const QString CONFIG_TYPE_FORMATTING{QStringLiteral("TypeFormatting")};
static const QString CONFIG_INCREMENTAL_SYNC{QStringLiteral("IncrementalSync")};
static const QString CONFIG_HIGHLIGHT_GOTO{QStringLiteral("HighlightGoto")};
static const QString CONFIG_DIAGNOSTICS{QStringLiteral("Diagnostics")};
static const QString CONFIG_DIAGNOSTICS_HIGHLIGHT{QStringLiteral("DiagnosticsHighlight")};
static const QString CONFIG_DIAGNOSTICS_MARK{QStringLiteral("DiagnosticsMark")};
......@@ -97,6 +98,7 @@ void LSPClientPlugin::readConfig()
m_autoHover = config.readEntry(CONFIG_AUTO_HOVER, true);
m_onTypeFormatting = config.readEntry(CONFIG_TYPE_FORMATTING, false);
m_incrementalSync = config.readEntry(CONFIG_INCREMENTAL_SYNC, false);
m_highlightGoto = config.readEntry(CONFIG_HIGHLIGHT_GOTO, true);
m_diagnostics = config.readEntry(CONFIG_DIAGNOSTICS, true);
m_diagnosticsHighlight = config.readEntry(CONFIG_DIAGNOSTICS_HIGHLIGHT, true);
m_diagnosticsMark = config.readEntry(CONFIG_DIAGNOSTICS_MARK, true);
......@@ -122,6 +124,7 @@ void LSPClientPlugin::writeConfig() const
config.writeEntry(CONFIG_AUTO_HOVER, m_autoHover);
config.writeEntry(CONFIG_TYPE_FORMATTING, m_onTypeFormatting);
config.writeEntry(CONFIG_INCREMENTAL_SYNC, m_incrementalSync);
config.writeEntry(CONFIG_HIGHLIGHT_GOTO, m_highlightGoto);
config.writeEntry(CONFIG_DIAGNOSTICS, m_diagnostics);
config.writeEntry(CONFIG_DIAGNOSTICS_HIGHLIGHT, m_diagnosticsHighlight);
config.writeEntry(CONFIG_DIAGNOSTICS_MARK, m_diagnosticsMark);
......
......@@ -51,6 +51,7 @@ public:
bool m_autoHover = false;
bool m_onTypeFormatting = false;
bool m_incrementalSync = false;
bool m_highlightGoto = true;
QUrl m_configPath;
bool m_semanticHighlighting = false;
bool m_signatureHelp = true;
......
......@@ -320,6 +320,7 @@ class LSPClientActionView : public QObject
QPointer<QAction> m_autoHover;
QPointer<QAction> m_onTypeFormatting;
QPointer<QAction> m_incrementalSync;
QPointer<QAction> m_highlightGoto;
QPointer<QAction> m_diagnostics;
QPointer<QAction> m_diagnosticsHighlight;
QPointer<QAction> m_diagnosticsMark;
......@@ -473,6 +474,9 @@ public:
m_incrementalSync = actionCollection()->addAction(QStringLiteral("lspclient_incremental_sync"), this, &self_type::displayOptionChanged);
m_incrementalSync->setText(i18n("Incremental document synchronization"));
m_incrementalSync->setCheckable(true);
m_highlightGoto = actionCollection()->addAction(QStringLiteral("lspclient_highlight_goto"), this, &self_type::displayOptionChanged);
m_highlightGoto->setText(i18n("Highlight goto location"));
m_highlightGoto->setCheckable(true);
// diagnostics
m_diagnostics = actionCollection()->addAction(QStringLiteral("lspclient_diagnostics"), this, &self_type::displayOptionChanged);
......@@ -532,6 +536,7 @@ public:
moreOptions->addAction(m_autoHover);
moreOptions->addAction(m_onTypeFormatting);
moreOptions->addAction(m_incrementalSync);
moreOptions->addAction(m_highlightGoto);
moreOptions->addSeparator();
moreOptions->addAction(m_diagnostics);
moreOptions->addAction(m_diagnosticsHighlight);
......@@ -789,6 +794,9 @@ public:
if (m_incrementalSync) {
m_incrementalSync->setChecked(m_plugin->m_incrementalSync);
}
if (m_highlightGoto) {
m_highlightGoto->setChecked(m_plugin->m_highlightGoto);
}
if (m_diagnostics) {
m_diagnostics->setChecked(m_plugin->m_diagnostics);
}
......@@ -1060,6 +1068,9 @@ public:
*/
void highlightLandingLocation(KTextEditor::View *view, const KTextEditor::Range &location)
{
if (!m_highlightGoto || !m_highlightGoto->isChecked()) {
return;
}
auto doc = view->document();
if (!doc) {
return;
......
......@@ -76,6 +76,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkHighlightGoto">
<property name="text">
<string>Highlight goto location</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkSemanticHighlighting">
<property name="text">
......
......@@ -30,6 +30,7 @@
<Action name="lspclient_auto_hover"/>
<Action name="lspclient_type_formatting"/>
<Action name="lspclient_incremental_sync"/>
<Action name="lspclient_highlight_goto"/>
<Separator/>
<Action name="lspclient_diagnostics"/>
<Action name="lspclient_diagnostics_highlight"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment