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

Updated prettier today and html formatter no longer works #658

Closed
chanlito opened this issue Jan 18, 2018 · 12 comments
Closed

Updated prettier today and html formatter no longer works #658

chanlito opened this issue Jan 18, 2018 · 12 comments
Labels

Comments

@chanlito
Copy link

  • [x ] I have searched through existing issues
  • [x ] I have read through docs
  • [x ] I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.11.6
  • VS Code version: 1.19.2
  • Prettier Vs Code: 1.1.2

Problem

my configuration below no longer works after updating prettier

"vetur.format.defaultFormatter.html": "js-beautify-html",
  "vetur.format.defaultFormatterOptions": {
    "js-beautify-html": {
      "indent_size": 2,
      "end_with_newline": false,
      "wrap_attributes": "force-aligned",
      "wrap_attributes_indent_size": 2,
      "editorconfig": true
    }
  }
@lunchboxsushi
Copy link

lunchboxsushi commented Jan 18, 2018

I was looking all day and finally got it to work,

I downgraded to vetur 0.10. and prettier 1.0.0

you can downgrade via installing from the store using

https://${publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/${publisher}/extension/${extension_name}/${version}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

where publisher of octref.vetur = octref
extension = vetur.

once downloaded renamed the extension from VSIXPackage to VSIX and in vsCode press f1 and find Exensions: install from vsix locate the path, wait a few seconds for it to install and reload window.

I'm not sure if any newer versions will work but this got me going for now.

update
vetur 0.11.6 works with prettier 1.0.0

**update 2"
tried to upgrade prettier to 1.1.0 however it stopped working there with vetur.
to get it working you can have latest vetur but will need to downgrade into prettier 1.0.0 via
https://esbenp.gallery.vsassets.io/_apis/public/gallery/publisher/esbenp/extension/prettier-vscode/1.0.0/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

@ericcirone
Copy link

Same issue here.

@ericcirone
Copy link

Seems like its the latest version of prettier-vsode 1.1.2. If I disable the plugin then all works fine in .vue files.

@ericcirone
Copy link

reverted to prettier-vscode-1.0.1 and all is working again.

@CiGit
Copy link

CiGit commented Jan 18, 2018

Hello Vetur users!

Since prettier-vscode@1.1 we register a formatter for "vue" files (prettier@1.10). It seems it's interacting badly with Vetur which does the same... (and seems we are wining the formatter battle ✌️ )
You can disable prettier on vue files
prettier.disableLanguages: ["vue"] (restart vscode)
and continue to use Vetur's formatter which also formats the html template part of your SFC. Prettier only takes care of script and style part.

I don't know if you can do the opposite tho.

@ericcirone
Copy link

I did try setting, prettier.disableLanguages: ["vue"] but then since Vetur uses prettier, it didn't format anything else. I can try again.

@CiGit
Copy link

CiGit commented Jan 18, 2018

@ericcirone I don't really know Vetur, but I don't think it relies on Prettier-vscode to do the formatting...
Would need some investigations.
Have you restarted vscode?

@ericcirone
Copy link

I did not reload the window, after I did that it started working correctly. Thanks @CiGit

@CiGit
Copy link

CiGit commented Jan 18, 2018

Great, will update my posts to mention that :-)
It only appears in our readme ...

@octref
Copy link
Member

octref commented Jan 18, 2018

@CiGit prettier-vscode compared to Vetur

  • does not have a formatter for html
  • does not have a formatter for stylus
  • does now allow selectable formatters for each sections (for example, using typescript's formatter instead of prettier for formatting TS)

So I suggest that you specify prettier.disableLanguages: ["vue"] as a default.

For others, this is already in FAQ and answered for at least 5 times. Please search issues and read FAQ before making new issues.

@hunmar
Copy link

hunmar commented Sep 19, 2018

I just tried prettier "vetur.format.defaultFormatter.html": "prettier" and it works for html part

vetur@0.12.6
prettier@1.6.1

@ghost
Copy link

ghost commented Sep 29, 2018

@hunmar It works but has problems.

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

No branches or pull requests

6 participants