question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The Prettier bundled in Vetur for Visual Studio Code is out of date.

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ
  • I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform: Windows
  • Vetur version: 0.30.1
  • VS Code version: 1.51.1

Problem

Create a Vue file and fill its <style> tag with a CSS rule that includes a background shorthand:

<style>
.a {
    background: #fff url(/a.jpg) 50px calc(100% + 2px) no-repeat
}
</style>

Then format document. The above code would be formatted to:

<style>
.a {
  background: #fff url(/a.jpg)50pxcalc(100% + 2px)no-repeat;
}
</style>

It may have something to do with the fact that the Prettier bundled is out of date. A similar problem used to occur in Glitch: https://github.com/prettier/prettier/issues/8067

However, quoting the URL can keep the rule above correctly formatted.

Reproducible Case

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yoyo930021commented, Nov 13, 2020

Hmm, Probably is a esbuild minify problem. yarn watch is ok. yarn compile is wrong.

But why does it affect the generated code?

Reason: https://esbuild.github.io/api/#keep-names

I found a key about this problem. I fixed it and add a test.

1reaction
yoyo930021commented, Nov 13, 2020

This problem isn’t out of date prettier, We use v2.1.2 version with prettier. but rather when passing the search plugin folder to prettier. I need time to study the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier - Code formatter - Visual Studio Marketplace
Prettier Formatter for Visual Studio Code. Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code ...
Read more >
How to reformat a Vue.js component in VS Code?
Here's what I think the current state of the art is: Use extensions vetur and prettier (specifically, esbenp.prettier-vscode Prettier - Code ...
Read more >
How I Resolved Vue.js, VSCode, Vetur, Prettyhtml, and ...
Prettier is out because it always wraps attributes - without a way to disable it. Prettyhtml can disable the attribute wrap, but it...
Read more >
Source - GitHub
Bracket pair colorization support for VSCode 1.60+. Thanks to contribution from ... Stop computing outdated diagnostics with CancellationToken.
Read more >
Vue.js Single Page Application with ASP.NET MVC 5 - kleypot
Finally, if we run the debugger in Visual Studio, we should see the ... Now we have Vue and webpack working, but our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found