prettier / vim-prettier

A Vim plugin for Prettier
MIT License
1.78k stars 138 forks source link

Formatting HTML templates for Angular uses html parser instead of angular parser #250

Open Kezo opened 4 years ago

Kezo commented 4 years ago

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

What is the current/expected behavior? Setting g:prettier#config#parser to empty string should let prettier decide on the parser. Instead, when editing html files, the parser seems to always be set to html. This is a problem when editing Angular templates.

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

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

What is your prettier executable path - (output of :PrettierCliPath) ? Absolute path to the project's node_modules/.bin/prettier

Did this work in previous versions of vim-prettier and/or prettier ? Haven't tested

I solved this locally by just removing lines 1-8 of ftplugin/html.vim, that for some reason sets the parser to html as soon as the file is an html file, seemingly disregarding the setting of g:prettier#config#parser. I am guessing those lines were there for a reason, however.

PROgram52bc commented 4 years ago

setting g:prettier#config#parser does not seem to alter the underlying parser on my machine, either.

daelmaak commented 4 years ago

I think the 'html' parser option doesn't have to be set manually at all since prettier should infer it itself https://prettier.io/blog/2018/11/07/1.15.0.html