prettier-plugin-erb icon indicating copy to clipboard operation
prettier-plugin-erb copied to clipboard

Prettier: failed to parse buffer on html.erb file with vim editor

Open kevinhq opened this issue 4 years ago • 4 comments

Details: I install it using npm, and confirm it by running npm list:

k@ /Users/k
├── @prettier/[email protected]
├── [email protected]
└── [email protected]

But, when I run :Prettier on vim opening html.erb editor, it gets the error: Prettier: failed to parse buffer

On .rb file (which is supported by plugin-ruby itself), it works.

Any idea how to fix this?

kevinhq avatar Feb 22 '21 13:02 kevinhq

Hey :wave: Could you run ./node_modules/.bin/prettier --check . --color and see if html.erb files get picked up? Are there any errors?

adamzapasnik avatar Feb 22 '21 18:02 adamzapasnik

hi.

no error. html.erb get picked up, and I see warns about [warn] Code style issues found in the above file(s). Forgot to run Prettier?

Complete output:

Checking formatting...
[warn] app/views/events/index.html.erb
[warn] Code style issues found in the above file(s). Forgot to run Prettier?

kevinhq avatar Feb 26 '21 12:02 kevinhq

Thanks. It doesn't seem like a problem with the plugin? I'm not sure what is the problem as I haven't use vim prettier plugin.

Maybe you could open up an issue there https://github.com/prettier/vim-prettier and they would point us towards a solution?

adamzapasnik avatar Mar 02 '21 13:03 adamzapasnik

@kevinhq I would try the amazing vim ALE plugin with Prettier to rule out issues with your local env. Try to set Prettier as your ALE fixer, and then use :ALEFix. I use this and don't have any issues.

evenreven avatar May 17 '21 18:05 evenreven