VSCode settings.json and .code-workspace files
You can configure VSCode settings per-project using either a settings.json or *.code-workspace file. You must create these files manually, or create a Workspace in VSCode and save it as a file.
Your settings/workspace files should exist in a directory at the project's root, called .vscode/.
A settings.json file takes precedence, meaning if you set 2 different values for a single configuration, one in settings.json and one in a .code-workspace file, the option in settings.json will take precedence and be applied.
settings.json configuration
If a file .vscode/settings.json exists at the project root, VSCode will load its configuration from that file.
Example settings.json file
| .vscode/settings.json | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
Code Workspaces
VSCode will read files in .vscode/ (at the project's root) with a file extension of .code-workspace as a "workspace configuration." You can define settings in a .code-workspace files, like language settings or animations, and when VSCode loads the workspace, it will apply the configuration found in the file.
Note: .code-workspace configurations only apply when you open the file as a workspace. You can open the file in VSCode as if you were editing it and use the "Open Workspace" button in the bottom right of the VSCode window to open the workspace, or from the command pallette (CTRL+SHIFT+P) and search for: File: Open Workspace from File.
Example code workspace
| Example VSCode .code-workspace file | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |