[utilities/kate/release/26.04] addons/lspclient: only add processId if we are not sandboxed
Christoph Cullmann <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit b78277d00cddb1ff8591c6ed64766db2d47ea3bb by Christoph Cullmann. Committed on 16/07/2026 at 17:27. Pushed by cullmann into branch 'release/26.04'. only add processId if we are not sandboxed with pid namespaces that will otherwise lead to issues, like existing LSP servers in Flatpak BUG: 522883 (cherry picked from commit 7a95750d9668910be24ed24df1a9c6c73aed41ef) Co-authored-by: Christoph Cullmann <[email protected]> M +11 -2 addons/lspclient/lspclientserver.cpp https://invent.kde.org/utilities/kate/-/commit/b78277d00cddb1ff8591c6ed64766db2d47ea3bb diff --git a/addons/lspclient/lspclientserver.cpp b/addons/lspclient/lspclientserver.cpp index 2a168f682b..961052d936 100644 --- a/addons/lspclient/lspclientserver.cpp +++ b/addons/lspclient/lspclientserver.cpp @@ -11,6 +11,8 @@ #include "ktexteditor_utils.h" +#include <KSandbox> + #include <QCoreApplication> #include <QFileInfo> #include <QJsonArray> @@ -1842,15 +1844,22 @@ private: // NOTE a typical server does not use root all that much, // other than for some corner case (in) requests auto root = mapPath(m_root, true); - QJsonObject params{{QLatin1String("processId"), QCoreApplication::applicationPid()}, - {QLatin1String("rootPath"), root.isValid() ? root.toLocalFile() : QJsonValue()}, + QJsonObject params{{QLatin1String("rootPath"), root.isValid() ? root.toLocalFile() : QJsonValue()}, {QLatin1String("rootUri"), root.isValid() ? QJsonValue(QString::fromUtf8(root.toEncoded())) : QJsonValue()}, {QLatin1String("capabilities"), capabilities}, {QLatin1String("initializationOptions"), m_init}}; + + // only add processId if we are not sandboxed, with pid namespaces that + // will otherwise lead to issues, like existing LSP servers in Flatpak, see bug 522883 + if (!KSandbox::isInside()) { + params[QLatin1String("processId")] = QCoreApplication::applicationPid(); + } + // only add new style workspaces init if so specified if (folders) { params[QLatin1String("workspaceFolders")] = to_json(*folders); } + write(init_request(QStringLiteral("initialize"), params), utils::mem_fun(&self_type::onInitializeReply, this)); }