When you want to make a different settings on a specific project, you will make .vscode/settings.json.
I know how to make .vscode/settings.json. If I make that directory and file and name as .vscode and settings.json then those files will be functioning as the setting of the project of the directory.
But I'm lazy to do those all acts. Is there some simpler ways to make the settings.json file on each project directory? Like by using a shortcut key we could make the file, or just by using a button from a extension.
---updated on Nov 1st, 2022---
I think,
Select File > Preferences > Settings (or press Ctrl+,)
and Select Workspace tab, and then changing any setting
is the fastest way to make the .vscode/settings.json now.
if you change any setting of there, immediately vscode will make the file. No other shortcut, but I think this is quite reasonable.
If you need to change some settings in vscode, vscode will make the .vscode/settings.json automatically.
go to settings GUI, Ctrl+,
select Workspace tab
click Open Settings (JSON) button in top right corner
Or
Execute command: Preferences: Open Settings (JSON)
Or any of the other open settings commands.
I did it many times, and each time I forgot where it was.
Menu File → Preferences → Settings.
I get this:
I want to open file settings.json (editable JSON file) instead. How can I do that?
To open the User settings:
Open the command palette (either with F1 or Ctrl+Shift+P)
Type "open settings"
You are presented with a few options¹, choose Open User Settings (JSON)
This image was taken in the VS Code online editor
Which, from the manual and depending on platform, is one of:
Windows %APPDATA%\Code\User\settings.json²
macOS $HOME/Library/Application\ Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json
The Workspace settings will be in a {workspaceName}.code-workspace file where you saved it, and the Folder settings will be in a .vscode folder if and when it has been created.
Official page on User and Workspace Settings
As stated by sevencardz below, VS Code includes a button in the Settings UI gutter which can be used to switch between JSON and graphical view.
The workbench.settings.editor option selects which of the settings files is opened by default when not using the above method, such as with the shortcut ⌘+, or through the application menu.
Footnotes
The aforementioned settings, User and Workspace. Remote settings will appear when using WSL.
By a test this maps to %APPDATA%\Roaming\Code\User\settings.json, I am not sure by what logic.
On the settings UI page, there's a special button in the top right corner gutter that toggles between the settings.json file and the settings UI.
Bonus Answer:
Add "workbench.settings.editor": "json" to your settings.json file. This will make it so that menu File → Preferences → Settings or ⌘ + , opens your settings.json file by default. Optionally, add a comment at the top to remind yourself where the toggle button is.
// Click the Open Settings (UI) button in the top
// right corner gutter to toggle the settings UI
{
// Other settings in settings.json
// ...
"workbench.settings.editor": "json"
}
Follow these steps:
Shift + CMD + P
Type "settings"
Click on "Preferences: Open Settings (JSON)"
Visual Studio Code Tips and Tricks
If you want to edit local workspace/folder settings instead of global user settings, you can edit the file .vscode/settings.json (shortcut: Ctrl/Cmd + P and type "settings.json").
If that settings.json file or the folder .vscode do not exist, you can create them in the folder directory.
These settings will apply to the specific project.
These changes are global, so it will affect all of your projects.
You can change the settings.json file from user preferences.
Menu File → Preferences → Settings → Extensions → search for "Edit in settings.json"
Eventually edit these files directly:
Linux: $HOME/.config/Code/User/settings.json
macOS: $HOME/Library/Application Support/Code/User/settings.json
Windows: %APPDATA%\Code\User\settings.json
On Windows, the default keybind to open the settings UI within VSCode is Ctrl + ,. From there, there is a button at the top right to "Open Settings (JSON)":
That is one way to get to it. For convenience, I have bound Ctrl + Shift + , to opening the settings JSON. For reference, the setting ID for that is workbench.action.openSettingsJson.
Open VS Code.
Go to settings by clicking the keyboard shortcut ctrl + , or with GUI
File -> Preferences -> Settings
Refer this image
Click on the Open Settings (JSON) icon.
Refer to the image
Once you click on the icon it should open settings.json file
If still, that did not work.
Go to the search bar and type json:scheme
There click on Edit in settings.json. This should work.
But still, if it hit you in the head with a brick please let me know.
In Just 2 steps
1- Hit the shortcut Ctrl+Shift+P
(If you use a MAC it's ⌘+Shift+P):
2- Type in the search bar user settings json, and finally press Enter:
And you're done! Here you can change the general configs of VS Code in the settings.json.
However note that that there are also other types of settings.json which are relative to a project or a workspace for instance.
On a Mac the settings file is found at ~/Library/Application\ Support/Code/User/settings.json - it can be opened from the command line:
open -a 'visual studio code.app' ~/Library/Application\ Support/Code/User/settings.json
On Windows:
Click (Fn) + F1 (or Ctrl + P + >)
Type open settings json
Select Preferences: open settings (JSON)
I have this:
--addons=HorizontalPodAutoscaling,HttpLoadBalancing `
Format Document changes to this - adding a space between ","
--addons=HorizontalPodAutoscaling, HttpLoadBalancing `
Is there some [AnalyserIgnoreTheFollowing line...]?
VSCode is highly customizable, and as with all products, it has defaults, but they can be altered using the WOrkspace and user settings.
Visual Studio Code Tips and Tricks
https://code.visualstudio.com/docs/getstarted/tips-and-tricks
Visual Studio Code Formatting Setup
https://medium.com/#hamxiaoz/visual-studio-code-formatting-setup-9f40a95699ce
User and Workspace Settings It is easy to configure VS Code to your
liking through settings. Nearly every part of VS Code's editor, user
interface, and functional behavior has options you can modify.
VS Code provides two different scopes for settings:
User These settings apply globally to any instance of VS Code you open
Workspace These settings are stored inside your workspace in a .vscode
folder and only apply when the workspace is opened. Settings defined
on this scope override the user scope.
Creating User and Workspace Settings
The menu command File > Preferences > Settings (Code > Preferences >
Settings on Mac) provides entry to configure user and workspace
settings. You are provided with a list of Default Settings. Copy any
setting that you want to change to the appropriate settings.json file.
The tabs on the right let you switch quickly between the user and
workspace settings files.
https://vscode.readthedocs.io/en/latest/getstarted/settings
https://code.visualstudio.com/docs/getstarted/settings
You can also configure language based settings by directly opening
settings.json. You can scope them to the workspace by placing them in
the workspace settings just like other settings. If you have settings
defined for a language in both user and workspace scopes, then they
are merged by giving precedence to the ones defined in the workspace.
The following examples customize editor settings for language modes
typescript and markdown.
{
"[typescript]": {
"editor.formatOnSave": true,
"editor.formatOnPaste": true
},
"[markdown]": {
"editor.formatOnSave": true,
"editor.wordWrap": "on",
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": "off"
}
}
You can use IntelliSense in Settings editor to help you find allowed
language based settings. All editor settings and some non-editor
settings are supported
If you find you can't do it there, nothing prevents you from writing your own formatter.
Creating a Formatter Extension
https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices
Since Sep 6, 2018 VSCode has so called "VSCode Settings Editor UI" for visual editing of the
global VSCode settings
VSCode workspace settings
VSCode workspace folder settings
(https://twitter.com/ThePracticalDev/status/1037825020905631750)
QUESTION: is there a way to use "VSCode Settings Editor UI" in VSCode extension for editing of the settings file other than the listed above?
Example: some folder contains following json files (in proper format, which "VSCode Settings Editor UI" understands):
some-settings-sun.json
some-settings-mon.json
some-settings-tue.json
Is it possible to open one of these files in "VSCode Settings Editor UI", edit and save?
I would like to set my tslint.json location to something other than the workspace root, i.e. "${workspaceRoot}/.vscode/". It seems that tslint only works in vscode with tslint in the root directory. Is it possible to change this to another loaction?
Click File -> Preferences -> Settings
Add this line into the preferences:
"tslint.configFile": "path to tslint"