*** If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports Please remove this comment after reading and before submitting - thanks! *** SUMMARY STEPS TO REPRODUCE 1. create a react app with typescript template 2. try to format one of .tsx files SOFTWARE/OS VERSIONS Linux/KDE Plasma: Endeavouros KDE Plasma Version: 6.2.2 KDE Frameworks Version: 6.7.0 Qt Version: 6.8 ADDITIONAL INFORMATION LSP extension does not format .tsx files correctly. I have contacted the authors of LSP and they said the parameter is not passed correctly to the server.
Testing locally to fix a related issue (the typescript language server highlighting all TSX tags as errors), and inspecting the messages sent to the language server, it seems like Kate sends "languageId": "typescript" instead of "languageId": "typescriptreact". Reverting https://invent.kde.org/utilities/kate/-/merge_requests/1349 and sending no languageId, would work, since https://github.com/typescript-language-server/typescript-language-server/pull/799 made the result of that be a warning and not an error in typescript-language-server 4.1.1 and above. However, it would seems like adding the following local LSP configuration can get things working even better, without even triggering the warning: ``` { "servers": { "javascript": { "highlightingModeRegex": "^JavaScript$" }, "javascriptreact": { "use": "javascript", "highlightingModeRegex": "^JavaScript React.+$" }, "typescript": { "use": "javascript", "highlightingModeRegex": "^TypeScript$" }, "typescriptreact": { "use": "javascript", "highlightingModeRegex": "^TypeScript React.+$" } } } ```
If that are the proper ids, we can adapt that upstream.
The LSP Specification for TextDocumentItem (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocumentItem) has a table of recommended languageId-s, including: Language Identifier JavaScript javascript JavaScript React javascriptreact TypeScript typescript TypeScript React typescriptreact So yes, it would appear that those are the correct languageId-s.
(In reply to Christoph Cullmann from comment #2) > If that are the proper ids, we can adapt that upstream. The error is gone with this config but still LSP document format does work for .tsx files.
Git commit a40abe2cc608dca520d61e536c85a43d00848871 by Christoph Cullmann. Committed on 17/11/2024 at 19:02. Pushed by cullmann into branch 'master'. fix language ids for javascript derivates M +10 -2 addons/lspclient/settings.json https://invent.kde.org/utilities/kate/-/commit/a40abe2cc608dca520d61e536c85a43d00848871
Thanks for testing this.
Git commit 97da9d2e357b4b46cd7a6f74be654710edb06fd5 by Christoph Cullmann. Committed on 23/11/2024 at 15:18. Pushed by cullmann into branch 'release/24.12'. fix language ids for javascript derivates (cherry picked from commit a40abe2cc608dca520d61e536c85a43d00848871) Co-authored-by: Christoph Cullmann <christoph@cullmann.io> M +10 -2 addons/lspclient/settings.json https://invent.kde.org/utilities/kate/-/commit/97da9d2e357b4b46cd7a6f74be654710edb06fd5