Open FalsePattern opened 2 months ago
Same issue than https://github.com/redhat-developer/lsp4ij/issues/388
As a temporary workaround until this is solved, I have added a proxy service that bypasses the AbstractLSPFormattingService.canFormat
checks for Zig: https://github.com/FalsePattern/ZigBrains/blob/master/modules/zig/src/main/java/com/falsepattern/zigbrains/zig/formatter/ZigAbstractLSPFormattingServiceProxy.java, this seems to fix the issue for ZB.
In AbstractLSPFormattingService,
canFormat
checks for the presence of a LanguageFormatting implementation for a language, and if present, doesn't invoke the LSP formatter.In the case of ZigBrains, I used both the LSP formatter for manual formatting via ZLS when invoking the formatting action, as well as the intellij autoformatter for correct auto-indentation when creating new lines or code blocks. If the zigbrains
lang.formatter
is removed, auto-indentation breaks, but the ZLS formatter functions.