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: Upon running prettier on PUG files space before and after 'a' tag disappear #417

Closed
serferdinand2 opened this issue Oct 21, 2022 · 6 comments · Fixed by #418
Closed
Assignees

Comments

@serferdinand2
Copy link

serferdinand2 commented Oct 21, 2022

Exapmple

Code below:

p Please click 
        a(example.com) here
        |  to go to our link.

changes upon running prettier to :

p Please click
      a(example.com) here
       | to go to our link.

The extra space just after the 'click' and after the pipe symbol is removed and the result is:

Please clickhereto go to our link.

And it should be:

Please click here to go to our link.

@Shinigami92
Copy link
Member

I think you are running into this: https://pugjs.org/language/plain-text.html#not-recommended
I suggest to rewrite your pug code to what is recommended: https://pugjs.org/language/plain-text.html#recommended-solutions

Please close this issue if that solved your problem, otherwise let me know why this couldn't help.

@jwerre
Copy link
Contributor

jwerre commented Oct 21, 2022

@Shinigami92 Isn't the the point of Prettier, to make your code conform to best practices? Feels like this is something that should be fixed with this extension.

@Shinigami92
Copy link
Member

I agree to some point, but it could be that the lexer behind could return totally different result of tokens 🤔
Would someone of you want to try that out with writing a test in the tests/issues folder and open a PR for it?

@jwerre
Copy link
Contributor

jwerre commented Oct 21, 2022

Ya, I can do that

@jwerre
Copy link
Contributor

jwerre commented Oct 21, 2022

Ok.. I made the test. I'll let you all figure out how to pass them. Good luck :)

@Shinigami92
Copy link
Member

Thank you, might not have the time today, but hopefully over weekend 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants