sbdchd / neoformat

:sparkles: A (Neo)vim plugin for formatting code.
BSD 2-Clause "Simplified" License
1.97k stars 188 forks source link

Adding `eslint_d` as valid formatter for another filetype, like "Vue" #475

Closed ndom91 closed 10 months ago

ndom91 commented 10 months ago

Seems that for "Vue" filetypes, only the prettier type formatters are enabled.

However, I want to force it to support using eslint_d. For example, running :Neoformat eslint_d on any *.vue file returns "formatter definition for eslint_d not found", while it works just fine on any *.js file.

I cuoldn't find a way to achieve this with the documented options. For example, vim.g.neoformat_enabled_vue = { 'eslint_d' } doesn't do the trick unfortunately.

ndom91 commented 10 months ago

Tried it via vim.cmd() with vimscript syntax as well, also doesn't seem to work :thinking:

vim.cmd("let g:neoformat_enabled_vue = ['eslint_d']")
ndom91 commented 10 months ago

Running :echo g:neoformat_enabled_vue does return ['eslint_d'] however and I'm still getting formatter definition for eslint_d not found when executing :Neoformat eslint_d on a *.vue file :thinking:

ndom91 commented 10 months ago

Strange, after a reboot it did start to work as expected :partying_face:

You can use this vimscript:

vim.cmd("let g:neoformat_enabled_vue = ['eslint_d']")

Or this lua

vim.g.neoformat_enabled_vue = { 'eslint_d' }