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

When formatting the vue file, the template lang='pug' node will be cleared. #2460

Closed
4 tasks done
richex-cn opened this issue Nov 12, 2020 · 13 comments
Closed
4 tasks done

Comments

@richex-cn
Copy link

richex-cn commented Nov 12, 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 10 2004
  • Vetur version: 0.30.0
  • VS Code version: 1.51.1

Problem

a

No output from the Vue Language Server output panel.
After falling back to 0.29.1, the problem no longer occurs.

@richex-cn
Copy link
Author

@yoyo930021 I installed version 0.30.1, but this problem still exists.

@yoyo930021
Copy link
Member

yoyo930021 commented Nov 13, 2020

@yoyo930021 I installed version 0.30.1, but this problem still exists.

If you restart?
Reinstall?

@richex-cn
Copy link
Author

@yoyo930021

This problem still exists in my workspace :

a

But formatting after creating a new directory to test it, is normal :

b

@yoyo930021
Copy link
Member

yoyo930021 commented Nov 13, 2020

@yoyo930021

This problem still exists in my workspace :

a

But formatting after creating a new directory to test it, is normal :

b

What is your .prettierrc file content?
And vetur.useWorkspaceDependencies?

@richex-cn
Copy link
Author

The vetur.useWorkspaceDependencies is true, and the .prettierrc.js file of the current workspace is as follows:

module.exports = {
  tabWidth: 2,
  printWidth: 80,
  semi: false,
  singleQuote: true,
  proseWrap: 'preserve',
  requirePragma: false,
  bracketSpacing: true,
  arrowParens: 'avoid',
  trailingComma: 'none'
}

@yoyo930021

@yoyo930021
Copy link
Member

yoyo930021 commented Nov 13, 2020

@richex-cn
Copy link
Author

@yoyo930021 Before installation, I uninstalled this extension and deleted the %USERPROFILE%\.vscode\extensions\octref.vetur-0.30.1\ directory. Then run code.exe --install-extension vetur-0.30.1.vsix through the command line to open VSCode, and I don't see the Vetur extension in the plug-in list, the same is true for restarting VSCode.

20201113_173416

So I using the Install from VSIX command in the Extensions view command drop-down, And completed the installation of the Vetur extension. But this problem still exists.

@yoyo930021 yoyo930021 reopened this Nov 13, 2020
@yoyo930021
Copy link
Member

Can you provide your project or any repro project?
https://github.com/vuejs/vetur/blob/master/.github/NO_REPRO_CASE.md
If you don't want to go public, you can send me an email.

If none of these,
#2468 (comment)

@richex-cn
Copy link
Author

I tried to clone the project on another device, but this problem did not occur. After trying for a while, I found that setting vetur.useWorkspaceDependencies to true will cause the problem to appear, so it should be the library introduced by the plugin or I introduced The library is caused by a problem.

This is a minimal repro case:

https://github.com/richex-cn/repro-vetur-formatting-bug-issue-2460

@IvanCaceres
Copy link

IvanCaceres commented Dec 5, 2020

I just started experiencing this issue after all formatting was working correctly all day.

Suddenly on save now it's deleting the contents of <template lang="pug">. Very frustrating for this issue to randomly appear.

I can confirm that downgrading to vetur 0.29.1 fixes the issue and deletion no longer occurs during save/format. This indicates the problem was introduced with the later vetur versions & releases.

@richex-cn
Copy link
Author

@IvanCaceres You can try the way I mentioned above, if you still can't solve it, you can communicate with @yoyo930021 .

@yoyo930021
Copy link
Member

yoyo930021 commented Dec 6, 2020

Reason: #2347 (comment)
I will close searching plugin feature and use found lib from vetur in next version.

@yoyo930021
Copy link
Member

yoyo930021 commented Dec 8, 2020

Ha, I found the problem.
In your project, it have a prettier lib but version is 1.x.x.
This version don't support plugin.

In next version, vetur use bundled prettier in this case.

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