diff --git a/addons/lspclient/lspclientplugin.h b/addons/lspclient/lspclientplugin.h --- a/addons/lspclient/lspclientplugin.h +++ b/addons/lspclient/lspclientplugin.h @@ -59,6 +59,9 @@ bool m_diagnosticsMark; QUrl m_configPath; + // debug mode? + bool m_debugMode = false; + private: Q_SIGNALS: // signal settings update diff --git a/addons/lspclient/lspclientplugin.cpp b/addons/lspclient/lspclientplugin.cpp --- a/addons/lspclient/lspclientplugin.cpp +++ b/addons/lspclient/lspclientplugin.cpp @@ -26,6 +26,8 @@ #include "lspclientpluginview.h" #include "lspclientconfigpage.h" +#include "lspclient_debug.h" + #include #include #include @@ -51,6 +53,15 @@ LSPClientPlugin::LSPClientPlugin(QObject *parent, const QList &) : KTextEditor::Plugin(parent) { + /** + * handle plugin verbosity + * the m_debugMode will be used to e.g. set debug level for started clangd, too + */ + m_debugMode = (qgetenv("LSPCLIENT_DEBUG") == QByteArray("1")); + if (!m_debugMode) { + QLoggingCategory::setFilterRules(QStringLiteral("katelspclientplugin.debug=false\nkatelspclientplugin.info=false")); + } + readConfig(); } diff --git a/addons/lspclient/lspclientservermanager.cpp b/addons/lspclient/lspclientservermanager.cpp --- a/addons/lspclient/lspclientservermanager.cpp +++ b/addons/lspclient/lspclientservermanager.cpp @@ -547,7 +547,7 @@ { QStringLiteral("Python"), makeServerConfig(QStringLiteral("python3 -m pyls --check-parent-process")) }, { QStringLiteral("C"), - makeServerConfig(QStringLiteral("clangd -log=verbose --background-index")) }, + makeServerConfig(QStringLiteral("clangd -log=%1 --background-index").arg(m_plugin->m_debugMode ? QStringLiteral("verbose") : QStringLiteral("error"))) }, { QStringLiteral("C++"), QJsonObject { { QStringLiteral("use"), QStringLiteral("C") } } } }