[utilities/kate] addons/lspclient: lspclient: use labelDetails when completion detail is empty

Christoph Cullmann <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 78d9803342c8fc042b5962d6865379c92b3f085d by Christoph Cullmann, on behalf of leia uwu.
Committed on 30/07/2026 at 21:28.
Pushed by cullmann into branch 'master'.

lspclient: use labelDetails when completion detail is empty

typescript 7 LSP sends the completion import source on `CompletionItem.labelDetails.description` instead of `CompletionItem.details`

M  +9    -0    addons/lspclient/lspclientserver.cpp

https://invent.kde.org/utilities/kate/-/commit/78d9803342c8fc042b5962d6865379c92b3f085d

diff --git a/addons/lspclient/lspclientserver.cpp b/addons/lspclient/lspclientserver.cpp
index 10a0386723..e8f0c6d056 100644
--- a/addons/lspclient/lspclientserver.cpp
+++ b/addons/lspclient/lspclientserver.cpp
@@ -846,6 +846,14 @@ static LSPCompletionItem parseCompletionItem(const rapidjson::Value &item)
 
     auto label = GetStringValue(item, MEMBER_LABEL);
     auto detail = GetStringValue(item, MEMBER_DETAIL);
+
+    if (detail.isEmpty()) {
+        const auto &labelDetail = GetJsonValueForKey(item, "labelDetails");
+        if (labelDetail.IsObject()) {
+            detail = GetStringValue(labelDetail, "description");
+        }
+    }
+
     LSPMarkupContent doc;
     auto it = item.FindMember(MEMBER_DOCUMENTATION);
     if (it != item.MemberEnd()) {
@@ -1819,6 +1827,7 @@ private:
                                             {QLatin1String("completion"), QJsonObject{
                                                 {QLatin1String("completionItem"), QJsonObject{
                                                     {QLatin1String("snippetSupport"), m_config.caps.snippetSupport},
+                                                    {QLatin1String("labelDetailsSupport"), true},
                                                     {QLatin1String("resolveSupport"), QJsonObject{
                                                         {QLatin1String("properties"), QJsonArray{
                                                             QLatin1String("additionalTextEdits"),
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.