efm-langserver icon indicating copy to clipboard operation
efm-langserver copied to clipboard

Conditional registration of linter/formatter for same language

Open Nargonath opened this issue 4 years ago • 2 comments
trafficstars

First, I'd like to thank you for the great tool.

I was not able to figure out if that's something you can already do with efm either from the issues section or the documentation. To give you a bit more context, I use NeoVim on some JavaScript projects for different companies. Some of them use eslint to lint/format their codebase and other relies on prettier as their formatter. Is there a way to give to efm multiple formatters configuration for the same language and decide based on criteria which one should be used?

FWIW I know null_ls has a similar feature: https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#conditional-registration.

Nargonath avatar Sep 29 '21 08:09 Nargonath

Would something like #112 be enough for your use case?

atrautsch avatar Sep 30 '21 05:09 atrautsch

Yes that would work. I was going to say that it'd be great if we could also support passing a callback to implement whatever logic the user wants but I guess it would not be compatible with the efm's YAML config format.

One thing perhaps that would be problematic with the proposal you referred to, is where a project uses prettier as a formatter and eslint as a linter, but in other cases also eslint as both linter and formatter. Can you declare multiple configuration of eslint for the same language? 🤔

Nargonath avatar Sep 30 '21 07:09 Nargonath