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

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

Closed
2 of 4 tasks
infinnie opened this issue Nov 13, 2020 · 6 comments
Closed
2 of 4 tasks

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

infinnie opened this issue Nov 13, 2020 · 6 comments

Comments

@infinnie
Copy link

infinnie commented Nov 13, 2020

  • 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:
prettier/prettier#8067

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

Reproducible Case

@yoyo930021
Copy link
Member

yoyo930021 commented 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.

@yoyo930021
Copy link
Member

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

@infinnie
Copy link
Author

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

But why does it affect the generated code?

@yoyo930021
Copy link
Member

yoyo930021 commented 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.

@xianghongai
Copy link

Command 'Vetur: Restart VLS (Vue Language Server)' resulted in an error (command 'vetur.restartVLS' not found)

@xianghongai
Copy link

The Vue Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

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

No branches or pull requests

3 participants