Creating a pluging to integrate my LSP with CLion (Formatting issues)

I'm having problems integrating my LSP with CLion plugins. I'm able to use the goToDefinition feature, but when I reformat the code, nothing is sent to the LSP. So, my question is the following:

Do I need to configure something to allow the CLion LSP client to send `textDocument/formatting` request to my LSP?

PD: I'm following the integration example of Prisma LSP. But they don't use the formatting from the LSP, instead they use a dedicated script that does the formatting.

Thx in advance.



First of all please make sure you have LSP API source code available in your project. It contains useful documentation. See the red banner on this page if you don't see the sources yet.

Once you have the source code set up, please see the documentation for LspServerDescriptor#getLspFormattingSupport and LspFormattingSupport#shouldFormatThisFileExclusivelyByServer

Please comment if it helps or if you have any other questions.


P.S. Feel free to join JetBrains Platform Slack. You may ask questions like this in the #intellij-platform channel there.

It helped me, I didn't notice that I could override the methods in the LspServerDescriptor class. Thank.

Btw, where I can see the documentation for these classes?


Right in the IDE, in your plugin project. The mentioned red banner should help. Make sure you are using the latest version of the gradle-intellij-plugin


I was not sure how to `Choose Sources`, but I just figured it out, thx for the help