[kate/remove-deprecated-plugins] /: Remove D and Rust completion plugins in favor of LSP Client plugin
Dominik Haumann
null at kde.org
Thu Sep 12 13:50:32 BST 2019
Git commit 0080f2093e423aca5ed9bda70cb954e31c1f9c65 by Dominik Haumann.
Committed on 12/09/2019 at 12:50.
Pushed by dhaumann into branch 'remove-deprecated-plugins'.
Remove D and Rust completion plugins in favor of LSP Client plugin
The LSP Client plugin already now supports Rust, D, and many more
languages and likely will improve its feature set over time. Thus,
the LSP Client will be the better solution to code completion and
code navigation ayways.
M +0 -2 addons/CMakeLists.txt
D +0 -14 addons/lumen/CMakeLists.txt
D +0 -158 addons/lumen/completion.cpp
D +0 -47 addons/lumen/completion.h
D +0 -358 addons/lumen/dcd.cpp
D +0 -99 addons/lumen/dcd.h
D +0 -77 addons/lumen/ktexteditor_lumen.desktop
D +0 -184 addons/lumen/lumen.cpp
D +0 -86 addons/lumen/lumen.h
D +0 -16 addons/rustcompletion/CMakeLists.txt
D +0 -3 addons/rustcompletion/Messages.sh
D +0 -221 addons/rustcompletion/kterustcompletion.cpp
D +0 -78 addons/rustcompletion/kterustcompletion.h
D +0 -105 addons/rustcompletion/kterustcompletionconfigpage.cpp
D +0 -60 addons/rustcompletion/kterustcompletionconfigpage.h
D +0 -145 addons/rustcompletion/kterustcompletionplugin.cpp
D +0 -84 addons/rustcompletion/kterustcompletionplugin.desktop
D +0 -71 addons/rustcompletion/kterustcompletionplugin.h
D +0 -167 addons/rustcompletion/kterustcompletionpluginview.cpp
D +0 -62 addons/rustcompletion/kterustcompletionpluginview.h
D +0 -6 addons/rustcompletion/plugin.qrc
D +0 -18 addons/rustcompletion/ui.rc
D +- -- doc/kate/lumen-calltips.png
D +- -- doc/kate/lumen-completition-overload.png
D +- -- doc/kate/lumen-completition.png
D +- -- doc/kate/lumen-import.png
M +12 -81 doc/kate/plugins.docbook
D +- -- doc/kate/rust-completion.png
D +- -- doc/kate/rust-configuration.png
https://invent.kde.org/kde/kate/commit/0080f2093e423aca5ed9bda70cb954e31c1f9c65
diff --git a/addons/CMakeLists.txt b/addons/CMakeLists.txt
index c2f72cb72..68a6f1a2d 100644
--- a/addons/CMakeLists.txt
+++ b/addons/CMakeLists.txt
@@ -12,12 +12,10 @@ ecm_optional_add_subdirectory(katebuild-plugin)
ecm_optional_add_subdirectory(katesql)
ecm_optional_add_subdirectory(konsole)
ecm_optional_add_subdirectory(lspclient) # Language Server Protocol (LSP) client plugin.
-ecm_optional_add_subdirectory(lumen) # D completion
ecm_optional_add_subdirectory(openheader) # Open header matching to current file.
ecm_optional_add_subdirectory(preview) # Live preview of sources in target format.
ecm_optional_add_subdirectory(project) # Small & smart project manager.
ecm_optional_add_subdirectory(replicode)
-ecm_optional_add_subdirectory(rustcompletion)
ecm_optional_add_subdirectory(search)
ecm_optional_add_subdirectory(sessionapplet)
ecm_optional_add_subdirectory(snippets)
diff --git a/addons/lumen/CMakeLists.txt b/addons/lumen/CMakeLists.txt
deleted file mode 100644
index b6614c029..000000000
--- a/addons/lumen/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-add_library(ktexteditor_lumen MODULE "")
-target_compile_definitions(ktexteditor_lumen PRIVATE TRANSLATION_DOMAIN="ktexteditor_lumen")
-target_link_libraries(ktexteditor_lumen PRIVATE KF5::TextEditor)
-
-target_sources(
- ktexteditor_lumen
- PRIVATE
- lumen.cpp
- dcd.cpp
- completion.cpp
-)
-
-kcoreaddons_desktop_to_json(ktexteditor_lumen ktexteditor_lumen.desktop)
-install(TARGETS ktexteditor_lumen DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
diff --git a/addons/lumen/completion.cpp b/addons/lumen/completion.cpp
deleted file mode 100644
index 685dbd84b..000000000
--- a/addons/lumen/completion.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright 2014-2015 David Herberth kde at dav1d.de
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
-**/
-
-#include "completion.h"
-#include <QRegularExpression>
-#include <KTextEditor/View>
-#include <KTextEditor/Document>
-#include <KTextEditor/CodeCompletionInterface>
-#include <KTextEditor/CodeCompletionModelControllerInterface>
-#include <klocalizedstring.h>
-
-
-LumenCompletionModel::LumenCompletionModel(QObject* parent, DCD* dcd)
- : CodeCompletionModel(parent)
-{
- m_dcd = dcd;
-}
-
-LumenCompletionModel::~LumenCompletionModel()
-{
-
-}
-
-bool LumenCompletionModel::shouldStartCompletion(View* view, const QString& insertedText, bool userInsertion, const Cursor& position)
-{
- bool complete = KTextEditor::CodeCompletionModelControllerInterface::shouldStartCompletion(
- view, insertedText, userInsertion, position
- );
-
- complete = complete || insertedText.endsWith(QLatin1Char('(')); // calltip
- complete = complete || insertedText.endsWith(QLatin1String("import ")); // import
-
- return complete;
-}
-
-void LumenCompletionModel::completionInvoked(View* view, const Range& range, CodeCompletionModel::InvocationType invocationType)
-{
- Q_UNUSED(invocationType);
- KTextEditor::Document* document = view->document();
-
- KTextEditor::Cursor cursor = range.end();
- KTextEditor::Cursor cursorEnd = document->documentEnd();
- KTextEditor::Range range0c = KTextEditor::Range(0, 0, cursor.line(), cursor.column());
- KTextEditor::Range rangece = KTextEditor::Range(cursor.line(), cursor.column(),
- cursorEnd.line(), cursorEnd.column());
- QString text0c = document->text(range0c, false);
- QByteArray utf8 = text0c.toUtf8();
- int offset = utf8.length();
- utf8.append(document->text(rangece, false).toUtf8());
-
- m_data = m_dcd->complete(utf8, offset);
- setRowCount(m_data.completions.length());
-
- setHasGroups(false);
-}
-
-
-void LumenCompletionModel::executeCompletionItem(View* view, const Range& word, const QModelIndex& index) const
-{
- QModelIndex sibling = index.sibling(index.row(), Name);
- Document *document = view->document();
-
- document->replaceText(word, data(sibling).toString());
-
- int crole = data(sibling, CompletionRole).toInt();
- if (crole & Function) {
- KTextEditor::Cursor cursor = view->cursorPosition();
- document->insertText(cursor, QStringLiteral("()"));
- view->setCursorPosition(Cursor(cursor.line(), cursor.column()+1));
- }
-}
-
-QVariant LumenCompletionModel::data(const QModelIndex& index, int role) const
-{
- DCDCompletionItem item = m_data.completions[index.row()];
-
- switch (role)
- {
- case Qt::DecorationRole:
- {
- if(index.column() == Icon) {
- return item.icon();
- }
- break;
- }
- case Qt::DisplayRole:
- {
- if(item.type == DCDCompletionItemType::Calltip) {
- QRegularExpression funcRE(QStringLiteral("^\\s*(\\w+)\\s+(\\w+\\s*\\(.*\\))\\s*$"));
- QStringList matches = funcRE.match(item.name).capturedTexts();
-
- switch(index.column()) {
- case Prefix: return matches[1];
- case Name: return matches[2];
- }
- } else {
- if(index.column() == Name) {
- return item.name;
- }
- }
- break;
- }
- case CompletionRole:
- {
- int p = NoProperty;
- switch (item.type) {
- case DCDCompletionItemType::FunctionName: p |= Function; break;
- case DCDCompletionItemType::VariableName: p |= Variable; break;
- default: break;
- }
- return p;
- }
- case BestMatchesCount:
- {
- return 5;
- }
- case ArgumentHintDepth:
- {
- if(item.type == DCDCompletionItemType::Calltip) {
- return 1;
- }
- break;
- }
- case GroupRole:
- {
- break;
- }
- case IsExpandable:
- {
- // I like the green arrow
- return true;
- }
- case ExpandingWidget:
- {
- // TODO well implementation in DCD is missing
- return QVariant();
- }
- }
-
- return QVariant();
-}
diff --git a/addons/lumen/completion.h b/addons/lumen/completion.h
deleted file mode 100644
index 9ab1ca631..000000000
--- a/addons/lumen/completion.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014-2015 David Herberth kde at dav1d.de
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef LUMEN_COMPLETION_H
-#define LUMEN_COMPLETION_H
-#include <KTextEditor/CodeCompletionModel>
-#include <KTextEditor/CodeCompletionModelControllerInterface>
-#include "dcd.h"
-
-using namespace KTextEditor;
-
-class LumenCompletionModel : public CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface
-{
- Q_OBJECT
- Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
-public:
- LumenCompletionModel(QObject *parent, DCD *dcd);
- ~LumenCompletionModel() override;
-
- bool shouldStartCompletion(View *view, const QString &insertedText, bool userInsertion, const Cursor &position) override;
- void completionInvoked(View *view, const Range &range, InvocationType invocationType) override;
- void executeCompletionItem(View *view, const Range &word, const QModelIndex &index) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
-
-private:
- DCD *m_dcd;
- DCDCompletion m_data;
-};
-
-#endif
diff --git a/addons/lumen/dcd.cpp b/addons/lumen/dcd.cpp
deleted file mode 100644
index 5c98630eb..000000000
--- a/addons/lumen/dcd.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright 2014-2015 David Herberth kde at dav1d.de
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
-**/
-
-#include "dcd.h"
-#include <QDebug>
-#include <QProcess>
-#include <QFile>
-#include <QRegularExpression>
-#include <QIcon>
-
-
-char DCDCompletionItemType::toChar(DCDCompletionItemType e)
-{
- switch (e) {
- case Invalid: return 0;
- case Calltip: return 1;
- case ClassName: return 'c';
- case InterfaceName: return 'i';
- case StructName: return 's';
- case UnionName: return 'u';
- case VariableName: return 'v';
- case MemberVariableName: return 'm';
- case Keyword: return 'k';
- case FunctionName: return 'f';
- case EnumName: return 'g';
- case EnumMember: return 'e';
- case PackageName: return 'p';
- case ModuleName: return 'M';
- }
-
- return 0;
-}
-
-DCDCompletionItemType::DCDCompletionItemType DCDCompletionItemType::fromChar(char c)
-{
- switch (c) {
- case 0: return Invalid;
- case 1: return Calltip;
- case 'c': return ClassName;
- case 'i': return InterfaceName;
- case 's': return StructName;
- case 'u': return UnionName;
- case 'v': return VariableName;
- case 'm': return MemberVariableName;
- case 'k': return Keyword;
- case 'f': return FunctionName;
- case 'g': return EnumName;
- case 'e': return EnumMember;
- case 'p': return PackageName;
- case 'M': return ModuleName;
- }
-
- return Invalid;
-}
-
-
-
-DCDCompletionItem::DCDCompletionItem(DCDCompletionItemType::DCDCompletionItemType t, const QString &s): type(t), name(s)
-{
-
-}
-
-#define RETURN_CACHED_ICON(name) {static QIcon icon(QIcon::fromTheme(QStringLiteral(name)).pixmap(QSize(16, 16))); return icon;}
-QIcon DCDCompletionItem::icon() const
-{
- using namespace DCDCompletionItemType;
- switch (type)
- {
- case Invalid: break;
- case Calltip: RETURN_CACHED_ICON("code-function")
- case ClassName: RETURN_CACHED_ICON("code-class")
- case InterfaceName: RETURN_CACHED_ICON("code-class")
- case StructName: RETURN_CACHED_ICON("struct")
- case UnionName: RETURN_CACHED_ICON("union")
- case VariableName: RETURN_CACHED_ICON("code-variable")
- case MemberVariableName: RETURN_CACHED_ICON("field")
- case Keyword: RETURN_CACHED_ICON("field")
- case FunctionName: RETURN_CACHED_ICON("code-function")
- case EnumName: RETURN_CACHED_ICON("enum")
- case EnumMember: RETURN_CACHED_ICON("enum")
- case PackageName: RETURN_CACHED_ICON("field")
- case ModuleName: RETURN_CACHED_ICON("field")
- }
-
- return QIcon();
-}
-
-QString DCDCompletionItem::typeLong() const
-{
- using namespace DCDCompletionItemType;
- switch (type)
- {
- case Invalid: return QStringLiteral("invalid");
- case Calltip: return QStringLiteral("calltip");
- case ClassName: return QStringLiteral("class");
- case InterfaceName: return QStringLiteral("interface");
- case StructName: return QStringLiteral("struct");
- case UnionName: return QStringLiteral("union");
- case VariableName: return QStringLiteral("variable");
- case MemberVariableName: return QStringLiteral("member");
- case Keyword: return QStringLiteral("keyword");
- case FunctionName: return QStringLiteral("function");
- case EnumName: return QStringLiteral("enum");
- case EnumMember: return QStringLiteral("enum member");
- case PackageName: return QStringLiteral("package");
- case ModuleName: return QStringLiteral("module");
- }
-
- return QStringLiteral("completion");
-}
-
-
-static const int TIMEOUT_START_SERVER = 200;
-static const int TIMEOUT_COMPLETE = 200;
-static const int TIMEOUT_IMPORTPATH = 200;
-static const int TIMEOUT_SHUTDOWN = 350;
-static const int TIMEOUT_SHUTDOWN_SERVER = 200;
-
-
-DCD::DCD(int port, const QString& server, const QString& client)
-{
- m_port = port;
- m_server = server;
- m_client = client;
-}
-
-int DCD::port() const
-{
- return m_port;
-}
-
-bool DCD::running()
-{
- return m_sproc.state() == QProcess::Running;
-}
-
-
-bool DCD::startServer()
-{
- m_sproc.setProcessChannelMode(QProcess::MergedChannels);
- m_sproc.start(m_server, QStringList(QStringLiteral("-p%1").arg(m_port)));
- bool started = m_sproc.waitForStarted(TIMEOUT_START_SERVER);
- bool finished = m_sproc.waitForFinished(TIMEOUT_START_SERVER);
-
- if (!started || finished || m_sproc.state() == QProcess::NotRunning) {
- qWarning() << "unable to start completion-server:" << m_sproc.exitCode();
- qWarning() << m_sproc.readAllStandardOutput();
- return false;
- }
- qDebug() << "started completion-server";
- return true;
-}
-
-
-DCDCompletion DCD::complete(const QString& file, int offset)
-{
- QProcess proc;
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(m_client,
- QStringList()
- << QStringLiteral("-p%1").arg(m_port)
- << QStringLiteral("-c%1").arg(offset)
- << file
- );
- proc.waitForFinished(TIMEOUT_COMPLETE);
- proc.terminate();
-
- if (proc.exitStatus() != QProcess::NormalExit || proc.exitCode() != 0) {
- qWarning() << "unable to complete:" << proc.exitCode();
- qWarning() << proc.readAllStandardOutput();
- return DCDCompletion();
- }
-
- return processCompletion(QString::fromUtf8(proc.readAllStandardOutput()));
-}
-
-DCDCompletion DCD::complete(const QByteArray& data, int offset)
-{
- QProcess proc;
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(m_client,
- QStringList()
- << QStringLiteral("-p%1").arg(m_port)
- << QStringLiteral("-c%1").arg(offset)
- );
- proc.write(data);
- proc.closeWriteChannel();
- if (!proc.waitForFinished(TIMEOUT_COMPLETE)) {
- qWarning() << "unable to complete: client didn't finish in time";
- proc.close();
- } else if (proc.exitCode() != 0) {
- qWarning() << "unable to complete:" << proc.exitCode();
- qWarning() << proc.readAllStandardOutput();
- } else {
- // everything Ok
- return processCompletion(QString::fromUtf8(proc.readAllStandardOutput()));
- }
-
- return DCDCompletion();
-}
-
-QString DCD::doc(const QByteArray& data, int offset)
-{
- QProcess proc;
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(m_client,
- QStringList()
- << QStringLiteral("-p%1").arg(m_port)
- << QStringLiteral("-c%1").arg(offset)
- << QStringLiteral("--doc")
- );
-
- proc.write(data);
- proc.closeWriteChannel();
- if (!proc.waitForFinished(TIMEOUT_COMPLETE)) {
- qWarning() << "unable to lookup documentation: client didn't finish in time";
- proc.close();
- } else if (proc.exitCode() != 0) {
- qWarning() << "unable to lookup documentation:" << proc.exitCode();
- qWarning() << proc.readAllStandardOutput();
- } else {
- return QString::fromUtf8(proc.readAllStandardOutput());
- }
-
- return QString();
-}
-
-
-DCDCompletion DCD::processCompletion(const QString& data)
-{
- DCDCompletion completion;
-
- QStringList lines = data.split(QRegularExpression(QStringLiteral("[\r\n]")), QString::SkipEmptyParts);
- if (lines.length() == 0) {
- return completion;
- }
-
- QString type = lines.front();
- if (type == QLatin1String("identifiers")) { completion.type = DCDCompletionType::Identifiers; }
- else if (type == QLatin1String("calltips")) { completion.type = DCDCompletionType::Calltips; }
- else {
- qWarning() << "Invalid type:" << type;
- return completion;
- }
- lines.pop_front();
-
- foreach(QString line, lines) {
- if (line.trimmed().length() == 0) {
- continue;
- }
-
- QStringList kv = line.split(QRegularExpression(QStringLiteral("\\s+")), QString::SkipEmptyParts);
- if (kv.length() != 2 && completion.type != DCDCompletionType::Calltips) {
- qWarning() << "invalid completion data:" << kv.length() << completion.type;
- continue;
- }
-
- if (completion.type == DCDCompletionType::Identifiers) {
- completion.completions.append(DCDCompletionItem(
- DCDCompletionItemType::fromChar(kv[1].at(0).toLatin1()), kv[0]
- ));
- } else {
- completion.completions.append(DCDCompletionItem(
- DCDCompletionItemType::Calltip, line
- ));
- }
- }
-
- return completion;
-}
-
-
-void DCD::addImportPath(const QString& path)
-{
- addImportPath(QStringList(path));
-}
-
-void DCD::addImportPath(const QStringList& paths)
-{
- if (paths.isEmpty()) {
- return;
- }
-
- QStringList arguments = QStringList(QStringLiteral("-p%1").arg(m_port));
- foreach(QString path, paths) {
- if (QFile::exists(path))
- arguments << QStringLiteral("-I%1").arg(path);
- }
-
- QProcess proc;
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(m_client, arguments);
- proc.waitForFinished(TIMEOUT_IMPORTPATH);
-
- if (proc.exitStatus() != QProcess::NormalExit || proc.exitCode() != 0) {
- qWarning() << "unable to add importpath(s)" << paths << ":" << proc.exitCode();
- qWarning() << proc.readAll();
- }
-}
-
-void DCD::shutdown()
-{
- QProcess proc;
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(m_client,
- QStringList()
- << QStringLiteral("-p%1").arg(m_port)
- << QStringLiteral("--shutdown")
- );
- proc.waitForFinished(TIMEOUT_SHUTDOWN);
-
- if (proc.exitStatus() != QProcess::NormalExit || proc.exitCode() != 0) {
- qWarning() << "unable to shutdown dcd:" << proc.exitCode();
- qWarning() << proc.readAllStandardOutput();
- }
-}
-
-
-bool DCD::stopServer()
-{
- if (m_sproc.state() == QProcess::Running) {
- qDebug() << "shutting down dcd";
- shutdown();
- if(!m_sproc.waitForFinished(TIMEOUT_SHUTDOWN_SERVER))
- m_sproc.terminate();
- if(!m_sproc.waitForFinished(TIMEOUT_SHUTDOWN_SERVER))
- m_sproc.kill();
-
- return true;
- }
- return false;
-}
-
-
-
-DCD::~DCD()
-{
- if (running()) {
- stopServer();
- }
-}
diff --git a/addons/lumen/dcd.h b/addons/lumen/dcd.h
deleted file mode 100644
index 5331343ae..000000000
--- a/addons/lumen/dcd.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2014-2015 David Herberth kde at dav1d.de
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef LUMEN_DCD_H
-#define LUMEN_DCD_H
-
-#include <QDebug>
-#include <QProcess>
-#include <QFile>
-#include <QObject>
-#include <QMap>
-#include <QIcon>
-
-namespace DCDCompletionType
-{
-enum DCDCompletionType { Identifiers, Calltips };
-}
-namespace DCDCompletionItemType
-{
-enum DCDCompletionItemType {
- Invalid,
-
- Calltip,
-
- ClassName,
- InterfaceName,
- StructName,
- UnionName,
- VariableName,
- MemberVariableName,
- Keyword,
- FunctionName,
- EnumName,
- EnumMember,
- PackageName,
- ModuleName,
-};
-
-char toChar(DCDCompletionItemType e);
-DCDCompletionItemType fromChar(char c);
-}
-
-struct DCDCompletionItem {
- DCDCompletionItem(DCDCompletionItemType::DCDCompletionItemType, const QString &);
-
- DCDCompletionItemType::DCDCompletionItemType type;
- QString name;
-
- QIcon icon() const;
- QString typeLong() const;
-};
-
-struct DCDCompletion {
- DCDCompletionType::DCDCompletionType type;
- QList<DCDCompletionItem> completions;
-};
-
-class DCD
-{
-public:
- DCD(int, const QString &, const QString &);
- virtual ~DCD();
- int port() const;
- bool running();
- bool startServer();
- bool stopServer();
- DCDCompletion complete(const QString &, int);
- DCDCompletion complete(const QByteArray &, int);
- QString doc(const QByteArray &, int);
- void shutdown();
- void addImportPath(const QString &);
- void addImportPath(const QStringList &);
-
-private:
- DCDCompletion processCompletion(const QString &);
- int m_port;
- QString m_server;
- QString m_client;
- QProcess m_sproc;
-};
-
-#endif
diff --git a/addons/lumen/ktexteditor_lumen.desktop b/addons/lumen/ktexteditor_lumen.desktop
deleted file mode 100644
index 42ce792b4..000000000
--- a/addons/lumen/ktexteditor_lumen.desktop
+++ /dev/null
@@ -1,77 +0,0 @@
-[Desktop Entry]
-Type=Service
-ServiceTypes=KTextEditor/Plugin
-X-KDE-Library=ktexteditorlumen
-Icon=task-delegate
-Name=Lumen
-Name[ar]=لومِن
-Name[ast]=Lumen
-Name[ca]=Lumen
-Name[ca at valencia]=Lumen
-Name[cs]=Lumen
-Name[da]=Lumen
-Name[de]=Lumen
-Name[el]=Lumen
-Name[en_GB]=Lumen
-Name[es]=Lumen
-Name[et]=Lumen
-Name[eu]=Lumen
-Name[fi]=Lumen
-Name[fr]=Lumen
-Name[gl]=Lumen
-Name[he]=Lumen
-Name[hu]=Lumen
-Name[ia]=Lumen
-Name[id]=Lumen
-Name[it]=Lumen
-Name[ko]=Lumen
-Name[nb]=Lumen
-Name[nds]=Lumen
-Name[nl]=Lumen
-Name[nn]=Lumen
-Name[pl]=Lumen
-Name[pt]=Lumen
-Name[pt_BR]=Lumen
-Name[ro]=Lumen
-Name[ru]=Lumen
-Name[sk]=Lumen
-Name[sl]=Lumen
-Name[sr]=Лумен
-Name[sr at ijekavian]=Лумен
-Name[sr at ijekavianlatin]=Lumen
-Name[sr at latin]=Lumen
-Name[sv]=Lumen
-Name[tr]=Lumen
-Name[uk]=Lumen
-Name[x-test]=xxLumenxx
-Name[zh_CN]=Lumen
-Name[zh_TW]=Lumen
-Comment=Autocompletion Plugin for D, using the DCD autocompletion server
-Comment[ast]=Complementu d'autocompletáu pa D qu'usa'l sirvidor d'autocompletáu DCD
-Comment[ca]=Connector de compleció automàtica pel D, que usa el servidor de compleció automàtica DCD
-Comment[ca at valencia]=Connector de compleció automàtica pel D, que usa el servidor de compleció automàtica DCD
-Comment[de]=Ein Modul zur automatischen Vervollständigung für D, das den DCD-Auto-Vervollständigungs-Server benutzt
-Comment[el]=Πρόσθετο αυτόματης συμπλήρωσης για την D, με τη χρήση του εξυπηρετητή αυτόματης συμπλήρωσης DCD
-Comment[en_GB]=Autocompletion Plugin for D, using the DCD autocompletion server
-Comment[es]=Complemento de completado automático para D que utiliza el servidor de completado automático DCD.
-Comment[eu]=D-ren osatze-automatikoaren plugina, DCD osatze-automatikoaren zerbitzaria erabiliz
-Comment[fi]=DCD-automaattitäydennyspalvelinta käyttävä automaattitäydennysliitännäinen D:lle
-Comment[fr]=Composant externe d'auto-complètement pour le langage D qui utilise le serveur d'auto-complètement DCD
-Comment[gl]=Complemento de completado automático para D que emprega o servidor de completado automático DCD
-Comment[ia]=Plugin de autocompletion pro D, usante le servitor de autocompletion DCD
-Comment[id]=Plugin Autocompletion untuk D, menggunakan server autocompletion DCD
-Comment[it]=Estensione di completamento automatico per D, che usa il server di completamento automatico DCD
-Comment[ko]=DCD를 자동 완성 서버로 사용하는 D 자동 완성 플러그인
-Comment[nl]=Plug-in voor automatisch aanvullen voor D, met gebruikmaking van de DCD-server voor automatisch aanvullen
-Comment[nn]=Tillegg for autofullføring for D, og som brukar autofullføringstenesta DCD
-Comment[pl]=Wtyczka uzupełniania dla D, przy użyciu serwera DCD
-Comment[pt]=Ferramenta de completação automática para o D, usando o servidor de completação automática DCD
-Comment[pt_BR]=Plugin de autocompletar para o D, que usa o servidor DCD
-Comment[ru]=Lumen — модуль автодополнения для языка D, использующий сервер автодополнения DCD
-Comment[sk]=Lumen je plugin pre automatické dokončovanie pre D, pomocou servera automatického dokončovania DCD
-Comment[sv]=Insticksprogram för automatisk komplettering av D, som använder DCD-servern för automatisk komplettering
-Comment[tr]=D için DCD otomatik tamamlama sunucusu kullanan otomatik tamamlama eklentisi
-Comment[uk]=Додаток автоматичного доповнення коду мовою D, якому використано сервер доповнення DCD
-Comment[x-test]=xxAutocompletion Plugin for D, using the DCD autocompletion serverxx
-Comment[zh_CN]=D 语言自动补全插件,使用的是 DCD 自动补全服务器
-Comment[zh_TW]=D 的自動補完外掛程式,使用 DCD 自動補完伺服器
diff --git a/addons/lumen/lumen.cpp b/addons/lumen/lumen.cpp
deleted file mode 100644
index afd4a0fa1..000000000
--- a/addons/lumen/lumen.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2014-2015 David Herberth kde at dav1d.de
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
-**/
-
-#include "lumen.h"
-
-#include <kpluginfactory.h>
-#include <KTextEditor/Document>
-#include <KTextEditor/Range>
-#include <KTextEditor/View>
-#include <KTextEditor/CodeCompletionInterface>
-#include <KTextEditor/TextHintInterface>
-#include <KTextEditor/MainWindow>
-#include <kactioncollection.h>
-#include <QFile>
-#include <QDir>
-
-
-K_PLUGIN_FACTORY_WITH_JSON(LumenPluginFactory, "ktexteditor_lumen.json", registerPlugin<LumenPlugin>();)
-
-
-LumenPluginView::LumenPluginView(LumenPlugin *plugin, KTextEditor::MainWindow *mainWin)
- : QObject(mainWin)
- , m_plugin(plugin)
- , m_mainWin(mainWin)
- , m_registered(false)
-{
- m_model = new LumenCompletionModel((QObject*)m_mainWin, m_plugin->dcd());
- m_hinter = new LumenHintProvider(m_plugin);
-
- connect(m_mainWin, &KTextEditor::MainWindow::viewCreated, this, &LumenPluginView::viewCreated);
-
- foreach(KTextEditor::View *view, m_mainWin->views()) {
- viewCreated(view);
- }
-}
-
-void LumenPluginView::viewCreated(KTextEditor::View *view)
-{
- connect(view->document(), &KTextEditor::Document::documentUrlChanged,
- this, &LumenPluginView::documentChanged,
- Qt::UniqueConnection);
- connect(view->document(), &KTextEditor::Document::highlightingModeChanged,
- this, &LumenPluginView::documentChanged,
- Qt::UniqueConnection);
-
- connect(view->document(), &Document::documentUrlChanged, this, &LumenPluginView::urlChanged);
- registerCompletion(view);
-}
-
-void LumenPluginView::viewDestroyed(QObject *view)
-{
- m_completionViews.remove(static_cast<KTextEditor::View *>(view));
-}
-
-void LumenPluginView::documentChanged(KTextEditor::Document *document)
-{
- foreach(KTextEditor::View *view, document->views()) {
- registerCompletion(view);
- registerTextHints(view);
-
- }
-}
-
-void LumenPluginView::registerCompletion(KTextEditor::View *view)
-{
- KTextEditor::CodeCompletionInterface *completion =
- qobject_cast<KTextEditor::CodeCompletionInterface*>(view);
-
- bool isD = view->document()->url().path().endsWith(QLatin1String(".d")) ||
- view->document()->highlightingMode() == QLatin1Char('D');
-
- if (isD && !m_registered) {
- completion->registerCompletionModel(m_model);
- m_registered = true;
- } else if(!isD && m_registered) {
- completion->unregisterCompletionModel(m_model);
- m_registered = false;
- }
-}
-
-void LumenPluginView::registerTextHints(KTextEditor::View *view)
-{
- KTextEditor::TextHintInterface *th =
- qobject_cast<KTextEditor::TextHintInterface*>(view);
-
- if (th) {
- th->setTextHintDelay(500);
- th->registerTextHintProvider(m_hinter);
- }
-}
-
-LumenPluginView::~LumenPluginView()
-{
-}
-
-void LumenPluginView::urlChanged(Document* document)
-{
- QStringList paths;
- QDir dir = QDir(document->url().toLocalFile());
-
- for (; !dir.isRoot(); dir.cdUp()) {
- QFile file(dir.filePath(QStringLiteral(".lumenconfig")));
- if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- while (!file.atEnd()) {
- QString path = QString::fromUtf8(file.readLine().trimmed());
-
- if (QDir::isRelativePath(path)){
- path = QDir::cleanPath(dir.filePath(path));
- }
-
- paths.append(path);
- }
- }
- }
-
- if (!paths.isEmpty()) {
- m_plugin->dcd()->addImportPath(paths);
- }
-}
-
-
-LumenHintProvider::LumenHintProvider(LumenPlugin* plugin)
- : m_plugin(plugin)
-{
-}
-
-QString LumenHintProvider::textHint(View* view, const Cursor& position)
-{
- KTextEditor::Document* document = view->document();
-
- KTextEditor::Cursor cursorEnd = document->documentEnd();
- KTextEditor::Range range0c = KTextEditor::Range(0, 0, position.line(), position.column());
- KTextEditor::Range rangece = KTextEditor::Range(position.line(), position.column(),
- cursorEnd.line(), cursorEnd.column());
- QString text0c = document->text(range0c, false);
- QByteArray utf8 = text0c.toUtf8();
- int offset = utf8.length();
- utf8.append(document->text(rangece, false).toUtf8());
-
- return m_plugin->dcd()->doc(utf8, offset).trimmed().replace(QStringLiteral("\\n"), QStringLiteral("\n"));
-}
-
-
-LumenPlugin::LumenPlugin(QObject *parent, const QList<QVariant> &)
- : Plugin(parent)
-{
- m_dcd = new DCD(9166, QStringLiteral("dcd-server"), QStringLiteral("dcd-client"));
- m_dcd->startServer();
-}
-
-LumenPlugin::~LumenPlugin()
-{
- m_dcd->stopServer();
- delete m_dcd;
-}
-
-DCD* LumenPlugin::dcd()
-{
- return m_dcd;
-}
-
-QObject* LumenPlugin::createView(KTextEditor::MainWindow *mainWin)
-{
- return new LumenPluginView(this, mainWin);
-}
-
-#include "lumen.moc"
diff --git a/addons/lumen/lumen.h b/addons/lumen/lumen.h
deleted file mode 100644
index a94354822..000000000
--- a/addons/lumen/lumen.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2014-2015 David Herberth kde at dav1d.de
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef LUMEN_H
-#define LUMEN_H
-
-#include <KTextEditor/Plugin>
-#include <KTextEditor/Range>
-#include <KTextEditor/TextHintInterface>
-
-#include <QVariantList>
-#include <QSet>
-
-#include <KXMLGUIClient>
-#include "dcd.h"
-#include "completion.h"
-
-using namespace KTextEditor;
-
-class LumenPlugin;
-class LumenHintProvider;
-
-class LumenPluginView : public QObject
-{
- Q_OBJECT
-public:
- LumenPluginView(LumenPlugin *plugin, KTextEditor::MainWindow *view);
- ~LumenPluginView() override;
- void registerCompletion(KTextEditor::View *view);
- void registerTextHints(KTextEditor::View *view);
-private Q_SLOTS:
- void urlChanged(KTextEditor::Document *);
- void viewCreated(KTextEditor::View *view);
- void viewDestroyed(QObject *view);
- void documentChanged(KTextEditor::Document *document);
-
-private:
- LumenPlugin *m_plugin;
- MainWindow *m_mainWin;
- LumenCompletionModel *m_model;
- QSet<View *> m_completionViews;
- bool m_registered;
- LumenHintProvider *m_hinter;
-};
-
-class LumenHintProvider : public KTextEditor::TextHintProvider
-{
-public:
- explicit LumenHintProvider(LumenPlugin *plugin);
- QString textHint(KTextEditor::View *view, const KTextEditor::Cursor &position) override;
-
-private:
- LumenPlugin *m_plugin;
-};
-
-class LumenPlugin : public Plugin
-{
- Q_OBJECT
-public:
- explicit LumenPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
- ~LumenPlugin() override;
- DCD *dcd();
- QObject *createView(MainWindow *mainWindow) override;
-
-private:
- DCD *m_dcd;
-};
-
-#endif
diff --git a/addons/rustcompletion/CMakeLists.txt b/addons/rustcompletion/CMakeLists.txt
deleted file mode 100644
index ee8f205be..000000000
--- a/addons/rustcompletion/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-add_library(kterustcompletionplugin MODULE "")
-target_compile_definitions(kterustcompletionplugin PRIVATE TRANSLATION_DOMAIN="kterustcompletion")
-target_link_libraries(kterustcompletionplugin PRIVATE KF5::TextEditor)
-
-target_sources(
- kterustcompletionplugin
- PRIVATE
- kterustcompletion.cpp
- kterustcompletionconfigpage.cpp
- kterustcompletionplugin.cpp
- kterustcompletionpluginview.cpp
- plugin.qrc
-)
-
-kcoreaddons_desktop_to_json(kterustcompletionplugin kterustcompletionplugin.desktop)
-install(TARGETS kterustcompletionplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
diff --git a/addons/rustcompletion/Messages.sh b/addons/rustcompletion/Messages.sh
deleted file mode 100644
index e430f6260..000000000
--- a/addons/rustcompletion/Messages.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-$EXTRACTRC *.rc >> rc.cpp
-$XGETTEXT *.cpp -o $podir/kterustcompletion.pot
diff --git a/addons/rustcompletion/kterustcompletion.cpp b/addons/rustcompletion/kterustcompletion.cpp
deleted file mode 100644
index f18c9001a..000000000
--- a/addons/rustcompletion/kterustcompletion.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2012 Christoph Cullmann <cullmann at kde.org> *
- * Copyright (C) 2003 Anders Lund <anders.lund at lund.tdcadsl.dk> *
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#include "kterustcompletion.h"
-#include "kterustcompletionplugin.h"
-
-#include <QProcessEnvironment>
-#include <QTemporaryFile>
-#include <QTextStream>
-
-#include <KTextEditor/Cursor>
-#include <KTextEditor/Document>
-#include <KTextEditor/View>
-
-KTERustCompletion::KTERustCompletion(KTERustCompletionPlugin *plugin)
- : KTextEditor::CodeCompletionModel(nullptr)
- , m_plugin(plugin)
-{
-}
-
-KTERustCompletion::~KTERustCompletion()
-{
-}
-
-QVariant KTERustCompletion::data(const QModelIndex &index, int role) const
-{
-
- if (!index.isValid() || index.row() >= m_matches.size()) {
- return QVariant();
- }
-
- const CompletionMatch &match = m_matches.at(index.row());
-
- if (index.column() == KTextEditor::CodeCompletionModel::Name && role == Qt::DisplayRole) {
- return match.text;
- } else if (index.column() == KTextEditor::CodeCompletionModel::Icon && role == Qt::DecorationRole) {
- return match.icon;
- } else if (role == KTextEditor::CodeCompletionModel::CompletionRole) {
- return (int)match.type;
- } else if (role == KTextEditor::CodeCompletionModel::ArgumentHintDepth) {
- return match.depth;
- } else if (role == KTextEditor::CodeCompletionModel::MatchQuality) {
- if (index.row() < 10) {
- return 10 - index.row();
- } else {
- return 0;
- }
- } else if (role == KTextEditor::CodeCompletionModel::BestMatchesCount) {
- return (index.row() < 10) ? 1 : 0;
- }
-
- return QVariant();
-}
-
-bool KTERustCompletion::shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position)
-{
- if (!userInsertion) {
- return false;
- }
-
- if (insertedText.isEmpty()) {
- return false;
- }
-
- bool complete = CodeCompletionModelControllerInterface::shouldStartCompletion(view,
- insertedText, userInsertion, position);
-
- complete = complete || insertedText.endsWith(QLatin1Char('('));
- complete = complete || insertedText.endsWith(QLatin1Char('.'));
- complete = complete || insertedText.endsWith(QLatin1String("::"));
-
- return complete;
-}
-
-void KTERustCompletion::completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType it)
-{
- Q_UNUSED(it)
-
- beginResetModel();
-
- m_matches = getMatches(view->document(), Complete, range.end());
-
- setRowCount(m_matches.size());
- setHasGroups(false);
-
- endResetModel();
-}
-
-void KTERustCompletion::aborted(KTextEditor::View *view)
-{
- Q_UNUSED(view);
-
- beginResetModel();
-
- m_matches.clear();
-
- endResetModel();
-}
-
-QList<CompletionMatch> KTERustCompletion::getMatches(const KTextEditor::Document *document, MatchAction action, const KTextEditor::Cursor &position)
-{
- QList<CompletionMatch> matches;
-
- if (!m_plugin->configOk()) {
- return matches;
- }
-
- QTemporaryFile file;
-
- if (file.open()) {
- {
- QTextStream out(&file);
- out.setCodec("UTF-8");
- out << document->text();
- }
-
- QProcess proc;
-
- QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
- env.insert(QStringLiteral("LC_ALL"), QStringLiteral("C"));
- env.insert(QStringLiteral("RUST_SRC_PATH"), m_plugin->rustSrcPath().toLocalFile());
- proc.setProcessEnvironment(env);
-
- QStringList args;
- args << (action == Complete ? QStringLiteral("complete") : QStringLiteral("find-definition"));
- args << QString::number(position.line() + 1);
- args << QString::number(position.column());
- args << file.fileName();
-
- proc.start(m_plugin->racerCmd(), args, QIODevice::ReadOnly);
-
- if (proc.waitForFinished(1000)) {
- const QString &output = QString::fromUtf8(proc.readAllStandardOutput());
-
- QStringList lines(output.split(QLatin1Char('\n'), QString::SkipEmptyParts));
-
- foreach(QString line, lines) {
- if (line.startsWith(QLatin1String("MATCH "))) {
- line.remove(0, 6);
-
- CompletionMatch match;
- match.text = line.section(QLatin1Char(','), 0, 0);
-
- const QString &type = line.section(QLatin1Char(','), 4, 4);
- match.depth = (type == QLatin1String("StructField")) ? 1 : 0;
- addType(match, type);
-
- QString path = line.section(QLatin1Char(','), 3, 3);
-
- if (path == file.fileName()) {
- match.url = document->url();
- } else {
- match.url = QUrl::fromLocalFile(path);
- }
-
- bool ok = false;
-
- int row = line.section(QLatin1Char(','), 1, 1).toInt(&ok);
- if (ok) match.line = row - 1;
-
- int col = line.section(QLatin1Char(','), 2, 2).toInt(&ok);
- if (ok) match.col = col;
-
- matches.append(match);
-
- if (action == FindDefinition) {
- break;
- }
- }
- }
- }
- }
-
- return matches;
-}
-
-void KTERustCompletion::addType(CompletionMatch &match, const QString &type)
-{
- if (type == QLatin1String("Function")) {
- match.type = CodeCompletionModel::Function;
- match.icon = QIcon::fromTheme(QStringLiteral("code-function"));
- } else if (type == QLatin1String("Struct")) {
- match.type = CodeCompletionModel::Struct;
- match.icon = QIcon::fromTheme(QStringLiteral("code-class"));
- } else if (type == QLatin1String("StructField")) {
- match.icon = QIcon::fromTheme(QStringLiteral("field"));
- } else if (type == QLatin1String("Trait")) {
- match.type = CodeCompletionModel::Class;
- match.icon = QIcon::fromTheme(QStringLiteral("code-class"));
- } else if (type == QLatin1String("Module")) {
- match.type = CodeCompletionModel::Namespace;
- match.icon = QIcon::fromTheme(QStringLiteral("field"));
- } else if (type == QLatin1String("Crate")) {
- match.type = CodeCompletionModel::Namespace;
- match.icon = QIcon::fromTheme(QStringLiteral("field"));
- } else if (type == QLatin1String("Let")) {
- match.type = CodeCompletionModel::Variable;
- match.icon = QIcon::fromTheme(QStringLiteral("code-variable"));
- } else if (type == QLatin1String("Enum")) {
- match.type = CodeCompletionModel::Enum;
- match.icon = QIcon::fromTheme(QStringLiteral("icon"));
- }
-}
diff --git a/addons/rustcompletion/kterustcompletion.h b/addons/rustcompletion/kterustcompletion.h
deleted file mode 100644
index 1a84bb1a6..000000000
--- a/addons/rustcompletion/kterustcompletion.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#ifndef KTERUSTCOMPLETION_H
-#define KTERUSTCOMPLETION_H
-
-#include <QIcon>
-#include <QUrl>
-
-#include <KTextEditor/CodeCompletionModel>
-#include <KTextEditor/CodeCompletionModelControllerInterface>
-
-class KTERustCompletionPlugin;
-
-namespace KTextEditor
-{
-class Document;
-class View;
-}
-
-struct CompletionMatch {
- CompletionMatch() = default;
- QString text;
- QIcon icon;
- KTextEditor::CodeCompletionModel::CompletionProperty type = KTextEditor::CodeCompletionModel::NoProperty;
- int depth = 0;
- QUrl url;
- int line = -1;
- int col = -1;
-};
-
-class KTERustCompletion : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface
-{
- Q_OBJECT
-
- Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
-
-public:
- KTERustCompletion(KTERustCompletionPlugin *plugin);
- ~KTERustCompletion() override;
-
- enum MatchAction { Complete = 0, FindDefinition };
-
- bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position) override;
-
- void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType) override;
-
- void aborted(KTextEditor::View *view) override;
-
- QVariant data(const QModelIndex &index, int role) const override;
-
- QList<CompletionMatch> getMatches(const KTextEditor::Document *document, MatchAction action, const KTextEditor::Cursor &position);
-
-private:
- static void addType(CompletionMatch &match, const QString &type);
-
- QList<CompletionMatch> m_matches;
-
- KTERustCompletionPlugin *m_plugin;
-};
-
-#endif
diff --git a/addons/rustcompletion/kterustcompletionconfigpage.cpp b/addons/rustcompletion/kterustcompletionconfigpage.cpp
deleted file mode 100644
index 4726a2fbc..000000000
--- a/addons/rustcompletion/kterustcompletionconfigpage.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#include "kterustcompletionconfigpage.h"
-#include "kterustcompletionplugin.h"
-
-#include <QGroupBox>
-#include <QLineEdit>
-#include <QVBoxLayout>
-
-#include <KLocalizedString>
-#include <KUrlRequester>
-
-KTERustCompletionConfigPage::KTERustCompletionConfigPage(QWidget *parent, KTERustCompletionPlugin *plugin)
- : KTextEditor::ConfigPage(parent)
- , m_plugin(plugin)
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setContentsMargins(0, 0, 0, 0);
-
- QVBoxLayout *vbox = new QVBoxLayout;
- QGroupBox *group = new QGroupBox(i18n("Racer command"), this);
- m_racerCmd = new QLineEdit(this);
- vbox->addWidget(m_racerCmd);
- group->setLayout(vbox);
- layout->addWidget(group);
-
- vbox = new QVBoxLayout;
- group = new QGroupBox(i18n("Rust source tree location"), this);
- m_rustSrcPath = new KUrlRequester(this);
- m_rustSrcPath->setMode(KFile::Directory | KFile::LocalOnly);
- vbox->addWidget(m_rustSrcPath);
- group->setLayout(vbox);
- layout->addWidget(group);
-
- layout->insertStretch(-1, 10);
-
- reset();
-
- connect(m_racerCmd, &QLineEdit::textChanged, this, &KTERustCompletionConfigPage::changedInternal);
- connect(m_rustSrcPath, &KUrlRequester::textChanged, this, &KTERustCompletionConfigPage::changedInternal);
- connect(m_rustSrcPath, &KUrlRequester::urlSelected, this, &KTERustCompletionConfigPage::changedInternal);
-}
-
-QString KTERustCompletionConfigPage::name() const
-{
- return QString(i18n("Rust code completion"));
-}
-
-QString KTERustCompletionConfigPage::fullName() const
-{
- return QString(i18n("Rust code completion"));
-}
-
-QIcon KTERustCompletionConfigPage::icon() const
-{
- return QIcon::fromTheme(QLatin1String("text-field"));
-}
-
-void KTERustCompletionConfigPage::apply()
-{
- if (!m_changed) {
- return;
- }
-
- m_changed = false;
-
- m_plugin->setRacerCmd(m_racerCmd->text());
- m_plugin->setRustSrcPath(m_rustSrcPath->url());
-}
-
-void KTERustCompletionConfigPage::reset()
-{
- m_racerCmd->setText(m_plugin->racerCmd());
- m_rustSrcPath->setUrl(m_plugin->rustSrcPath());
- m_changed = false;
-}
-
-void KTERustCompletionConfigPage::defaults()
-{
- reset();
-}
-
-void KTERustCompletionConfigPage::changedInternal()
-{
- m_changed = true;
-
- emit changed();
-}
diff --git a/addons/rustcompletion/kterustcompletionconfigpage.h b/addons/rustcompletion/kterustcompletionconfigpage.h
deleted file mode 100644
index 3b3090734..000000000
--- a/addons/rustcompletion/kterustcompletionconfigpage.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#ifndef KTERUSTCOMPLETIONCONFIGPAGE_H
-#define KTERUSTCOMPLETIONCONFIGPAGE_H
-
-#include <KTextEditor/ConfigPage>
-
-class KTERustCompletionPlugin;
-
-class QLineEdit;
-
-class KUrlRequester;
-
-class KTERustCompletionConfigPage : public KTextEditor::ConfigPage
-{
- Q_OBJECT
-
-public:
- explicit KTERustCompletionConfigPage(QWidget *parent = nullptr, KTERustCompletionPlugin *plugin = nullptr);
- ~KTERustCompletionConfigPage() 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 Q_SLOTS:
- void changedInternal();
-
-private:
- QLineEdit *m_racerCmd;
- KUrlRequester *m_rustSrcPath;
-
- bool m_changed = false;
-
- KTERustCompletionPlugin *m_plugin;
-};
-
-#endif
diff --git a/addons/rustcompletion/kterustcompletionplugin.cpp b/addons/rustcompletion/kterustcompletionplugin.cpp
deleted file mode 100644
index b6215254a..000000000
--- a/addons/rustcompletion/kterustcompletionplugin.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#include "kterustcompletionplugin.h"
-#include "kterustcompletionpluginview.h"
-#include "kterustcompletionconfigpage.h"
-
-#include <KConfigGroup>
-#include <KDirWatch>
-#include <KPluginFactory>
-#include <KSharedConfig>
-
-#include <QDir>
-
-K_PLUGIN_FACTORY_WITH_JSON(KTERustCompletionPluginFactory, "kterustcompletionplugin.json", registerPlugin<KTERustCompletionPlugin>();)
-
-KTERustCompletionPlugin::KTERustCompletionPlugin(QObject *parent, const QList<QVariant> &)
- : KTextEditor::Plugin(parent),
- m_completion(this)
-{
- readConfig();
-}
-
-KTERustCompletionPlugin::~KTERustCompletionPlugin()
-{
-}
-
-QObject *KTERustCompletionPlugin::createView(KTextEditor::MainWindow *mainWindow)
-{
- return new KTERustCompletionPluginView(this, mainWindow);
-}
-
-int KTERustCompletionPlugin::configPages() const
-{
- return 1;
-}
-
-KTextEditor::ConfigPage *KTERustCompletionPlugin::configPage(int number, QWidget *parent)
-{
- if (number != 0) {
- return nullptr;
- }
-
- return new KTERustCompletionConfigPage(parent, this);
-}
-
-KTERustCompletion *KTERustCompletionPlugin::completion()
-{
- return &m_completion;
-}
-
-QString KTERustCompletionPlugin::racerCmd() const
-{
- return m_racerCmd;
-}
-
-void KTERustCompletionPlugin::setRacerCmd(const QString &cmd)
-{
- if (cmd != m_racerCmd) {
- m_racerCmd = cmd;
-
- writeConfig();
- updateConfigOk();
- }
-}
-
-QUrl KTERustCompletionPlugin::rustSrcPath() const
-{
- return m_rustSrcPath;
-}
-
-void KTERustCompletionPlugin::setRustSrcPath(const QUrl &path)
-{
- if (path != m_rustSrcPath) {
- m_rustSrcPath = path;
-
- writeConfig();
- updateConfigOk();
- }
-}
-
-bool KTERustCompletionPlugin::configOk() const
-{
- return m_configOk;
-}
-
-void KTERustCompletionPlugin::updateConfigOk()
-{
- m_configOk = false;
-
- if (m_rustSrcPath.isLocalFile()) {
- QString path = m_rustSrcPath.toLocalFile();
-
- if (QDir(path).exists()) {
- m_configOk = true;
-
- if (m_rustSrcWatch && !m_rustSrcWatch->contains(path)) {
- delete m_rustSrcWatch;
- m_rustSrcWatch = nullptr;
- }
-
- if (!m_rustSrcWatch) {
- m_rustSrcWatch = new KDirWatch(this);
- m_rustSrcWatch->addDir(path, KDirWatch::WatchDirOnly);
- connect(m_rustSrcWatch, &KDirWatch::deleted,
- this, &KTERustCompletionPlugin::updateConfigOk, Qt::UniqueConnection);
- }
- }
- }
-}
-
-void KTERustCompletionPlugin::readConfig()
-{
- KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("kterustcompletion"));
- m_racerCmd = config.readEntry(QStringLiteral("racerCmd"), QStringLiteral("racer"));
- m_rustSrcPath = config.readEntry(QStringLiteral("rustSrcPath"),
- QUrl(QStringLiteral("/usr/local/src/rust/src")));
-
- updateConfigOk();
-}
-
-void KTERustCompletionPlugin::writeConfig()
-{
- KConfigGroup config(KSharedConfig::openConfig(), QStringLiteral("kterustcompletion"));
- config.writeEntry(QStringLiteral("racerCmd"), m_racerCmd);
- config.writeEntry(QStringLiteral("rustSrcPath"), m_rustSrcPath);
-}
-
-#include "kterustcompletionplugin.moc"
diff --git a/addons/rustcompletion/kterustcompletionplugin.desktop b/addons/rustcompletion/kterustcompletionplugin.desktop
deleted file mode 100644
index 0e3978d44..000000000
--- a/addons/rustcompletion/kterustcompletionplugin.desktop
+++ /dev/null
@@ -1,84 +0,0 @@
-[Desktop Entry]
-Type=Service
-ServiceTypes=KTextEditor/Plugin
-X-KDE-Library=kterustcompletionplugin
-Name=Rust code completion
-Name[ar]=إكمال كود رَسْت
-Name[ast]=Completáu de códigu en Rust
-Name[ca]=Compleció de codi per al Rust
-Name[ca at valencia]=Compleció de codi per al Rust
-Name[cs]=Automatické doplňování pro Rust
-Name[da]=Rust-kodefuldførelse
-Name[de]=Rust-Quelltext-Vervollständigung
-Name[el]=Αυτόματη συμπλήρωση Rust
-Name[en_GB]=Rust code completion
-Name[es]=Terminación de código para Rust
-Name[et]=Rusti automaatne lõpetamine
-Name[eu]=Rust-erako kode osatzea
-Name[fi]=Rust-koodintäydennys
-Name[fr]=Auto-complètement Rust
-Name[gl]=Completación automática de Rust
-Name[hu]=Rust kódkiegészítés
-Name[ia]=Autocompletion de codice Rust
-Name[id]=Penyelesaian kode Rust
-Name[it]=Completamento del codice Rust
-Name[ko]=Rust 자동 완성
-Name[nb]=Rust kodefullføring
-Name[nl]=Code-aanvulling van Rust
-Name[nn]=Kodefullføring for Rust
-Name[pl]=Uzupełnianie kodu Rust
-Name[pt]=Completação de código em Rust
-Name[pt_BR]=Completação de código em Rust
-Name[ru]=Автодополнение Rust
-Name[sk]=Ukončovanie kódu Rust
-Name[sl]=Samodejno dopolnjevanje za Rust
-Name[sr]=Допуњавање раст кода
-Name[sr at ijekavian]=Допуњавање раст кода
-Name[sr at ijekavianlatin]=Dopunjavanje Rust koda
-Name[sr at latin]=Dopunjavanje Rust koda
-Name[sv]=Rust kodkomplettering
-Name[tr]=Rust kod tamamlama
-Name[uk]=Автодоповнення Rust
-Name[x-test]=xxRust code completionxx
-Name[zh_CN]=Rust 代码补全
-Name[zh_TW]=Rust 自動補完
-Comment=Code completion for Rust source code
-Comment[ar]=إكمال نصوص رَسْت البرمجيّة
-Comment[ast]=Completáu de códigu pal códigu fonte en Rust
-Comment[ca]=Compleció de codi pel codi font del Rust
-Comment[ca at valencia]=Compleció de codi pel codi font del Rust
-Comment[cs]=Doplňování kódu pro Rust
-Comment[da]=Kodefuldførelse til Rust-kildekode
-Comment[de]=Vervollständigung für Rust-Quelltext
-Comment[el]=Συμπλήρωση κώδικα για πηγαίο κώδικα σε Rust
-Comment[en_GB]=Code completion for Rust source code
-Comment[es]=Terminación de código para código fuente en Rust
-Comment[et]=Rusti lähtekoodi automaatne lõpetamine
-Comment[eu]=Rust-eren iturburu koderako kode osatzea
-Comment[fi]=Koodintäydennys Rust-lähdekoodille
-Comment[fr]=Auto-complètement pour le code source Rust
-Comment[gl]=Completación automática de código Rust.
-Comment[hu]=Kódkiegészítés Rust forráskódokhoz
-Comment[ia]=Completion de codice pro le codice fonte de Rust
-Comment[id]=Penyelesaian kode untuk kode sumber Rust
-Comment[it]=Completamento del codice sorgente Rust
-Comment[ko]=Rust 코드 자동 완성
-Comment[nb]=Kodefullføring for Rust kildekode
-Comment[nl]=Code-aanvulling voor broncode in Rust
-Comment[nn]=Autofullføring for Rust-programkode
-Comment[pl]=Uzupełnianie kodu dla Rust
-Comment[pt]=Completação de código para o código em Rust
-Comment[pt_BR]=Completação de código para código-fonte em Rust
-Comment[ru]=Автодополнение исходного кода на языке Rust
-Comment[sk]=Ukončovanie kódu pre zdrojový kód Rust
-Comment[sl]=Dopolnjevanje kode za izvorno kodo Rust
-Comment[sr]=Допуњавање кода за раст изворни код
-Comment[sr at ijekavian]=Допуњавање кода за раст изворни код
-Comment[sr at ijekavianlatin]=Dopunjavanje koda za Rust izvorni kod
-Comment[sr at latin]=Dopunjavanje koda za Rust izvorni kod
-Comment[sv]=Kodkomplettering för Rust-källkod
-Comment[tr]=Rust kaynak kodu için kod tamamlama
-Comment[uk]=Доповнення коду для інструкцій мовою Rust
-Comment[x-test]=xxCode completion for Rust source codexx
-Comment[zh_CN]=Rust 源代码的代码补全
-Comment[zh_TW]=Rust 程式源碼的自動補完
diff --git a/addons/rustcompletion/kterustcompletionplugin.h b/addons/rustcompletion/kterustcompletionplugin.h
deleted file mode 100644
index 84eac6d24..000000000
--- a/addons/rustcompletion/kterustcompletionplugin.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#ifndef KTERUSTCOMPLETIONPLUGIN_H
-#define KTERUSTCOMPLETIONPLUGIN_H
-
-#include "kterustcompletion.h"
-
-#include <QUrl>
-#include <QVariant>
-
-#include <KTextEditor/Plugin>
-
-class KDirWatch;
-
-class KTERustCompletionPlugin : public KTextEditor::Plugin
-{
- Q_OBJECT
-
-public:
- explicit KTERustCompletionPlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
- ~KTERustCompletionPlugin() override;
-
- QObject *createView(KTextEditor::MainWindow *mainWindow) override;
-
- int configPages() const override;
- KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = nullptr) override;
-
- KTERustCompletion *completion();
-
- QString racerCmd() const;
- void setRacerCmd(const QString &cmd);
-
- QUrl rustSrcPath() const;
- void setRustSrcPath(const QUrl &path);
-
- bool configOk() const;
-
-private Q_SLOTS:
- void updateConfigOk();
-
-private:
- void readConfig();
- void writeConfig();
-
- KTERustCompletion m_completion;
-
- QString m_racerCmd;
- QUrl m_rustSrcPath;
- KDirWatch *m_rustSrcWatch {nullptr};
-
- bool m_configOk {false};
-};
-
-#endif
diff --git a/addons/rustcompletion/kterustcompletionpluginview.cpp b/addons/rustcompletion/kterustcompletionpluginview.cpp
deleted file mode 100644
index ab1d465dc..000000000
--- a/addons/rustcompletion/kterustcompletionpluginview.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#include "kterustcompletionpluginview.h"
-#include "kterustcompletionplugin.h"
-
-#include <QAction>
-
-#include <KActionCollection>
-#include <KLocalizedString>
-#include <KStandardAction>
-#include <KXMLGUIFactory>
-
-#include <KTextEditor/CodeCompletionInterface>
-#include <KTextEditor/Document>
-#include <KTextEditor/MainWindow>
-#include <KTextEditor/View>
-
-KTERustCompletionPluginView::KTERustCompletionPluginView(KTERustCompletionPlugin *plugin, KTextEditor::MainWindow *mainWin)
- : QObject(mainWin)
- , m_plugin(plugin)
- , m_mainWindow(mainWin)
-{
- KXMLGUIClient::setComponentName(QStringLiteral("kterustcompletion"), i18n("Rust code completion"));
- setXMLFile(QStringLiteral("ui.rc"));
-
- connect(m_mainWindow, &KTextEditor::MainWindow::viewChanged, this, &KTERustCompletionPluginView::viewChanged);
- connect(m_mainWindow, &KTextEditor::MainWindow::viewCreated, this, &KTERustCompletionPluginView::viewCreated);
-
- foreach(KTextEditor::View *view, m_mainWindow->views()) {
- viewCreated(view);
- }
-
- auto a = actionCollection()->addAction(QStringLiteral("rust_find_definition"), this, SLOT(goToDefinition()));
- a->setText(i18n("Go to Definition"));
-
- viewChanged();
-
- m_mainWindow->guiFactory()->addClient(this);
-}
-
-KTERustCompletionPluginView::~KTERustCompletionPluginView()
-{
-}
-
-void KTERustCompletionPluginView::goToDefinition()
-{
- KTextEditor::View *activeView = m_mainWindow->activeView();
-
- if (!activeView) {
- return;
- }
-
- const KTextEditor::Document *document = activeView->document();
- const KTextEditor::Cursor cursor = activeView->cursorPosition();
-
- QList<CompletionMatch> matches = m_plugin->completion()->getMatches(document,
- KTERustCompletion::FindDefinition, cursor);
-
- if (matches.count()) {
- const CompletionMatch &match = matches.at(0);
-
- if (!(match.line != -1 && match.col != -1)) {
- return;
- }
-
- KTextEditor::Cursor def(match.line, match.col);
-
- if (match.url == document->url()) {
- activeView->setCursorPosition(def);
- } else if (match.url.isValid()) {
- KTextEditor::View *view = m_mainWindow->openUrl(match.url);
-
- if (view) {
- view->setCursorPosition(def);
- }
- }
- }
-}
-
-void KTERustCompletionPluginView::viewChanged()
-{
- const KTextEditor::View *activeView = m_mainWindow->activeView();
-
- auto a = actionCollection()->action(QStringLiteral("rust_find_definition"));
-
- if (a) {
- bool isRust = isRustView(activeView);
- a->setEnabled(isRust);
- a->setVisible(isRust);
- }
-}
-
-void KTERustCompletionPluginView::viewCreated(KTextEditor::View *view)
-{
- connect(view->document(), &KTextEditor::Document::documentUrlChanged,
- this, &KTERustCompletionPluginView::documentChanged,
- Qt::UniqueConnection);
- connect(view->document(), &KTextEditor::Document::highlightingModeChanged,
- this, &KTERustCompletionPluginView::documentChanged,
- Qt::UniqueConnection);
-
- registerCompletion(view);
-}
-
-void KTERustCompletionPluginView::viewDestroyed(QObject *view)
-{
- m_completionViews.remove(static_cast<KTextEditor::View *>(view));
-}
-
-void KTERustCompletionPluginView::documentChanged(KTextEditor::Document *document)
-{
- foreach(KTextEditor::View *view, document->views()) {
- registerCompletion(view);
- }
-}
-
-void KTERustCompletionPluginView::registerCompletion(KTextEditor::View *view) {
- bool registered = m_completionViews.contains(view);
- bool isRust = isRustView(view);
-
- KTextEditor::CodeCompletionInterface *cci = qobject_cast<KTextEditor::CodeCompletionInterface *>(view);
-
- if (!cci) {
- return;
- }
-
- if (!registered && isRust) {
- cci->registerCompletionModel(m_plugin->completion());
- m_completionViews.insert(view);
-
- connect(view, &KTextEditor::View::destroyed, this,
- &KTERustCompletionPluginView::viewDestroyed,
- Qt::UniqueConnection);
- }
-
- if (registered && !isRust) {
- cci->unregisterCompletionModel(m_plugin->completion());
- m_completionViews.remove(view);
- }
-}
-
-bool KTERustCompletionPluginView::isRustView(const KTextEditor::View *view)
-{
- if (view) {
- return (view->document()->url().path().endsWith(QLatin1String(".rs")) ||
- view->document()->highlightingMode() == QLatin1String("Rust"));
- }
-
- return false;
-}
diff --git a/addons/rustcompletion/kterustcompletionpluginview.h b/addons/rustcompletion/kterustcompletionpluginview.h
deleted file mode 100644
index 47d1df11c..000000000
--- a/addons/rustcompletion/kterustcompletionpluginview.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2015 by Eike Hein <hein at kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
- ***************************************************************************/
-
-#ifndef KTERUSTCOMPLETIONPLUGINVIEW_H
-#define KTERUSTCOMPLETIONPLUGINVIEW_H
-
-#include <QObject>
-#include <QSet>
-
-#include <KXMLGUIClient>
-
-class KTERustCompletionPlugin;
-
-namespace KTextEditor
-{
-class Document;
-class MainWindow;
-class View;
-}
-
-class KTERustCompletionPluginView : public QObject, public KXMLGUIClient
-{
- Q_OBJECT
-
-public:
- KTERustCompletionPluginView(KTERustCompletionPlugin *plugin, KTextEditor::MainWindow *mainWindow);
- ~KTERustCompletionPluginView() override;
-
-private Q_SLOTS:
- void goToDefinition();
- void viewChanged();
- void viewCreated(KTextEditor::View *view);
- void viewDestroyed(QObject *view);
- void documentChanged(KTextEditor::Document *document);
-
-private:
- void registerCompletion(KTextEditor::View *view);
-
- static bool isRustView(const KTextEditor::View *view);
-
- KTERustCompletionPlugin *m_plugin;
- KTextEditor::MainWindow *m_mainWindow;
- QSet<KTextEditor::View *> m_completionViews;
-};
-
-#endif
diff --git a/addons/rustcompletion/plugin.qrc b/addons/rustcompletion/plugin.qrc
deleted file mode 100644
index fb143f43b..000000000
--- a/addons/rustcompletion/plugin.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE RCC>
-<RCC version="1.0">
- <qresource prefix="/kxmlgui5/kterustcompletion">
- <file>ui.rc</file>
- </qresource>
-</RCC>
diff --git a/addons/rustcompletion/ui.rc b/addons/rustcompletion/ui.rc
deleted file mode 100644
index 2e52d07ab..000000000
--- a/addons/rustcompletion/ui.rc
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE kpartgui>
-<gui name="kterustcompletion" library="kterustcompletion" version="1" translationDomain="kterustcompletion">
- <MenuBar>
- <Menu name="edit">
- <text>&Edit</text>
- <Separator/>
- <Action name="rust_find_definition"/>
- <Separator/>
- </Menu>
- </MenuBar>
- <Menu name="ktexteditor_popup" noMerge="1">
- <Separator/>
- <Action name="rust_find_definition"/>
- <Separator/>
- </Menu>
-</gui>
-<!-- kate: space-indent on; indent-width 4; replace-tabs on; -->
diff --git a/doc/kate/lumen-calltips.png b/doc/kate/lumen-calltips.png
deleted file mode 100644
index 1d9d7f447..000000000
Binary files a/doc/kate/lumen-calltips.png and /dev/null differ
diff --git a/doc/kate/lumen-completition-overload.png b/doc/kate/lumen-completition-overload.png
deleted file mode 100644
index 1c4ab057b..000000000
Binary files a/doc/kate/lumen-completition-overload.png and /dev/null differ
diff --git a/doc/kate/lumen-completition.png b/doc/kate/lumen-completition.png
deleted file mode 100644
index 8ba879c1f..000000000
Binary files a/doc/kate/lumen-completition.png and /dev/null differ
diff --git a/doc/kate/lumen-import.png b/doc/kate/lumen-import.png
deleted file mode 100644
index f4d673508..000000000
Binary files a/doc/kate/lumen-import.png and /dev/null differ
diff --git a/doc/kate/plugins.docbook b/doc/kate/plugins.docbook
index dc05d5c6f..a74593e3d 100644
--- a/doc/kate/plugins.docbook
+++ b/doc/kate/plugins.docbook
@@ -76,10 +76,6 @@ simple &gdb; frontend</para>
</listitem>
-->
<listitem>
-<para><link linkend="kate-application-plugin-lumen">Lumen</link> - Lumen
-Autocompletion Plugin for D, using the DCD autocompletion server</para>
-</listitem>
-<listitem>
<para><link linkend="kate-application-plugin-openheader">Open Header</link>
- Opens the corresponding .h/[.cpp|.c] file</para>
</listitem>
@@ -90,8 +86,8 @@ Autocompletion Plugin for D, using the DCD autocompletion server</para>
<para>Replicode - Constructivist AI language and runtime</para>
</listitem>
<listitem>
-<para><link linkend="kate-application-plugin-rust">Rust code completion</link>
-- Code completion for Rust source code</para>
+<para><link linkend="kate-application-plugin-lspclient">LSP Client</link>
+- LSP client providing code navigation and code completion for many languages</para>
</listitem>
<listitem>
<para><link linkend="kate-application-plugin-searchinfiles">Search & Replace</link> -
@@ -1398,71 +1394,6 @@ writing much of this section.</para>
</sect1>
-<sect1 id="kate-application-plugin-lumen">
-<!-- https://kate-editor.org/2014/02/20/lumen-a-code-completion-plugin-for-the-d-programming-language/ -->
-<title>Lumen Plugin</title>
-
-<para>Lumen is a plugin providing code-completion for the <ulink url="https://en.wikipedia.org/wiki/D_(programming_language)">
-D programming language</ulink>. It is just a connection between the editor and the D Completion
-Daemon (a server providing all the information) called DCD. The plugin currently supports
-all major features of the completion server: feeding the server with import files,
-displaying documentation and several types of completion:
-</para>
-
-<para>Imports:</para>
-<screenshot id="screenshot-lumen-import">
-<screeninfo>Imports</screeninfo>
-<mediaobject>
-<imageobject><imagedata fileref="lumen-import.png" format="PNG"/></imageobject>
-</mediaobject>
-</screenshot>
-
-<para>Basic Completion:</para>
-<screenshot id="screenshot-lumen-completion">
-<screeninfo>Basic Completion</screeninfo>
-<mediaobject>
-<imageobject><imagedata fileref="lumen-completition.png" format="PNG"/></imageobject>
-</mediaobject>
-</screenshot>
-
-<para>Completion (overloaded Function):</para>
-<screenshot id="screenshot-lumen-completitionoverload">
-<screeninfo>Completion (overloaded Function)</screeninfo>
-<mediaobject>
-<imageobject><imagedata fileref="lumen-completition-overload.png" format="PNG"/></imageobject>
-</mediaobject>
-</screenshot>
-
-<para>Calltips:</para>
-<screenshot id="screenshot-lumen-calltips">
-<screeninfo>Calltips</screeninfo>
-<mediaobject>
-<imageobject><imagedata fileref="lumen-calltips.png" format="PNG"/></imageobject>
-</mediaobject>
-</screenshot>
-
-<para>To make Lumen work you have to install DCD, using the information provided by
-the <ulink url="https://dlang.org/">D community</ulink>.
-</para>
-
-<para>After installing DCD edit <filename>~/.config/dcd/dcd.conf</filename> (create if it does not exist already)
-and add a path to your D include/import files ⪚ <filename class="directory">/usr/include/dlang/dmd</filename>
-or <filename class="directory">/usr/include/d</filename>.
-</para>
-
-<para>Furthermore Lumen will try to read a <filename>.lumenconfig</filename> in every parent folder
-of the currently opened D source file and add every line in this file as include path to the
-DCD server. Add all dependencies of your current project to this file.
-</para>
-
-<para>Now start the completion server with <command>dcd-server</command>, enable the Lumen
-plugin in your settings and you will have code completion for the D programming
-language in &kate;
-</para>
-
-</sect1>
-
-
<sect1 id="kate-application-plugin-openheader">
<title>Open Header Plugin</title>
@@ -1842,19 +1773,19 @@ context menu Project->Lookup:xxx
<!--FIXME Replicode
Projects Replicode run / stop-->
-<sect1 id="kate-application-plugin-rust">
-<!--https://blogs.kde.org/2015/05/18/basic-code-completion-rust-kdes-kate-and-later-kdevelop
-https://blogs.kde.org/2015/05/22/updates-kates-rust-plugin-syntax-highlighting-and-rust-source-mime-type-->
-<title>Rust code completion Plugin</title>
+<sect1 id="kate-application-plugin-lspclient">
+<title>LSP Client Plugin</title>
-<para>This plugin provides code completion for the <ulink url="https://www.rust-lang.org/">Rust</ulink>
-programming language.</para>
+<para>The LSP Client plugin provides many language features such as code completion, code navigation or finding references
+based on the <ulink url="https://microsoft.github.io/language-server-protocol/">Language Server Protocol</ulink>.</para>
-<para>Once you have enabled the Rust code completion item in the plugin page, a new
-page will appear in your &kate; configuration dialog.
+<para>Once you have enabled the LSP Client in the plugin page, a new
+page called LSP Client will appear in your &kate; configuration dialog.
</para>
-<screenshot id="screenshot-rust-configuration">
+<!--TODO: Supported languages, describe features and actions a bit -->
+
+<!--<screenshot id="screenshot-rust-configuration">
<screeninfo>Rust Configuration</screeninfo>
<mediaobject>
<imageobject><imagedata fileref="rust-configuration.png" format="PNG"/></imageobject>
@@ -1884,7 +1815,7 @@ in the context menu. You can configure a keyboard shortcut for it as well.
<para>This action will open the document containing the definition if needed, activate
its view and place the cursor at the start of the definition.
-</para>
+</para>-->
</sect1>
diff --git a/doc/kate/rust-completion.png b/doc/kate/rust-completion.png
deleted file mode 100644
index 276b251f3..000000000
Binary files a/doc/kate/rust-completion.png and /dev/null differ
diff --git a/doc/kate/rust-configuration.png b/doc/kate/rust-configuration.png
deleted file mode 100644
index 6bc4c7e0e..000000000
Binary files a/doc/kate/rust-configuration.png and /dev/null differ
More information about the kde-doc-english
mailing list