Closed MaximilianGaedig closed 1 year ago
This is not how you should do it.
There are 2 options.
To completely disable an LSP from formatting, don't call lsp-formats attach function for that LSP at all.
To exclude an LSP for specific filetypes, use :help lsp-format-exclude
This is not how you should do it.
There are 2 options.
- To completely disable an LSP from formatting, don't call lsp-formats attach function for that LSP at all.
- To exclude an LSP for specific filetypes, use
:help lsp-format-exclude
ah yeah true the exclusion should be done differently, but what about the eslint enabling? Is there a better solution?
but what about the eslint enabling
There is no concept of enabling in lsp-format. When you attach a server, and it is not explicitly excluded, it is enabled.
but what about the eslint enabling
There is no concept of enabling in lsp-format. When you attach a server, and it is not explicitly excluded, it is enabled.
the server has to have that "document/textFormatting" ability tho, and eslint has that but doesn't report it, so you need to override it
this is more of a eslint server problem but it has a workaround which doesn't work on lsp-formatter because it checks for document/textFormatting instead of just executing the command for a format
I understand. Yeah this is a problem with the eslint LSP server. I don't have any better suggestion than what you are already doing
Thank you very much for creating this plugin :)
I was configuring it today and I ran into some problems enabling eslint (and disabling tsserver) for formatting, but finally found a solution and wanted to share it as other people might run into the same problem. I had to add
in my on_attach function, then eslint was enabled, tsserver had to be disabled because otherwise eslint ran first and it corrected its issues then tsserver formatted the file while ignoring my eslint rules. Such problems were documented already but this plugin required a bit of a different solution as the solution normally was to set
document_formatting
instead ofdocumentFormattingProvider
.This seems a bit hacky, so if there is a better solution please tell me!