Skip to content

Default prettyhtml formatter doesn't always preserve whitespace #1018

Open
@chrisvfritz

Description

@chrisvfritz
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Independent
  • Vetur version: 0.14.3
  • VS Code version: 1.30.0-insiders

Problem

The default prettyhtml formatter doesn't seem to respect strict whitespace preservation in some cases.

Reproducible Case

For example:

<h1>
  404
  <template v-if="resource">
    the {{ resource }} was
  </template>
  not found
</h1>

reformats to:

<h1>
  404
  <template v-if="resource">the {{ resource }} was</template>not found
</h1>

Which may render as:

the user wasnot found

As a sidenote, I'd prefer prettyhtml not to move independent nodes onto the same line when I specifically put them on separate lines. Prettier is also fixing the same problem here.

Also tagging @StarpTech.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions