Bug 459960 - Kate LSP Client responds with ResponseMessage.id of 0 given a RequestMessage.id "some_string"
Summary: Kate LSP Client responds with ResponseMessage.id of 0 given a RequestMessage....
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 22.08.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-04 03:20 UTC by michael.burge77
Modified: 2022-10-11 18:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description michael.burge77 2022-10-04 03:20:12 UTC
SUMMARY
I were playing around with Zig [1] and installed a corresponding language server [2]
and a basic kde-syntax-highlighting zig.xml  [3]

my User Server Settings:
{
        "servers":
        {
                "zig":
                {
		"command": ["/home/workaccount/Work/zls/main/zig-out/bin/zls"],
		"url": "https://github.com/zigtools/zls",
		"highlightingModeRegex": "^Zig$"
                }
        }
}

[1] https://github.com/ziglang/zig
[2] https://github.com/zigtools/zls (ZLS)
[3] https://github.com/ziglang/kde-syntax-highlighting/blob/master/zig.xml 

STEPS TO REPRODUCE
1. have ZLS options enable_ast_check_diagnostics and enable_autofix enabled/on
2. Open a .zig file
3. Save (Ctrl+S) (trigger a textDocument/didSave)

ZLS sends a request with .id = .{ .String = "apply_edit" }
https://github.com/zigtools/zls/blob/ac6353add7b1dc5fdee25333b02d8c52e589502a/src/Server.zig#L1771

OBSERVED RESULT
Kate's LSP Client responds with ResponseMessage.id of 0

json {
       "id": 0,
       "jsonrpc": "2.0",
       "result": {
           "applied": false,
           "failureReason": ""
       }
   }

EXPECTED RESULT
a ResponseMessage with id "apply_edit"

VSCodium(VSCode) for comparison: json {"jsonrpc":"2.0","id":"apply_edit","result":{"applied":true}}

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.19.12, X11
(available in About System)
KDE Plasma Version: 5.25.5
KDE Frameworks Version:  5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
The LSP spec does allow id to be string

Thank You
Comment 1 Christoph Cullmann 2022-10-09 16:11:53 UTC
I could be wrong, but for me it looks like Kate expect the id to be some integer id, no string.

Btw., it would be great if somebody could upstream the zig hl file to syntax-highlighting and the language server spec to our kate.git.
That would make testing a lot easier.
Comment 2 Mark Nauwelaerts 2022-10-09 19:09:33 UTC
(In reply to Christoph Cullmann from comment #1)
> I could be wrong, but for me it looks like Kate expect the id to be some
> integer id, no string.

Indeed, so it does at the moment.  Will have a look at adjusting that.
Comment 3 Bug Janitor Service 2022-10-11 14:47:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/943
Comment 4 Mark Nauwelaerts 2022-10-11 18:16:28 UTC
Git commit bb551a06d537e56adf11d3c88b85c05cf4b23ec6 by Mark Nauwelaerts.
Committed on 11/10/2022 at 14:46.
Pushed by cullmann into branch 'master'.

lspclient: handle server request with string id

M  +5    -4    addons/lspclient/lspclientserver.cpp

https://invent.kde.org/utilities/kate/commit/bb551a06d537e56adf11d3c88b85c05cf4b23ec6