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

Configuration setting vueIndentScriptAndStyle is not working #1048

Closed
anoop-ananthan opened this issue Nov 13, 2019 · 8 comments
Closed

Configuration setting vueIndentScriptAndStyle is not working #1048

anoop-ananthan opened this issue Nov 13, 2019 · 8 comments
Labels
locked Please open a new issue and fill out the template instead of commenting. need-more-info

Comments

@anoop-ananthan
Copy link

Summary

The configuration "vueIndentScriptAndStyle": false is not taking any effect on format of vue file.

An update was added to the prettier automatically and codes were formatted in a way that I did not configure. So I checked the documentation and as per the link I found, added this to .prettierrc

Github Repository to Reproduce Issue

There is no source code as it is the changes on the configuration file .prettierrc

{
    "printWidth": 100,
    "semi": false,
    "singleQuote": true,
    "tabWidth": 4,
    "trailingComma": "all",
    "jsxBracketSameLine": true,
    "arrowParens": "avoid",
    "htmlWhitespaceSensitivity": "strict",
    "vueIndentScriptAndStyle": false
}

Link to a Github repo that can be used to reproduce the issue.

Steps To Reproduce:

  1. Install/update to v3.3.5
  2. Change configuration as shown above
  3. Format a Vue file

Expected result

The expected result is style and script elements keep their indentations. Screenshot is attached

Actual result

style and script elements lose their indentations.

Additional information

Script Indent
Even though removing this intending is nice & useful, the changes introduced in a project where large no: of people are working is messing up code-review and stuff. So it'd be a lot better if it could be controlled using configuration.
image

Style Indent
I would prefer to keep both script and style configuration different. Personally I want to have an indent on the style contents.
image

VS Code Version:
v1.40.0
Prettier & Prettier Plugin Version:
v3.3.5
OS and version:
Ubutntu 16

Thank you for the amazing extension.

@anoop-ananthan anoop-ananthan changed the title Configuration is not working Configuration setting vueIndentScriptAndStyle is not working Nov 13, 2019
@anoop-ananthan
Copy link
Author

Reverted back to old version.

@AbdelElrafa
Copy link

Can you please reopen this issues? Changing versions doesn't fix it. It's still broken.

@ntotten
Copy link
Member

ntotten commented Nov 18, 2019

Do you have prettier installed locally? If so it needs to be version 1.19 or above. This might be something we need to warn about. Prettier has a similar issue: prettier/prettier#6887

If that isn't the problem, please share your prettier output logs. You can access them by clicking the Prettier button in the bottom toolbar.

@anoop-ananthan
Copy link
Author

Hi, prettier was not installed locally.

It seems weird, I had to install node.js due to some other reason and reinstalled vscode and all the extensions and it is working correctly

@anoop-ananthan
Copy link
Author

anoop-ananthan commented Apr 9, 2020

This is happening again:

["INFO" - 1:57:41 pm] Formatting /home/anoop/coding/projects/tm-web/src/components/dashboard/PostStatsCardView.vue
["INFO" - 1:57:41 pm] Using ignore file (if present) at /home/anoop/coding/projects/tm-web/.prettierignore
["INFO" - 1:57:41 pm] Loaded module 'prettier@1.18.2' from '/home/anoop/coding/projects/tm-web/node_modules/prettier/index.js'
["INFO" - 1:57:41 pm] File Info:
{
  "ignored": false,
  "inferredParser": "vue"
}
["INFO" - 1:57:41 pm] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 1:57:41 pm] Prettier Options:
{
  "filepath": "/home/anoop/coding/projects/tm-web/src/components/dashboard/PostStatsCardView.vue",
  "parser": "vue",
  "printWidth": 100,
  "semi": false,
  "singleQuote": true,
  "tabWidth": 4,
  "trailingComma": "all",
  "jsxBracketSameLine": true,
  "arrowParens": "avoid",
  "htmlWhitespaceSensitivity": "css",
  "vueIndentScriptAndStyle": true
}
["INFO" - 1:57:41 pm] Formatting completed in 421.477212ms.

.prettierrc

{
    "printWidth": 100,
    "semi": false,
    "singleQuote": true,
    "tabWidth": 4,
    "trailingComma": "all",
    "jsxBracketSameLine": true,
    "arrowParens": "avoid",
    "htmlWhitespaceSensitivity": "css",
    "vueIndentScriptAndStyle": true
}

Output

Screenshot from 2020-04-09 14-01-21

VS Code Version:
v1.43.2
Prettier & Prettier Plugin Version:
v4.1.1
OS and version:
Ubutntu 16

Please note:

  1. Prettier is not installed locally.
  2. Working correctly when rolled back prettier plugin to v4.0.0.

@anoop-ananthan anoop-ananthan reopened this Apr 9, 2020
@ntotten
Copy link
Member

ntotten commented Apr 12, 2020

Please provide a sample repo I can use to reproduce this issue. See: https://github.com/prettier/prettier-vscode/wiki/Writing-a-Good-Issue#5-provide-a-sample-github-repo

@no-response
Copy link

no-response bot commented Apr 15, 2020

This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.

@no-response no-response bot closed this as completed Apr 15, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Jul 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked Please open a new issue and fill out the template instead of commenting. need-more-info
Projects
None yet
Development

No branches or pull requests

3 participants