Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Space at the end of an element causes | and newlines to be inserted #439

Closed
richardsimko opened this issue Apr 28, 2023 · 5 comments · Fixed by #442
Closed

Bug: Space at the end of an element causes | and newlines to be inserted #439

richardsimko opened this issue Apr 28, 2023 · 5 comments · Fixed by #442
Assignees
Labels
type: bug Functionality that does not work as intended/expected

Comments

@richardsimko
Copy link

richardsimko commented Apr 28, 2023

Info

Tool Version
Plugin v2.4.2
Prettier v2..8.8
Framework vue
Node v19.0.0
OS mac

Prettier config

{

}

Input

<template lang="pug">
.root //<----- extra space here
  .second
</template>

Output or Error

Insert `|⏎··`

Output after formatting:

<template lang="pug">
.root 
  |
  |
  |
  |
  |
  |
  |
  |
  |
  |
  |
  |
  |
  .second
</template>

Expected Output

.root
  .second

Additional Context

Notice there is a space after .root. If I run the formatter on the code it won't be removed leading to it creating more newlines with | every time it's run.

@Shinigami92
Copy link
Member

Related to #425

@Shinigami92 Shinigami92 added the type: bug Functionality that does not work as intended/expected label Apr 28, 2023
@richardsimko
Copy link
Author

This also seems to be a bug with plain templates:

.test 
  .inner
.test 
  |
  .inner

Each time the formatter is run an additional | is added.

@Shinigami92
Copy link
Member

@richardsimko took me a while and potentially caused some headaches 😆
but finally I fixed it 🎉

Please checkout v2.5.0
Also note that NodeJS v14 is now not supported anymore 😉

@Shinigami92
Copy link
Member

Shinigami92 commented May 6, 2023

Thanks for the fix! It does indeed seem to have fixed standalone pug files, however .vue files still suffer from the same issue.

uhm what?
the change I did was not releated to vue at all 🤔

Can you please open a new issue with example so I can track it?

@richardsimko
Copy link
Author

Thanks for the fix! Works great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants