prettier / prettier/vim-prettier

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

Open
#250 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vim Script
Stars
1.8k
Forks
137
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lines 1-8 of ftplugin/html.vim, which the report identifies as forcing the HTML parser, and inspect how that interacts with an empty g:prettier#config#parser. Verify the behavior using an HTML file containing an Angular template with vim-prettier 1.0.0-alpha and Prettier 2.0.5; done means Prettier can choose the Angular parser instead of always using HTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, vim
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.