Replies: 3 comments 1 reply
-
The formatter is part of the language server and is dispatched according to the language server protocol. Disabling it won't allow you to use stylua. The correct approach is to select a specific formatter through the LSP client. You need to look up the relevant documentation for the editor you're using. |
Beta Was this translation helpful? Give feedback.
-
In lua-language-server, I can disable the built-in formatter by setting format.enable = false. This allows formatting to fall back to an external tool like stylua. -- Example for lua-language-server
settings = {
Lua = {
format = {
enable = false,
},
},
} I can't find an equivalent option in this language server. The only alternative is to modify the LSP client capabilities in my Neovim configuration, which is much less convenient and harder to manage. Could you please add a similar setting to disable the built-in formatter? |
Beta Was this translation helpful? Give feedback.
-
This option in luals was added when formatting was first implemented and not yet stable, allowing it to be enabled or disabled by default through a configuration option, but this wasn't my original intention. From a personal perspective, since this is the formatting feature I implemented, why would I allow it to be disabled in my project? Of course, this is a very subjective and unreasonable thought on my part. From a technical perspective, the current language server capability registration cannot come from configuration, because it registers capabilities first, then initializes the entire language server. Unless I implement dynamic registration, but not all language servers client support dynamic registration. For features that I don't have a strong desire to implement, my suggestion is that you implement it yourself and submit a PR. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Havn't find option in config files to disable the formatting. Need to keep stylua for now.
Beta Was this translation helpful? Give feedback.
All reactions