Vscode: no format on paste/save on v 1.50.0

Created on 9 Oct 2020  路  13Comments  路  Source: microsoft/vscode




Steps to Reproduce:

  1. save or paste unformatted code


Does this issue occur when all extensions are disabled?: Yes/No Not applicable as the issue is related to extensions ESLint or Prettier

This was working properly prior to latest update. Both ESLint and Prettier are shown as active

Note that is does show the errors as you can see on the enclosed image.

This is eslinrc.json

   {
"env": {
    "browser": true,
    "es2020": true
},
"extends": [
    //"plugin:react/recommended",
    "airbnb",
    // "prettier",
    "plugin:prettier/recommended",
    "prettier/react"
],
"parser": "babel-eslint",
"parserOptions": {
    "ecmaFeatures": {
        "jsx": true
    },
    "ecmaVersion": 11,
    "sourceType": "module"
},
"plugins": ["react", "react-hooks", "jsx-a11y", "import", "prettier"],
"rules": {
     ......
    "no-unused-expressions": [
        "error",
        {
            "allowShortCircuit": true
        }
    ],
    "quotes": [
        2,
        "single",
        {
            "avoidEscape": true,
            "allowTemplateLiterals": true
        }
    ]
},
"globals": {
    "React": "writable"
}
}

And prettier.rc

 {
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4,
"printWidth": 90
}

Screenshot 2020-10-09 at 09 43 38

*duplicate formatting needs more info

Most helpful comment

got the same issue
resolved by adding "editor.defaultFormatter": "esbenp.prettier-vscode" to settings.json

All 13 comments

I get the same issue

got the same issue
resolved by adding "editor.defaultFormatter": "esbenp.prettier-vscode" to settings.json

same problem since updating vscode, RanSatious solution worked for me!

got the same issue
resolved by adding "editor.defaultFormatter": "esbenp.prettier-vscode" to settings.json

Thanks! It works fine.

Same problem this morning and your solution works, thank you. But some autoformat cases that used to be formatted automatically are now just underlined by eslint. Do I have to update settings in .prettierrc too ? Or somewhere else ?

Bonjour,

Meme soucis sur la 1.50 c'est possible de le fix avec cette manipulation indiquez plus haut
prettier

got the same issue
resolved by adding "editor.defaultFormatter": "esbenp.prettier-vscode" to settings.json

This solution only solved the problem temporarily for me, on subsequent reload I'm seeing the failure to format issue resurface even though editor.defaultFormatter is set to esbenp.prettier-vscode.

I was running into the same issue. I can confirm @RanSatious and @ZnK88 solutions together worked like a charm.

adding "editor.defaultFormatter": "esbenp.prettier-vscode" to settings.json seems to have resolved the format on save issue.
Format on paste still does not work though.

Note that in previous versions, "editor.defaultFormatter" was set to null and both format on save and paste worked fine.

Yes, I do have both format on paste and format on save checked on settings.

Was having issue with SCSS and JS files formatting but was not having the same luck with PHP files being ignored.

Solution for me was to remove the previous settings I had assigned in settings.json and reset by making the same selections through the newer settings interface.

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sirius1024 picture sirius1024  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

vsccarl picture vsccarl  路  3Comments

biij5698 picture biij5698  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments