Commit b5f0fa62 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

turn semantic highlighting per default off

parent b54e1356
......@@ -49,6 +49,7 @@ static const QString CONFIG_DIAGNOSTICS {QStringLiteral("Diagnostics")};
static const QString CONFIG_DIAGNOSTICS_HIGHLIGHT {QStringLiteral("DiagnosticsHighlight")};
static const QString CONFIG_DIAGNOSTICS_MARK {QStringLiteral("DiagnosticsMark")};
static const QString CONFIG_SERVER_CONFIG {QStringLiteral("ServerConfiguration")};
static const QString CONFIG_SEMANTIC_HIGHLIGHTING {QStringLiteral("SemanticHighlighting")};
K_PLUGIN_FACTORY_WITH_JSON(LSPClientPluginFactory, "lspclientplugin.json", registerPlugin<LSPClientPlugin>();)
......@@ -108,6 +109,7 @@ void LSPClientPlugin::readConfig()
m_diagnosticsHighlight = config.readEntry(CONFIG_DIAGNOSTICS_HIGHLIGHT, true);
m_diagnosticsMark = config.readEntry(CONFIG_DIAGNOSTICS_MARK, true);
m_configPath = config.readEntry(CONFIG_SERVER_CONFIG, QUrl());
m_semanticHighlighting = config.readEntry(CONFIG_SEMANTIC_HIGHLIGHTING, false);
emit update();
}
......@@ -128,6 +130,7 @@ void LSPClientPlugin::writeConfig() const
config.writeEntry(CONFIG_DIAGNOSTICS_HIGHLIGHT, m_diagnosticsHighlight);
config.writeEntry(CONFIG_DIAGNOSTICS_MARK, m_diagnosticsMark);
config.writeEntry(CONFIG_SERVER_CONFIG, m_configPath);
config.writeEntry(CONFIG_SEMANTIC_HIGHLIGHTING, m_semanticHighlighting);
emit update();
}
......
......@@ -61,6 +61,7 @@ public:
bool m_onTypeFormatting;
bool m_incrementalSync;
QUrl m_configPath;
bool m_semanticHighlighting;
// debug mode?
bool m_debugMode = false;
......
......@@ -23,6 +23,7 @@
*/
#include "lspclientserver.h"
#include "lspclientplugin.h"
#include "lspclient_debug.h"
......@@ -974,7 +975,7 @@ private:
initialized();
}
void initialize()
void initialize(LSPClientPlugin *plugin)
{
QJsonObject codeAction {{QStringLiteral("codeActionLiteralSupport"), QJsonObject {{QStringLiteral("codeActionKind"), QJsonObject {{QStringLiteral("valueSet"), QJsonArray()}}}}}};
QJsonObject capabilities {{QStringLiteral("textDocument"),
......@@ -984,7 +985,7 @@ private:
},
{QStringLiteral("publishDiagnostics"), QJsonObject {{QStringLiteral("relatedInformation"), true}}},
{QStringLiteral("codeAction"), codeAction},
{QStringLiteral("semanticHighlightingCapabilities"), QJsonObject {{QStringLiteral("semanticHighlighting"), true}}}}}};
{QStringLiteral("semanticHighlightingCapabilities"), QJsonObject {{QStringLiteral("semanticHighlighting"), !plugin || plugin->m_semanticHighlighting}}}}}};
// NOTE a typical server does not use root all that much,
// other than for some corner case (in) requests
QJsonObject params {{QStringLiteral("processId"), QCoreApplication::applicationPid()},
......@@ -1003,7 +1004,7 @@ private:
}
public:
bool start()
bool start(LSPClientPlugin *plugin)
{
if (m_state != State::None)
return true;
......@@ -1026,7 +1027,7 @@ public:
} else {
setState(State::Started);
// perform initial handshake
initialize();
initialize(plugin);
}
return result;
}
......@@ -1257,9 +1258,9 @@ const LSPServerCapabilities &LSPClientServer::capabilities() const
return d->capabilities();
}
bool LSPClientServer::start()
bool LSPClientServer::start(LSPClientPlugin *plugin)
{
return d->start();
return d->start(plugin);
}
void LSPClientServer::stop(int to_t, int to_k)
......
......@@ -73,6 +73,8 @@ using CodeActionReplyHandler = ReplyHandler<QList<LSPCodeAction>>;
using WorkspaceEditReplyHandler = ReplyHandler<LSPWorkspaceEdit>;
using ApplyEditReplyHandler = ReplyHandler<LSPApplyWorkspaceEditResponse>;
class LSPClientPlugin;
class LSPClientServer : public QObject
{
Q_OBJECT
......@@ -101,7 +103,7 @@ public:
// server management
// request start
bool start();
bool start(LSPClientPlugin *plugin);
// request shutdown/stop
// if to_xxx >= 0 -> send signal if not exit'ed after timeout
void stop(int to_term_ms, int to_kill_ms);
......
......@@ -591,7 +591,7 @@ private:
server.reset(new LSPClientServer(cmdline, root, serverConfig.value(QStringLiteral("initializationOptions"))));
m_servers[root][langId] = server;
connect(server.data(), &LSPClientServer::stateChanged, this, &self_type::onStateChanged, Qt::UniqueConnection);
if (!server->start()) {
if (!server->start(m_plugin)) {
showMessage(i18n("Failed to start server: %1", cmdline.join(QLatin1Char(' '))), KTextEditor::Message::Error);
}
}
......
......@@ -46,7 +46,7 @@ int main(int argc, char **argv)
q.quit();
};
auto conn = QObject::connect(&lsp, &LSPClientServer::stateChanged, state_h);
lsp.start();
lsp.start(nullptr /* no plugin for extra config */);
q.exec();
QObject::disconnect(conn);
......
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