4

I am trying to changes visual studio code settings.json but it is not working. I have updated this in C:\Users\Userid\AppData\Roaming\Code\User\settings.json but not working. How to edit settings.json file in vs code?

{
    "css.experimental.customData": ["./css.json"],
    "json.schemas": [ 
        {
            "fileMatch": ["/css.json"],
            "url": "https://raw.githubusercontent.com/Microsoft/vscode-css-languageservice/master/docs/customData.schema.json"
        }
    ]
}

2 Answers 2

7

VSCode's settings are split into 2 categories: User and Workspace.

User settings

Settings that apply globally to any instance of VS Code you open.

You can edit these settings by pressing ctrl+, It should open to the User Settings tab. If it doesn't, click the User Settings tab to edit user settings. Note that these settings will affect all projects that you open using VSCode.

VSCode settings pane with User Settings tab open VSCode settings pane with User Settings tab open

Editing JSON schemas

The VSCode settings page does not allow direct editing of JSON Schemas. To edit JSON schema settings:

  1. Search JSON schemas in the VSCode settings page
  2. Click "edit in settings.json"
  3. Edit settings
  4. Done!

Edit json schema JSON schema setting in VSCode

Alternatively;

another method to find setting.json

Workspace settings

Settings stored inside your workspace and only apply when the workspace is opened.
Workspace settings override user settings.

To edit workspace settings, follow steps for user settings, except click the Workspace Settings tab instead. Note that workspace settings will override user settings

css.experimental.customData

You should put your css.json file in .vscode.

projectRoot/.vscode/css.json

{
  "version": 1,
  "pseudoElements": [
    { "name": "::bar", "description": "Foo pseudo elements" }
  ]
}

projectRoot/.vscode/settings.json

{
  "css.experimental.customData": ["./.vscode/css.json"],
  "json.schemas": [{
    {
      "fileMatch": ["css.json"],
      "url": "https://raw.githubusercontent.com/Microsoft/vscode-css-languageservice/master/docs/customData.schema.json"
    }
  ]
}

Note: a reload is required to apply changes after editing css.json.

You can also apply the above instructions for html.json

10
  • Thanks For your reply..How can i call css.json file form workspace?
    – cinnan
    Commented Mar 27, 2019 at 9:38
  • "css.experimental.customData": ["./css.json"]..where i want to put this css.json file?
    – cinnan
    Commented Mar 27, 2019 at 10:03
  • @cinnan I have added an edit to answer your question
    – jro
    Commented Mar 27, 2019 at 10:34
  • Can i use this??? github.com/octref/simple-customdata/blob/master/.vscode/…
    – cinnan
    Commented Mar 27, 2019 at 11:07
  • JRO: I am waiting for your reply
    – cinnan
    Commented Mar 27, 2019 at 11:16
2

Add a folder called ".vscode" in your project and a settings.json in there. Tho keep in mind those settings are project specific

2
  • Thanks for your reply....Project specific working fine. But i want to set globaly
    – cinnan
    Commented Mar 27, 2019 at 7:33
  • Try opening your command window with Ctrl+Shift+P and executing "Open Settings (JSON)"
    – Joscha
    Commented Mar 27, 2019 at 8:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.