Bug 473725

Summary: Kate crash if large json is opened and LSP client is enabled
Product: [Applications] kate Reporter: Pozsgay Máté <matthew.linux>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: waqar.17a
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Backtrace of crash

Description Pozsgay Máté 2023-08-24 14:33:13 UTC
Created attachment 161157 [details]
Backtrace of crash

SUMMARY
As title says. Kate cannot handle large json files lately.

STEPS TO REPRODUCE
1.  Open Kate, enable LSP client
2.  Open a large Json

OBSERVED RESULT
Crash after a couple of seconds

EXPECTED RESULT
Do not crash

SOFTWARE/OS VERSIONS
This bug is introduced not a long time ago. I usually compile kate for myself (latest master) and only getting this problem for about a month or so.
Kate version: 23.11.70
Linux/KDE Plasma: Ubuntu 22.04
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
GDB Backtrace is attached.
Comment 1 Pozsgay Máté 2023-08-24 14:35:29 UTC
Kate version 23.07.70 does not suffer from this problem.
Comment 2 Waqar Ahmed 2023-08-24 14:45:07 UTC
Which lsp server are you using / is active when you open the json file?
Comment 3 Pozsgay Máté 2023-08-24 14:50:43 UTC
I'm using the default one:
        "json": {
            "command": ["vscode-json-languageserver", "--stdio"],
            "url": "https://github.com/microsoft/vscode/tree/main/extensions/json-language-features/server",
            "highlightingModeRegex": "^JSON$"
        },

Installed via snap:
vscode-json-languageserver      1.3.4               136    latest/stable    alexmurray✪       -
Comment 4 Pozsgay Máté 2023-08-24 14:51:41 UTC
Also I can confirm if the LSP server is not accessible kate doesn't crash.
Comment 5 Waqar Ahmed 2023-08-24 15:46:24 UTC
Ok, thanks. Will be fixed soon.
Comment 6 Pozsgay Máté 2023-08-24 16:44:27 UTC
(In reply to Waqar Ahmed from comment #5)
> Ok, thanks. Will be fixed soon.

Thanks for the quck response, and the support!
Comment 7 Waqar Ahmed 2023-08-25 06:24:43 UTC
Git commit 9689a17e87813095e8b30b7970eb11f80220cc40 by Waqar Ahmed.
Committed on 25/08/2023 at 08:24.
Pushed by waqar into branch 'master'.

lsp: Fix diagnostic.code parsing

diagnostic.code can be an int or string

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

https://invent.kde.org/utilities/kate/-/commit/9689a17e87813095e8b30b7970eb11f80220cc40