Bug 491767 - LSP extension does not format .tsx files correctly.
Summary: LSP extension does not format .tsx files correctly.
Status: RESOLVED UPSTREAM
Alias: None
Product: kate
Classification: Applications
Component: application (other bugs)
Version First Reported In: 24.05.2
Platform: Fedora RPMs Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-15 22:10 UTC by Majid Madadi
Modified: 2024-08-27 20:38 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Majid Madadi 2024-08-15 22:10:46 UTC
LSP formats .ts and .js files without any problem. However it fails to format .tsx files correctly. You can reproduce this behavior with a valid .tsx file.
Comment 1 fanzhuyifan 2024-08-16 02:00:04 UTC
The LSP server is responsible for formatting the file. So if the formatting is wrong, you need to report this to the author of the relevant LSP server, or check your configuration of LSP servers.
Comment 2 Waqar Ahmed 2024-08-22 17:14:09 UTC
You can also use the Formatting plugin instead. It will use prettier for tsx files and should be able to do a much better job.
Comment 3 Majid Madadi 2024-08-27 20:38:43 UTC
The formatter plugin also does not format correctly. Here is the error message:
[00:07:10  Format Error] SyntaxError: Unexpected non-whitespace character after JSON at position 919
    at JSON.parse ()
    at Socket. (/tmp/kate.ZgzKcb:22:68)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)