Skip to content

Question: vscode auto formatting #734

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

Closed
webfansplz opened this issue Nov 25, 2021 · 8 comments · Fixed by #1028
Closed

Question: vscode auto formatting #734

webfansplz opened this issue Nov 25, 2021 · 8 comments · Fixed by #1028
Labels
enhancement New feature or request question Further information is requested

Comments

@webfansplz
Copy link
Member

How can i use volar formatting <style> section , but use eslint (without prettier) formatting <template> and <script> in SFC.

    "[vue]": {
        "editor.defaultFormatter": "johnsoncodehk.volar"
    },

when i setting it, volar will formatting whole SFC .

@Shinigami92
Copy link
Collaborator

Looks like a very exotic config 👀
Could you explain why you need such a complex setup and don't just use formatting and linting for whole vue file?

@webfansplz
Copy link
Member Author

webfansplz commented Nov 25, 2021

Looks like a very exotic config 👀
Could you explain why you need such a complex setup and don't just use formatting and linting for whole vue file?

// .eslintrc
{
  "extends": "@my-team",
}

we have custom eslint config (without prettier),so we want to follow this specification when formatting .
But when i change default formatter (disable volar format), we missing the style section formatting .

Maybe i should add stylelint to fixed this problem ? (I'm not sure,I don't know much about it)

@Shinigami92
Copy link
Collaborator

I'm using stylelint in my current project, but we have e.g. <style lang="scss" src="./App.scss"></style> ... so... don't know if it can also lint vue sfc 🤔

@webfansplz
Copy link
Member Author

@Shinigami92 Thanks !

@johnsoncodehk
Copy link
Member

Maybe I can simply provide these VSCode settings to resolve this requirement:

  • volar.format.template.enabled
  • volar.format.script.enabled
  • volar.format.style.enabled

But I'm not sure if we really need it.

@johnsoncodehk johnsoncodehk added the question Further information is requested label Nov 25, 2021
@webfansplz
Copy link
Member Author

webfansplz commented Nov 26, 2021

Maybe I can simply provide these VSCode settings to resolve this requirement:

  • volar.format.template.enabled
  • volar.format.script.enabled
  • volar.format.style.enabled

But I'm not sure if we really need it.

It’s very useful for me, maybe we can support it (more flexible ? ), enabled all by default.

@nolimitdev
Copy link

@webfansplz was following finally added? In VSCode it is grayed out as unknown options. How #1028 solves closes this please?

volar.format.template.enabled
volar.format.script.enabled
volar.format.style.enabled

@johnsoncodehk
Copy link
Member

@nolimitdev we don't have these options, please open a feature request if you think it should have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants