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

how to use vscode's html for <template> format? #488

Closed
3 tasks done
transtone opened this issue Oct 20, 2017 · 9 comments
Closed
3 tasks done

how to use vscode's html for <template> format? #488

transtone opened this issue Oct 20, 2017 · 9 comments
Labels

Comments

@transtone
Copy link

Info

  • Platform: macOS
  • Vetur version: 0.10.1
  • VSCode version: 1.17.2

Problem

when save comment in , the code auto add 4 whitespace in all comment line everytime.

Reproducible Case

<!--
  Important. Please provide clear steps for reproducing the problem.
  Otherwise we can't help you and your issue might be closed.
  For example, fork https://github.com/octref/veturpack and modify it to reproduce the error,
  then push your changes to GitHub and send us the link.
-->
<!--
                             Important. Please provide clear steps for reproducing the problem.
                            Otherwise we can't help you and your issue might be closed.
                            For example, fork https://github.com/octref/veturpack and modify it to reproduce the error,
                            then push your changes to GitHub and send us the link.
-->

use html for .vue files works fine. but vue for .vue files got this problem.

I kown it must js-beautify's problem, but I can't find a issue about this, and vscode's html(use js-beautify?) works fine. Is there any template formatter tools to replace js-beautify-html?

@octref
Copy link
Member

octref commented Oct 20, 2017

image

If you can fix broken thign caalled js-beautify I'll buy you a beer.
The defualt setting doesn't work. I tried all possible combination of the settings I can imagine it still doesn't work. For the sake of sanity if there is one more js-beautify related issue I'll remove it immediately.

@transtone
Copy link
Author

@HerringtonDarkholme
Copy link
Member

HerringtonDarkholme commented Nov 9, 2017

In neither html nor vue can I reproduce this problem. You can set "vetur.format.defaultFormatter.html": "none"

@HerringtonDarkholme
Copy link
Member

@octref This is caused by rewrapping code in indentation.

https://github.com/vuejs/vetur/blob/master/server/src/modes/template/services/htmlFormat.ts#L16

js-beautify won't deindent code in comment. So effectively it reindent.

Sadly I don't have time to fix this. :/

@octref
Copy link
Member

octref commented Nov 9, 2017

js-beautify won't deindent code in comment.

Yeah, but it indents the first line of comment, and not the rest, which I think is not reasonable as a beautifier. It should either leave all comments alone or indent all comments together.

image

@transtone
Copy link
Author

transtone commented Nov 9, 2017

@HerringtonDarkholme @octref

In neither html nor vue can I reproduce this problem.

Do you set "editor.formatOnType": true ?

I clear all vscode settings,
just install vetur,
and set "editor.formatOnType": true,
open a abc.vue file
press meta-s continuouly

this is what happened:

untitled

@transtone
Copy link
Author

@HerringtonDarkholme can you reproduce this problem?

@HerringtonDarkholme
Copy link
Member

I can reproduce but I will not fix this.

@transtone
Copy link
Author

transtone commented Nov 14, 2017

It fixed in vetur-0.11.3, thanks!

=====

<style> 's comment `/**/` still have this indent bug.

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

3 participants