Use eslint_d as formatter in efm #8
Locked
rafaelderolez
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
@rafaelderolez I think this is a very reasonable idea. In fact, I was using efm for eslint formatting as well just a few weeks ago and I do find the need to choose between the two annoying as well. Since I imagine a lot of people are still using efm for both prettier and eslint, it might be prudent to add support for that. I'll drum up a couple of issues to track. But first the biggest question is how to expose that? Write documentation to change the code directly...? Or how would you feel about a simple config file where you could define some basic settings? Something like below: -- config.lua
local config = require('cosmic.config')
config.lsp.format_on_save = true -- enable format on save
config.lsp.servers.eslint = false -- disable eslint lsp
config.lsp.servers.efm.format = {'eslint', 'prettier'} -- chose formatters (will use eslint_d and prettierd) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For the past few years, I've always used eslint configs that contain the Prettier config. This means I'm not using Prettier directly as a formatter.
As a test, I've added this (stolen from here) to
lua/cosmic/lsp/providers/efm.lua
:The above seems to work well, but it means that both options from
:lua vim.lsp.buf.formatting()
now end up doing the same thing. Would there be a way to 'turn off' the eslint one? Does it make sense to do so? I'd also like to set up formatting on save somewhere this week. Would be nice to find some common ground here and maybe bake it into Cosmic if you're interested.Beta Was this translation helpful? Give feedback.
All reactions