Commit 876cb4ce authored by Mark Nauwelaerts's avatar Mark Nauwelaerts

lspclient: sprinkle some clang-format

parent 231d52d6
......@@ -36,17 +36,15 @@
#include <algorithm>
#define RETURN_CACHED_ICON(name) \
{ \
static QIcon icon(QIcon::fromTheme(QStringLiteral(name))); \
return icon; \
}
#define RETURN_CACHED_ICON(name) \
{ \
static QIcon icon(QIcon::fromTheme(QStringLiteral(name))); \
return icon; \
}
static QIcon
kind_icon(LSPCompletionItemKind kind)
static QIcon kind_icon(LSPCompletionItemKind kind)
{
switch (kind)
{
switch (kind) {
case LSPCompletionItemKind::Method:
case LSPCompletionItemKind::Function:
case LSPCompletionItemKind::Constructor:
......@@ -78,8 +76,7 @@ kind_property(LSPCompletionItemKind kind)
using CompletionProperty = KTextEditor::CodeCompletionModel::CompletionProperty;
auto p = CompletionProperty::NoProperty;
switch (kind)
{
switch (kind) {
case LSPCompletionItemKind::Method:
case LSPCompletionItemKind::Function:
case LSPCompletionItemKind::Constructor:
......@@ -96,7 +93,7 @@ kind_property(LSPCompletionItemKind kind)
p = CompletionProperty::Class;
break;
case LSPCompletionItemKind::Module:
p =CompletionProperty::Namespace;
p = CompletionProperty::Namespace;
break;
case LSPCompletionItemKind::Enum:
case LSPCompletionItemKind::EnumMember:
......@@ -108,24 +105,22 @@ kind_property(LSPCompletionItemKind kind)
return p;
}
struct LSPClientCompletionItem : public LSPCompletionItem
{
struct LSPClientCompletionItem : public LSPCompletionItem {
int argumentHintDepth = 0;
QString prefix;
QString postfix;
LSPClientCompletionItem(const LSPCompletionItem & item)
: LSPCompletionItem(item)
LSPClientCompletionItem(const LSPCompletionItem &item) : LSPCompletionItem(item)
{
// transform for later display
// sigh, remove (leading) whitespace (looking at clangd here)
// could skip the [] if empty detail, but it is a handy watermark anyway ;-)
label = QString(label.simplified() + QStringLiteral(" [") +
detail.simplified() + QStringLiteral("]"));
label = QString(label.simplified() + QStringLiteral(" [") + detail.simplified()
+ QStringLiteral("]"));
}
LSPClientCompletionItem(const LSPSignatureInformation & sig,
int activeParameter, const QString & _sortText)
LSPClientCompletionItem(const LSPSignatureInformation &sig, int activeParameter,
const QString &_sortText)
{
argumentHintDepth = 1;
documentation = sig.documentation;
......@@ -133,10 +128,9 @@ struct LSPClientCompletionItem : public LSPCompletionItem
sortText = _sortText;
// transform into prefix, name, suffix if active
if (activeParameter >= 0 && activeParameter < sig.parameters.length()) {
const auto& param = sig.parameters.at(activeParameter);
if (param.start >= 0 && param.start < label.length() &&
param.end >= 0 && param.end < label.length() &&
param.start < param.end) {
const auto &param = sig.parameters.at(activeParameter);
if (param.start >= 0 && param.start < label.length() && param.end >= 0
&& param.end < label.length() && param.start < param.end) {
prefix = label.mid(0, param.start);
postfix = label.mid(param.end);
label = label.mid(param.start, param.end - param.start);
......@@ -145,10 +139,10 @@ struct LSPClientCompletionItem : public LSPCompletionItem
}
};
static bool compare_match (const LSPCompletionItem & a, const LSPCompletionItem b)
{ return a.sortText < b.sortText; }
static bool compare_match(const LSPCompletionItem &a, const LSPCompletionItem b)
{
return a.sortText < b.sortText;
}
class LSPClientCompletionImpl : public LSPClientCompletion
{
......@@ -177,7 +171,7 @@ public:
{
m_server = server;
if (m_server) {
const auto& caps = m_server->capabilities();
const auto &caps = m_server->capabilities();
m_triggersCompletion = caps.completionProvider.triggerCharacters;
m_triggersSignature = caps.signatureHelpProvider.triggerCharacters;
} else {
......@@ -186,8 +180,7 @@ public:
}
}
virtual void setSelectedDocumentation(bool s) override
{ m_selectedDocumentation = s; }
virtual void setSelectedDocumentation(bool s) override { m_selectedDocumentation = s; }
QVariant data(const QModelIndex &index, int role) const override
{
......@@ -205,7 +198,8 @@ public:
} else if (index.column() == KTextEditor::CodeCompletionModel::Postfix) {
return match.postfix;
}
} else if (role == Qt::DecorationRole && index.column() == KTextEditor::CodeCompletionModel::Icon) {
} else if (role == Qt::DecorationRole
&& index.column() == KTextEditor::CodeCompletionModel::Icon) {
return kind_icon(match.kind);
} else if (role == KTextEditor::CodeCompletionModel::CompletionRole) {
return kind_property(match.kind);
......@@ -216,14 +210,14 @@ public:
return index.row();
} else if (role == KTextEditor::CodeCompletionModel::IsExpandable) {
return !match.documentation.value.isEmpty();
} else if (role == KTextEditor::CodeCompletionModel::ExpandingWidget &&
!match.documentation.value.isEmpty()) {
} else if (role == KTextEditor::CodeCompletionModel::ExpandingWidget
&& !match.documentation.value.isEmpty()) {
// probably plaintext, but let's show markdown as-is for now
// FIXME better presentation of markdown
return match.documentation.value;
} else if (role == KTextEditor::CodeCompletionModel::ItemSelected &&
!match.argumentHintDepth && !match.documentation.value.isEmpty() &&
m_selectedDocumentation) {
} else if (role == KTextEditor::CodeCompletionModel::ItemSelected
&& !match.argumentHintDepth && !match.documentation.value.isEmpty()
&& m_selectedDocumentation) {
return match.documentation.value;
}
......@@ -231,7 +225,7 @@ public:
}
bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText,
bool userInsertion, const KTextEditor::Cursor &position) override
bool userInsertion, const KTextEditor::Cursor &position) override
{
qCInfo(LSPCLIENT) << "should start " << userInsertion << insertedText;
......@@ -240,12 +234,12 @@ public:
}
// covers most already ...
bool complete = CodeCompletionModelControllerInterface::shouldStartCompletion(view,
insertedText, userInsertion, position);
bool complete = CodeCompletionModelControllerInterface::shouldStartCompletion(
view, insertedText, userInsertion, position);
QChar lastChar = insertedText.at(insertedText.count() - 1);
m_triggerSignature = false;
complete = complete || m_triggersCompletion.contains(lastChar);
complete = complete || m_triggersCompletion.contains(lastChar);
if (m_triggersSignature.contains(lastChar)) {
complete = true;
m_triggerSignature = true;
......@@ -254,7 +248,8 @@ public:
return complete;
}
void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType it) override
void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range,
InvocationType it) override
{
Q_UNUSED(it)
......@@ -262,21 +257,21 @@ public:
// maybe use WaitForReset ??
// but more complex and already looks good anyway
auto handler = [this] (const QList<LSPCompletionItem> & compl) {
auto handler = [this](const QList<LSPCompletionItem> & compl) {
beginResetModel();
qCInfo(LSPCLIENT) << "adding completions " << compl.size();
for (const auto & item : compl)
for (const auto &item : compl)
m_matches.push_back(item);
std::stable_sort(m_matches.begin(), m_matches.end(), compare_match);
setRowCount(m_matches.size());
endResetModel();
};
auto sigHandler = [this] (const LSPSignatureHelp & sig) {
auto sigHandler = [this](const LSPSignatureHelp &sig) {
beginResetModel();
qCInfo(LSPCLIENT) << "adding signatures " << sig.signatures.size();
int index = 0;
for (const auto & item : sig.signatures) {
for (const auto &item : sig.signatures) {
int sortIndex = 10 + index;
int active = -1;
if (index == sig.activeSignature) {
......@@ -284,7 +279,8 @@ public:
active = sig.activeParameter;
}
// trick active first, others after that
m_matches.push_back({item, active, QString(QStringLiteral("%1").arg(sortIndex, 3, 10))});
m_matches.push_back(
{ item, active, QString(QStringLiteral("%1").arg(sortIndex, 3, 10)) });
++index;
}
std::stable_sort(m_matches.begin(), m_matches.end(), compare_match);
......@@ -303,17 +299,18 @@ public:
auto cursor = qMax(range.start(), qMin(range.end(), position));
m_manager->update(document, false);
if (!m_triggerSignature) {
m_handle = m_server->documentCompletion(document->url(),
{cursor.line(), cursor.column()}, this, handler);
m_handle = m_server->documentCompletion(
document->url(), { cursor.line(), cursor.column() }, this, handler);
}
m_handleSig = m_server->signatureHelp(document->url(),
{cursor.line(), cursor.column()}, this, sigHandler);
m_handleSig = m_server->signatureHelp(
document->url(), { cursor.line(), cursor.column() }, this, sigHandler);
}
setRowCount(m_matches.size());
endResetModel();
}
void executeCompletionItem(KTextEditor::View *view, const KTextEditor::Range &word, const QModelIndex &index) const override
void executeCompletionItem(KTextEditor::View *view, const KTextEditor::Range &word,
const QModelIndex &index) const override
{
if (index.row() < m_matches.size())
view->document()->replaceText(word, m_matches.at(index.row()).insertText);
......@@ -331,8 +328,7 @@ public:
}
};
LSPClientCompletion*
LSPClientCompletion::new_(QSharedPointer<LSPClientServerManager> manager)
LSPClientCompletion *LSPClientCompletion::new_(QSharedPointer<LSPClientServerManager> manager)
{
return new LSPClientCompletionImpl(manager);
}
......
......@@ -31,20 +31,18 @@
#include <KTextEditor/CodeCompletionModel>
#include <KTextEditor/CodeCompletionModelControllerInterface>
class LSPClientCompletion : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface
class LSPClientCompletion : public KTextEditor::CodeCompletionModel,
public KTextEditor::CodeCompletionModelControllerInterface
{
Q_OBJECT
Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
public:
// implementation factory method
static LSPClientCompletion* new_(QSharedPointer<LSPClientServerManager> manager);
static LSPClientCompletion *new_(QSharedPointer<LSPClientServerManager> manager);
LSPClientCompletion(QObject * parent)
: KTextEditor::CodeCompletionModel(parent)
{}
LSPClientCompletion(QObject *parent) : KTextEditor::CodeCompletionModel(parent) {}
virtual void setServer(QSharedPointer<LSPClientServer> server) = 0;
virtual void setSelectedDocumentation(bool) = 0;
......
......@@ -82,16 +82,15 @@ 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})
for (const auto &cb : { m_symbolDetails, m_symbolExpand, m_symbolSort, m_symbolTree, m_complDoc,
m_refDeclaration, m_diagnostics, m_diagnosticsMark, m_onTypeFormatting,
m_incrementalSync })
connect(cb, &QCheckBox::toggled, this, &LSPClientConfigPage::changed);
connect(m_configPath, &KUrlRequester::textChanged, this, &LSPClientConfigPage::changed);
connect(m_configPath, &KUrlRequester::urlSelected, this, &LSPClientConfigPage::changed);
// custom control logic
auto h = [this] ()
{
auto h = [this]() {
bool enabled = m_diagnostics->isChecked();
m_diagnosticsHighlight->setEnabled(enabled);
m_diagnosticsMark->setEnabled(enabled);
......
......@@ -38,34 +38,34 @@ class LSPClientConfigPage : public KTextEditor::ConfigPage
{
Q_OBJECT
public:
explicit LSPClientConfigPage(QWidget *parent = nullptr, LSPClientPlugin *plugin = nullptr);
~LSPClientConfigPage() override {};
QString name() const override;
QString fullName() const override;
QIcon icon() const override;
public Q_SLOTS:
void apply() override;
void defaults() override;
void reset() override;
private:
QCheckBox* m_symbolDetails;
QCheckBox* m_symbolExpand;
QCheckBox* m_symbolTree;
QCheckBox* m_symbolSort;
QCheckBox* m_complDoc;
QCheckBox* m_refDeclaration;
QCheckBox* m_diagnostics;
QCheckBox* m_diagnosticsHighlight;
QCheckBox* m_diagnosticsMark;
QCheckBox* m_onTypeFormatting;
QCheckBox* m_incrementalSync;
KUrlRequester *m_configPath;
LSPClientPlugin *m_plugin;
public:
explicit LSPClientConfigPage(QWidget *parent = nullptr, LSPClientPlugin *plugin = nullptr);
~LSPClientConfigPage() override {};
QString name() const override;
QString fullName() const override;
QIcon icon() const override;
public Q_SLOTS:
void apply() override;
void defaults() override;
void reset() override;
private:
QCheckBox *m_symbolDetails;
QCheckBox *m_symbolExpand;
QCheckBox *m_symbolTree;
QCheckBox *m_symbolSort;
QCheckBox *m_complDoc;
QCheckBox *m_refDeclaration;
QCheckBox *m_diagnostics;
QCheckBox *m_diagnosticsHighlight;
QCheckBox *m_diagnosticsMark;
QCheckBox *m_onTypeFormatting;
QCheckBox *m_incrementalSync;
KUrlRequester *m_configPath;
LSPClientPlugin *m_plugin;
};
#endif
......@@ -49,8 +49,8 @@ static const QString CONFIG_DIAGNOSTICS_HIGHLIGHT { QStringLiteral("DiagnosticsH
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>();)
K_PLUGIN_FACTORY_WITH_JSON(LSPClientPluginFactory, "lspclientplugin.json",
registerPlugin<LSPClientPlugin>();)
LSPClientPlugin::LSPClientPlugin(QObject *parent, const QList<QVariant> &)
: KTextEditor::Plugin(parent)
......@@ -61,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)
{
......
......@@ -35,39 +35,40 @@ class LSPClientPlugin : public KTextEditor::Plugin
{
Q_OBJECT
public:
explicit LSPClientPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
~LSPClientPlugin() override;
QObject *createView(KTextEditor::MainWindow *mainWindow) override;
int configPages() const override;
KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override;
void readConfig();
void writeConfig() const;
// settings
bool m_symbolDetails;
bool m_symbolExpand;
bool m_symbolTree;
bool m_symbolSort;
bool m_complDoc;
bool m_refDeclaration;
bool m_diagnostics;
bool m_diagnosticsHighlight;
bool m_diagnosticsMark;
bool m_onTypeFormatting;
bool m_incrementalSync;
QUrl m_configPath;
// debug mode?
bool m_debugMode = false;
public:
explicit LSPClientPlugin(QObject *parent = nullptr,
const QList<QVariant> & = QList<QVariant>());
~LSPClientPlugin() override;
QObject *createView(KTextEditor::MainWindow *mainWindow) override;
int configPages() const override;
KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override;
void readConfig();
void writeConfig() const;
// settings
bool m_symbolDetails;
bool m_symbolExpand;
bool m_symbolTree;
bool m_symbolSort;
bool m_complDoc;
bool m_refDeclaration;
bool m_diagnostics;
bool m_diagnosticsHighlight;
bool m_diagnosticsMark;
bool m_onTypeFormatting;
bool m_incrementalSync;
QUrl m_configPath;
// debug mode?
bool m_debugMode = false;
private:
Q_SIGNALS:
// signal settings update
void update() const;
Q_SIGNALS:
// signal settings update
void update() const;
};
#endif
......@@ -65,8 +65,7 @@
#include <QFileInfo>
#include <QJsonObject>
namespace RangeData
{
namespace RangeData {
enum {
// preserve UserRole for generic use where needed
......@@ -79,54 +78,50 @@ class KindEnum
{
public:
enum _kind {
Text = (int) LSPDocumentHighlightKind::Text,
Read = (int) LSPDocumentHighlightKind::Read,
Write = (int) LSPDocumentHighlightKind::Write,
Error = 10 + (int) LSPDiagnosticSeverity::Error,
Warning = 10 + (int) LSPDiagnosticSeverity::Warning,
Information = 10 + (int) LSPDiagnosticSeverity::Information,
Hint = 10 + (int) LSPDiagnosticSeverity::Hint,
Text = (int)LSPDocumentHighlightKind::Text,
Read = (int)LSPDocumentHighlightKind::Read,
Write = (int)LSPDocumentHighlightKind::Write,
Error = 10 + (int)LSPDiagnosticSeverity::Error,
Warning = 10 + (int)LSPDiagnosticSeverity::Warning,
Information = 10 + (int)LSPDiagnosticSeverity::Information,
Hint = 10 + (int)LSPDiagnosticSeverity::Hint,
Related
};
KindEnum(int v)
{ m_value = (_kind) v; }
KindEnum(int v) { m_value = (_kind)v; }
KindEnum(LSPDocumentHighlightKind hl)
: KindEnum((_kind) (hl))
{}
KindEnum(LSPDocumentHighlightKind hl) : KindEnum((_kind)(hl)) {}
KindEnum(LSPDiagnosticSeverity sev)
: KindEnum(_kind(10 + (int) sev))
{}
KindEnum(LSPDiagnosticSeverity sev) : KindEnum(_kind(10 + (int)sev)) {}
operator _kind()
{ return m_value; }
operator _kind() { return m_value; }
private:
_kind m_value;
};
static constexpr KTextEditor::MarkInterface::MarkTypes markType = KTextEditor::MarkInterface::markType31;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagError = KTextEditor::MarkInterface::Error;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagWarning = KTextEditor::MarkInterface::Warning;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagOther = KTextEditor::MarkInterface::markType30;
static constexpr KTextEditor::MarkInterface::MarkTypes markType =
KTextEditor::MarkInterface::markType31;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagError =
KTextEditor::MarkInterface::Error;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagWarning =
KTextEditor::MarkInterface::Warning;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagOther =
KTextEditor::MarkInterface::markType30;
static constexpr KTextEditor::MarkInterface::MarkTypes markTypeDiagAll =
KTextEditor::MarkInterface::MarkTypes (markTypeDiagError | markTypeDiagWarning | markTypeDiagOther);
KTextEditor::MarkInterface::MarkTypes(markTypeDiagError | markTypeDiagWarning
| markTypeDiagOther);
}
static QIcon
diagnosticsIcon(LSPDiagnosticSeverity severity)
static QIcon diagnosticsIcon(LSPDiagnosticSeverity severity)
{
#define RETURN_CACHED_ICON(name) \
{ \
static QIcon icon(QIcon::fromTheme(QStringLiteral(name))); \
return icon; \
}
switch (severity)
{
#define RETURN_CACHED_ICON(name) \
{ \
static QIcon icon(QIcon::fromTheme(QStringLiteral(name))); \
return icon; \
}
switch (severity) {
case LSPDiagnosticSeverity::Error:
RETURN_CACHED_ICON("dialog-error")
case LSPDiagnosticSeverity::Warning:
......@@ -140,18 +135,16 @@ return icon; \
return QIcon();
}
static QIcon
codeActionIcon()
static QIcon codeActionIcon()
{
static QIcon icon(QIcon::fromTheme(QStringLiteral("insert-text")));
return icon;
}
KTextEditor::Document*
findDocument(KTextEditor::MainWindow *mainWindow, const QUrl & url)
KTextEditor::Document *findDocument(KTextEditor::MainWindow *mainWindow, const QUrl &url)
{
auto views = mainWindow->views();
for (const auto v: views) {
for (const auto v : views) {
auto doc = v->document();
if (doc && doc->url() == url)
return doc;
......@@ -168,11 +161,7 @@ class FileLineReader
QString lastLine;
public:
FileLineReader(const QUrl & url)
: file(url.path())
{
file.open(QIODevice::ReadOnly);
}
FileLineReader(const QUrl &url) : file(url.path()) { file.open(QIODevice::ReadOnly); }
// called with non-descending lineno
QString line(int lineno)
......@@ -189,7 +178,7 @@ public:
if (state.invalidChars > 0) {
text = QString::fromLatin1(line);
}
while (text.size() && text.at(text.size() -1).isSpace())
while (text.size() && text.at(text.size() - 1).isSpace())
text.chop(1);
lastLine = text;
return text;
......@@ -199,7 +188,6 @@ public:
}
};
class LSPClientActionView : public QObject
{
Q_OBJECT
......@@ -238,10 +226,10 @@ class LSPClientActionView : public QObject
QScopedPointer<QWidget> m_toolView;
QPointer<QTabWidget> m_tabWidget;
// applied search ranges
typedef QMultiHash<KTextEditor::Document*, KTextEditor::MovingRange*> RangeCollection;
typedef QMultiHash<KTextEditor::Document *, KTextEditor::MovingRange *> RangeCollection;
RangeCollection m_ranges;
// applied marks
typedef QSet<KTextEditor::Document*> DocumentCollection;
typedef QSet<KTextEditor::Document *> DocumentCollection;
DocumentCollection m_marks;
// modelis either owned by tree added to tabwidget or owned here
QScopedPointer<QStandardItemModel> m_ownedModel;
......@@ -280,72 +268,101 @@ class LSPClientActionView : public QObject
// characters to trigger format request
QVector<QChar> m_onTypeFormattingTriggers;
KActionCollection *actionCollection() const
{ return m_client->actionCollection(); }
KActionCollection *actionCollection() const { return m_client->actionCollection(); }
public:
LSPClientActionView(LSPClientPlugin *plugin, KTextEditor::MainWindow *mainWin,
KXMLGUIClient *client, QSharedPointer<LSPClientServerManager> serverManager)
: QObject(mainWin), m_plugin(plugin), m_mainWindow(mainWin), m_client(client),
: QObject(mainWin),
m_plugin(plugin),
m_mainWindow(mainWin),
m_client(client),
m_serverManager(serverManager),
m_completion(LSPClientCompletion::new_(m_serverManager)),
m_hover(LSPClientHover::new_(m_serverManager)),
m_symbolView(LSPClientSymbolView::new_(plugin, mainWin, m_serverManager))
{
connect(m_mainWindow, &KTextEditor::MainWindow::viewChanged, this, &self_type::updateState);
connect(m_mainWindow, &KTextEditor::MainWindow::unhandledShortcutOverride, this, &self_type::handleEsc);
connect(m_serverManager.data(), &LSPClientServerManager::serverChanged, this, &self_type::updateState);
connect(m_mainWindow, &KTextEditor::MainWindow::unhandledShortcutOverride, this,
&self_type::handleEsc);
connect(m_serverManager.data(), &LSPClientServerManager::serverChanged, this,
&self_type::updateState);
m_findDef = actionCollection()->addAction(QStringLiteral("lspclient_find_definition"), this, &self_type::goToDefinition);
m_findDef = actionCollection()->addAction(QStringLiteral("lspclient_find_definition"), this,
&self_type::goToDefinition);
m_findDef->setText(i18n("Go to Definition"));
m_findDecl = actionCollection()->addAction(QStringLiteral("lspclient_find_declaration"), this, &self_type::goToDeclaration);
m_findDecl = actionCollection()->addAction(QStringLiteral("lspclient_find_declaration"),
this, &self_type::goToDeclaration);
m_findDecl->setText(i18n("Go to Declaration"));
m_findRef = actionCollection()->addAction(QStringLiteral("lspclient_find_references"), this, &self_type::findReferences);
m_findRef = actionCollection()->addAction(QStringLiteral("lspclient_find_references"), this,
&self_type::findReferences);
m_findRef->setText(i18n("Find References"));
m_triggerHighlight = actionCollection()->addAction(QStringLiteral("lspclient_highlight"), this, &self_type::highlight);
m_triggerHighlight = actionCollection()->addAction(QStringLiteral("lspclient_highlight"),
this, &self_type::highlight);
m_triggerHighlight->setText(i18n("Highlight"));
// perhaps hover suggests to do so on mouse-over,
// but let's just use a (convenient) action/shortcut for it
m_triggerHover = actionCollection()->addAction(QStringLiteral("lspclient_hover"), this, &self_type::hover);
m_triggerHover = actionCollection()->addAction(QStringLiteral("lspclient_hover"), this,
&self_type::hover);
m_triggerHover->setText(i18n("Hover"));
m_triggerFormat = actionCollection()->addAction(QStringLiteral("lspclient_format"), this, &self_type::format);
m_triggerFormat = actionCollection()->addAction(QStringLiteral("lspclient_format"), this,
&self_type::format);
m_triggerFormat->setText(i18n("Format"));
m_triggerRename = actionCollection()->addAction(QStringLiteral("lspclient_rename"), this, &self_type::rename);
m_triggerRename = actionCollection()->addAction(QStringLiteral("lspclient_rename"), this,
&self_type::rename);
m_triggerRename->setText(i18n("Rename"));
// general options
m_complDocOn = actionCollection()->addAction(QStringLiteral("lspclient_completion_doc"), this, &self_type::displayOptionChanged);
m_complDocOn = actionCollection()->addAction(QStringLiteral("lspclient_completion_doc"),
this, &self_type::displayOptionChanged);
m_complDocOn->setText(i18n("Show selected completion documentation"));
m_complDocOn->setCheckable(true);
m_refDeclaration = actionCollection()->addAction(QStringLiteral("lspclient_references_declaration"), this, &self_type::displayOptionChanged);
m_refDeclaration =
actionCollection()->addAction(QStringLiteral("lspclient_references_declaration"),
this, &self_type::displayOptionChanged);
m_refDeclaration->setText(i18n("Include declaration in references"));
m_refDeclaration->setCheckable(true);
m_onTypeFormatting = actionCollection()->addAction(QStringLiteral("lspclient_type_formatting"), this, &self_type::displayOptionChanged);