gitKrystan / prettier-plugin-ember-template-tag

A prettier plugin for formatting Ember template tags
MIT License
22 stars 12 forks source link

[Bug] In v0.3.2, with invalid hbs, a newline is added before the closing <template> tag #49

Closed gitKrystan closed 1 year ago

gitKrystan commented 1 year ago

🐞 Describe the Bug

With invalid hbs, the plugin will add a newline before the closing <template> tag.

https://user-images.githubusercontent.com/14152574/216177509-2957586b-15ff-4509-809a-a5572ceacd3e.mp4

🔬 Minimal Reproduction

<template>
              {{#if oops}}
            </template>

😕 Actual Behavior

<template>
              {{#if oops}}

            </template>

A newline is added before the closing <template> tag. If format-on-save is enabled, a new newline will be added on every save!

🤔 Expected Behavior

Invalid hbs should result in Prettier being a no-op, bug logging an error:

<template>
              {{#if oops}}
            </template>
// log
SYNTAX ERROR: ...

🌍 Environment

gitKrystan commented 1 year ago

I think this issue is the cause: https://github.com/prettier/prettier-vscode/issues/691

gitKrystan commented 1 year ago

I strongly suspect this is a duplicate of https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues/42