[utilities/kate] addons/lspclient: lspclient: fix parseCompletionItem operating on empty objects

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

lspclient: fix parseCompletionItem operating on empty objects

GetJsonObjectForKey always returns an object, even if there's none, making the `textEdit.IsObject()` check always be true

This fixes auto-import on completions not working on typescript 7.0 language server, because operating on the dummy empty object caused kate to return ranges with -1 character and line
which the language server would reject

M  +1    -1    addons/lspclient/lspclientserver.cpp

https://invent.kde.org/utilities/kate/-/commit/6ec8d51b04bfe1a5fed73227076d3d7a8038f3f3

diff --git a/addons/lspclient/lspclientserver.cpp b/addons/lspclient/lspclientserver.cpp
index a995699cd1..10a0386723 100644
--- a/addons/lspclient/lspclientserver.cpp
+++ b/addons/lspclient/lspclientserver.cpp
@@ -858,7 +858,7 @@ static LSPCompletionItem parseCompletionItem(const rapidjson::Value &item)
     }
     auto insertText = GetStringValue(item, "insertText");
     LSPTextEdit lspTextEdit;
-    const auto &textEdit = GetJsonObjectForKey(item, "textEdit");
+    const auto &textEdit = GetJsonValueForKey(item, "textEdit");
     if (textEdit.IsObject()) {
         // Not a proper implementation of textEdit, but a workaround for KDE bug #445085
         auto newText = GetStringValue(textEdit, "newText");
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.