Vetur: Bug: formatting pug with tag interpolation

Created on 17 Sep 2020  ·  3Comments  ·  Source: vuejs/vetur

  • [x] I have searched through existing issues
  • [x] I have read through docs
  • [x] I have read FAQ

Info

  • Platform: Win
  • Vetur version: 0.27.3
  • VS Code version: 1.49

Problem

When formatting pug code, it seems that tag interpolation e.g. #[ ] is treated incorrectly.

p Click #[a.link(href='https://www.example.com' rel='noreferrer' target='_blank') here] to go somewhere

Turns into:

    p Click #[a.link(
      href='https://www.example.com'
      rel='noreferrer'
      target='_blank') here] to go somewhere

This gives a webpack build error:

  > 23|     p Click #[a.link(
-----------------------------^
    24|       href='https://www.example.com'
    25|       rel='noreferrer'
    26|       target='_blank') here] to go somewhere

The end of the string reached with no closing bracket ) found.

I think everything between #[ ] should remain on the same line.

bug prettier formatting upstream

All 3 comments

Referencing https://github.com/prettier/plugin-pug/issues/107

I created a test for this https://github.com/prettier/plugin-pug/pull/108 and it turns out that my plugin doesn't do this on its own...
So we think it's a problem with vetur 🤷‍♂️

It's Vetur's issue. I'll fix it.

Fixed #2014 and updated plugin-pug dependency.

Was this page helpful?
0 / 5 - 0 ratings