https://bugs.kde.org/show_bug.cgi?id=506664
Bug ID: 506664
Summary: kate sends requests to the Language Server that it did
not announce support for the feature
Classification: Applications
Product: kate
Version First 25.04.2
Reported In:
Platform: Other
OS: Other
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
The `kate` editor sends LSP requests to the language server without any regards
for the server capabilities.
STEPS TO REPRODUCE
1. Open a file format with a language server that does not support
`textDocument/definition` or/and `workspace/symbol` or/and
`textDocument/rangeFormatting`
2a. To trigger `textDocument/definition`, I am not entirely sure what does it.
It sometimes just appear while I am working. I am suspecting copy-paste (`CTRL
+ C`) or scrolling. However, I cannot figure out a reliable trigger - just that
it happens "often" while I work on the document.
2b. To trigger `workspace/symbol`, use the `Search and Go to symbol` feature
(Right click in the doc, Expand `LSP Client`, then pick the `Search and Go to
symbol` ).
2c. To trigger `textDocument/rangeFormatting`, I had the `kate` setup to use
the language server for formatting, with `Format on Save` on in the LSP
settings, then marked a range and hit `CTRL+S`. Probably there is a simpler way
to trigger this.
Note: The reproducers lists
OBSERVED RESULT
The `kate` editor will send the request to the server. The Language server will
complain about receiving a request that it does not support in the `Output` tab
(or crash or silently ignore it depending on the language server and how they
decided to implement it)
EXPECTED RESULT
The `kate` editor should not send these requests, since the server has not
announced support for them in the server capabilities. Additionally, it would
make sense for `kate` to disable UI elements that depend on this feature
without a fallback. As an example, `Search and Go to symbol` might need to be
disabled in the menu.
For `textDocument/rangeFormatting`, having `kate` fallback to format the entire
document would work for the "on save"-triggered formatting (since the language
server in question supports full document formatting). Though other instances /
ways to trigger that request might need a different strategy.
SOFTWARE/OS VERSIONS
Debian/testing version of kate (25.04.2). Though, I believe this is would not
be an OS specific issue and the LSP plugin code is in `kate` (plasma and KDE
would be irrelevant as well), so I am skipping the details.
ADDITIONAL INFORMATION
A simple example version of the `pygls` language server like
https://github.com/openlawlibrary/pygls/tree/main/examples/hello-world should
be sufficient to trigger this problem, if you need a language server without
these features.
In case it matters, the language server I used responded with the following as
its server capabilities:
pygls.protocol.json_rpc: info: Sending data: {"id": 1, "jsonrpc": "2.0",
"result": {"capabilities": {"positionEncoding": "utf-16", "textDocumentSync":
{"openClose": true, "change": 2, "save": false}, "completionProvider": {},
"hoverProvider": true, "codeActionProvider": true,
"documentFormattingProvider": true, "foldingRangeProvider": true,
"executeCommandProvider": {"commands": []}, "semanticTokensProvider":
{"legend": {"tokenTypes": ["keyword", "enumMember", "comment", "string",
"macro", "operator", "typeParameter", "variable"], "tokenModifiers": []},
"documentSelector": null, "full": true}, "inlayHintProvider":
{"resolveProvider": false}, "workspace": {"workspaceFolders": {"supported":
true, "changeNotifications": true}, "fileOperations": {}}}, "serverInfo":
{"name": "debputy", "version": "vN/A"}}}
(The version being `vN/A` is because I am using a git checkout and it does not
announce the correct version there)
--
You are receiving this mail because:
You are watching all bug changes.