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

Workspace does not respect editor.formatOnSave config from folder settings #49708

Closed
samijaber opened this issue May 11, 2018 · 8 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues verified Verification succeeded
Milestone

Comments

@samijaber
Copy link

samijaber commented May 11, 2018

  • VSCode Version: 1.23.0
  • OS Version: Mac OS 10.13.4

Steps to Reproduce:

  1. Have the following config in your folder settings:
 {
   "[javascript]": {
        "editor.formatOnSave": true
    },
    "[javascriptreact]": {
        "editor.formatOnSave": true
    },
    "[typescript]": {
        "editor.formatOnSave": true
    },
    "[typescriptreact]": {
        "editor.formatOnSave": true
    },
    "prettier.eslintIntegration": true,
    "eslint.validate": [
      "javascript",
      "javascriptreact",
      "typescript",
      "typescriptreact"
    ],
}
  1. create a workspace that includes this folder, do not specify anything in the settings.
  2. edit a file in said-folder and try to save it. I am using the Prettier - Code Formatter with ESLint extensions in this case to format.

Observed Behaviour: File does not format on save.
Expected Behaviour: File formats on save, as file settings are meant to override workspace settings

Does this issue occur when all extensions are disabled?: Irrelevant, since this is tied to extensions formatting on save.

NOTE: The only way I can work around this is by copying the following subset of my folder settings into my workspace settings:

{
   "[javascript]": {
        "editor.formatOnSave": true
    },
    "[javascriptreact]": {
        "editor.formatOnSave": true
    },
    "[typescript]": {
        "editor.formatOnSave": true
    },
    "[typescriptreact]": {
        "editor.formatOnSave": true
    },
}
@vscodebot vscodebot bot added the javascript JavaScript support issues label May 11, 2018
@mjbvz mjbvz removed the javascript JavaScript support issues label May 11, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented May 11, 2018

If you disable prettier and eslint, does the built-in JavaScript and TypeScript formatter get run in this case?

@mjbvz mjbvz added the info-needed Issue requires more information from poster label May 25, 2018
@didacrios
Copy link

didacrios commented May 28, 2018

Hi all, same problem here

Code
Version 1.23.1
Commit d0182c3
Date 2018-05-10T17:11:17.614Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

OS: Microsoft Windows 10 Enterprise
Version 10.0.15063 Build 15063

Installed extensions:
dawhite.mustache - Syntax highlighting for mustache

Steps to Reproduce:

Set this json in ./.vscode/settings.json (Folder Settings)

{
    "editor.formatOnSave": true,
    "editor.trimAutoWhitespace": true,
    "html.format.wrapAttributes": "force-aligned",
    "html.format.contentUnformatted": "pre",
    "html.autoClosingTags": true,
    "[javascript]": {
        "editor.formatOnSave": false,
    },
    "[html]": {
        "editor.tabSize": 2,
        "editor.detectIndentation": false
    },
    "[mustache]": {
        "editor.tabSize": 2,
        "editor.detectIndentation": false
    }
}

Create sample JavaScript file and HTML sample.js and sample.html in the folder Project

./sample.js
./sample.html

Write some HTML and JavaScript

Save files

Observerd behaviour:
HTML code is formatted
JavaScript code is formatted

Expected behaviour:
HTML code to be formatted
JavaScript to remain unformmated

If I use this folder settings in the workspace settings ./sample-project.code-workspace it Works as expected

@hunhejj
Copy link

hunhejj commented Jun 13, 2018

Same here.
@mjbvz Disabled eslint & Prettier, but it still did not get formatted on save.

@hunhejj
Copy link

hunhejj commented Jun 13, 2018

When opening the folder directly, it is working as expected. Hence there is no problem with the settings itself.

@hunhejj
Copy link

hunhejj commented Jul 3, 2018

@mjbvz What other info do you need in order to investigate this issue?

@mjbvz mjbvz removed the info-needed Issue requires more information from poster label Jul 3, 2018
@mjbvz mjbvz removed their assignment Jul 3, 2018
@jrieken
Copy link
Member

jrieken commented Jul 4, 2018

@sandy081
Copy link
Member

sandy081 commented Jul 4, 2018

Looks correct

@sandy081
Copy link
Member

sandy081 commented Jul 4, 2018

Looks like override identifier settings are not working in folder settings.

@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues labels Jul 4, 2018
@sandy081 sandy081 added this to the July 2018 milestone Jul 4, 2018
sandy081 added a commit that referenced this issue Jul 5, 2018
@roblourens roblourens added the verified Verification succeeded label Aug 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug config VS Code configuration, set up issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants