vim-prettier icon indicating copy to clipboard operation
vim-prettier copied to clipboard

Vim-Prettier is using its own defaults, not the defaults from prettier (in my case, trailingComma)

Open gkoberger opened this issue 1 year ago • 1 comments

Do you want to request a feature or report a bug?

A bug

What is the current/expected behavior?

When I run vim-prettier, trailingComma is using 'es5' rather than 'all'. In 3.0.0, prettier switched the default from es5->all.

However, for some reason prettier.vim (line 125) decided to override it: https://github.com/prettier/vim-prettier/blob/master/plugin/prettier.vim#L134

This line is the problem:

let g:prettier#config#trailing_comma = get(g:,'prettier#config#trailing_comma', 'es5')

It doesn't seem to be loading the actual prettier#config#trailing_comma from prettier, so it always goes with the "default" provided in that file.

If I change es5 to all on that line, everything works (although ideally I wouldn't do it there, of course, and it would load the proper defaults from the prettier version)

What version of vim-prettier are you using - (output of :PrettierVersion) ?

1.0.0

What version of prettier are you using - (output of :PrettierCliVersion) ?

3.1.1

What is your prettier executable path - (output of :PrettierCliPath) ?

/Users/gkoberger/.nvm/versions/node/v18.18.2/bin/prettier

Did this work in previous versions of vim-prettier and/or prettier ?

Sort of. It worked because prettier hadn't yet changed the default for trailingComma. Once prettier switched the default, however, it started to be overridden by vim-prettier

gkoberger avatar Jan 11 '24 01:01 gkoberger

Do you have let g:prettier#config#config_precedence='prefer-file' in your config?

See https://github.com/prettier/vim-prettier/issues/266#issuecomment-953417529

twm avatar Aug 28 '24 04:08 twm