Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit bc7d56fa authored by Mark Nauwelaerts's avatar Mark Nauwelaerts

lspclient: apply clang-format

parent 6aa27373
This diff is collapsed.
......@@ -34,7 +34,8 @@
#include <KUrlRequester>
LSPClientConfigPage::LSPClientConfigPage(QWidget *parent, LSPClientPlugin *plugin)
: KTextEditor::ConfigPage(parent), m_plugin(plugin)
: KTextEditor::ConfigPage(parent)
, m_plugin(plugin)
{
QVBoxLayout *layout = new QVBoxLayout(this);
......@@ -84,9 +85,7 @@ LSPClientConfigPage::LSPClientConfigPage(QWidget *parent, LSPClientPlugin *plugi
reset();
for (const auto &cb : { m_symbolDetails, m_symbolExpand, m_symbolSort, m_symbolTree, m_complDoc,
m_refDeclaration, m_diagnostics, m_diagnosticsMark, m_onTypeFormatting,
m_incrementalSync, m_autoHover })
for (const auto &cb : {m_symbolDetails, m_symbolExpand, m_symbolSort, m_symbolTree, m_complDoc, m_refDeclaration, m_diagnostics, m_diagnosticsMark, m_onTypeFormatting, m_incrementalSync, m_autoHover})
connect(cb, &QCheckBox::toggled, this, &LSPClientConfigPage::changed);
connect(m_configPath, &KUrlRequester::textChanged, this, &LSPClientConfigPage::changed);
connect(m_configPath, &KUrlRequester::urlSelected, this, &LSPClientConfigPage::changed);
......
......@@ -48,7 +48,9 @@ class LSPClientHoverImpl : public LSPClientHover
public:
LSPClientHoverImpl(QSharedPointer<LSPClientServerManager> manager)
: LSPClientHover(), m_manager(std::move(manager)), m_server(nullptr)
: LSPClientHover()
, m_manager(std::move(manager))
, m_server(nullptr)
{
}
......@@ -70,14 +72,12 @@ public:
* \param position text cursor under the mouse position
* \return text tool tip to be displayed, may be Qt richtext
*/
QString textHint(KTextEditor::View *view,
const KTextEditor::Cursor &position) override
QString textHint(KTextEditor::View *view, const KTextEditor::Cursor &position) override
{
// hack: delayed handling of tooltip on our own, the API is too dumb for a-sync feedback ;=)
if (m_server) {
QPointer<KTextEditor::View> v(view);
auto h = [this,v,position] (const LSPHover & info)
{
auto h = [this, v, position](const LSPHover &info) {
if (!v || info.contents.isEmpty()) {
return;
}
......@@ -107,11 +107,9 @@ public:
return QString();
}
};
LSPClientHover*
LSPClientHover::new_(QSharedPointer<LSPClientServerManager> manager)
LSPClientHover *LSPClientHover::new_(QSharedPointer<LSPClientServerManager> manager)
{
return new LSPClientHoverImpl(std::move(manager));
}
......
......@@ -35,23 +35,22 @@
#include <QDir>
static const QString CONFIG_LSPCLIENT { QStringLiteral("lspclient") };
static const QString CONFIG_SYMBOL_DETAILS { QStringLiteral("SymbolDetails") };
static const QString CONFIG_SYMBOL_TREE { QStringLiteral("SymbolTree") };
static const QString CONFIG_SYMBOL_EXPAND { QStringLiteral("SymbolExpand") };
static const QString CONFIG_SYMBOL_SORT { QStringLiteral("SymbolSort") };
static const QString CONFIG_COMPLETION_DOC { QStringLiteral("CompletionDocumentation") };
static const QString CONFIG_REFERENCES_DECLARATION { QStringLiteral("ReferencesDeclaration") };
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_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") };
K_PLUGIN_FACTORY_WITH_JSON(LSPClientPluginFactory, "lspclientplugin.json",
registerPlugin<LSPClientPlugin>();)
static const QString CONFIG_LSPCLIENT {QStringLiteral("lspclient")};
static const QString CONFIG_SYMBOL_DETAILS {QStringLiteral("SymbolDetails")};
static const QString CONFIG_SYMBOL_TREE {QStringLiteral("SymbolTree")};
static const QString CONFIG_SYMBOL_EXPAND {QStringLiteral("SymbolExpand")};
static const QString CONFIG_SYMBOL_SORT {QStringLiteral("SymbolSort")};
static const QString CONFIG_COMPLETION_DOC {QStringLiteral("CompletionDocumentation")};
static const QString CONFIG_REFERENCES_DECLARATION {QStringLiteral("ReferencesDeclaration")};
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_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")};
K_PLUGIN_FACTORY_WITH_JSON(LSPClientPluginFactory, "lspclientplugin.json", registerPlugin<LSPClientPlugin>();)
LSPClientPlugin::LSPClientPlugin(QObject *parent, const QList<QVariant> &)
: KTextEditor::Plugin(parent)
......@@ -62,17 +61,17 @@ LSPClientPlugin::LSPClientPlugin(QObject *parent, const QList<QVariant> &)
*/
m_debugMode = (qgetenv("LSPCLIENT_DEBUG") == QByteArray("1"));
if (!m_debugMode) {
QLoggingCategory::setFilterRules(
QStringLiteral("katelspclientplugin.debug=false\nkatelspclientplugin.info=false"));
QLoggingCategory::setFilterRules(QStringLiteral("katelspclientplugin.debug=false\nkatelspclientplugin.info=false"));
} else {
QLoggingCategory::setFilterRules(
QStringLiteral("katelspclientplugin.debug=true\nkatelspclientplugin.info=true"));
QLoggingCategory::setFilterRules(QStringLiteral("katelspclientplugin.debug=true\nkatelspclientplugin.info=true"));
}
readConfig();
}
LSPClientPlugin::~LSPClientPlugin() {}
LSPClientPlugin::~LSPClientPlugin()
{
}
QObject *LSPClientPlugin::createView(KTextEditor::MainWindow *mainWindow)
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -31,18 +31,17 @@
#include <QTextStream>
#include <QJsonObject>
int main(int argc, char ** argv)
int main(int argc, char **argv)
{
if (argc < 5)
return -1;
LSPClientServer lsp(QString::fromLatin1(argv[1]).split(QLatin1Char(' ')),
QUrl(QString::fromLatin1(argv[2])));
LSPClientServer lsp(QString::fromLatin1(argv[1]).split(QLatin1Char(' ')), QUrl(QString::fromLatin1(argv[2])));
QCoreApplication app(argc, argv);
QEventLoop q;
auto state_h = [&lsp, &q] () {
auto state_h = [&lsp, &q]() {
if (lsp.state() == LSPClientServer::State::Running)
q.quit();
};
......@@ -51,9 +50,7 @@ int main(int argc, char ** argv)
q.exec();
QObject::disconnect(conn);
auto diagnostics_h = [] (const LSPPublishDiagnosticsParams & diag) {
std::cout << "diagnostics " << diag.uri.path().toUtf8().toStdString() << " count: " << diag.diagnostics.length();
};
auto diagnostics_h = [](const LSPPublishDiagnosticsParams &diag) { std::cout << "diagnostics " << diag.uri.path().toUtf8().toStdString() << " count: " << diag.diagnostics.length(); };
QObject::connect(&lsp, &LSPClientServer::publishDiagnostics, diagnostics_h);
......@@ -66,7 +63,7 @@ int main(int argc, char ** argv)
QString content = in.readAll();
lsp.didOpen(document, 0, QString(), content);
auto ds_h = [&q] (const QList<LSPSymbolInformation> & syms) {
auto ds_h = [&q](const QList<LSPSymbolInformation> &syms) {
std::cout << "symbol count: " << syms.length() << std::endl;
q.quit();
};
......@@ -74,28 +71,28 @@ int main(int argc, char ** argv)
q.exec();
auto position = QString::fromLatin1(argv[4]).split(QLatin1Char(' '));
auto def_h = [&q] (const QList<LSPLocation> & defs) {
auto def_h = [&q](const QList<LSPLocation> &defs) {
std::cout << "definition count: " << defs.length() << std::endl;
q.quit();
};
lsp.documentDefinition(document, {position[0].toInt(), position[1].toInt()}, &app, def_h);
q.exec();
auto comp_h = [&q] (const QList<LSPCompletionItem> & completions) {
auto comp_h = [&q](const QList<LSPCompletionItem> &completions) {
std::cout << "completion count: " << completions.length() << std::endl;
q.quit();
};
lsp.documentCompletion(document, {position[0].toInt(), position[1].toInt()}, &app, comp_h);
q.exec();
auto sig_h = [&q] (const LSPSignatureHelp & help) {
auto sig_h = [&q](const LSPSignatureHelp &help) {
std::cout << "signature help count: " << help.signatures.length() << std::endl;
q.quit();
};
lsp.signatureHelp(document, {position[0].toInt(), position[1].toInt()}, &app, sig_h);
q.exec();
auto hover_h = [&q] (const LSPHover & hover) {
auto hover_h = [&q](const LSPHover &hover) {
for (auto &element : hover.contents) {
std::cout << "hover: " << element.value.toStdString() << std::endl;
}
......@@ -104,21 +101,21 @@ int main(int argc, char ** argv)
lsp.documentHover(document, {position[0].toInt(), position[1].toInt()}, &app, hover_h);
q.exec();
auto ref_h = [&q] (const QList<LSPLocation> & refs) {
auto ref_h = [&q](const QList<LSPLocation> &refs) {
std::cout << "refs: " << refs.length() << std::endl;
q.quit();
};
lsp.documentReferences(document, {position[0].toInt(), position[1].toInt()}, true, &app, ref_h);
q.exec();
auto hl_h = [&q] (const QList<LSPDocumentHighlight> & hls) {
auto hl_h = [&q](const QList<LSPDocumentHighlight> &hls) {
std::cout << "highlights: " << hls.length() << std::endl;
q.quit();
};
lsp.documentHighlight(document, {position[0].toInt(), position[1].toInt()}, &app, hl_h);
q.exec();
auto fmt_h = [&q] (const QList<LSPTextEdit> & edits) {
auto fmt_h = [&q](const QList<LSPTextEdit> &edits) {
std::cout << "edits: " << edits.length() << std::endl;
q.quit();
};
......
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