mattn / efm-langserver

General purpose Language Server
MIT License
1.38k stars 62 forks source link

Conditional registration of linter/formatter for same language #175

Open Nargonath opened 3 years ago

Nargonath commented 3 years ago

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.

atrautsch commented 3 years ago

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

Nargonath commented 3 years ago

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? 🤔