Settings on 🔥!
Define groups of settings to be easily toggled on and off. These may be defined in either global
User Settings or your current Workspace settings.
Command
Provides a Toggle Settings command that can be used to toggle groups of settings on and off.
Configuration Example
"settingsOnFire.toggle": {
"Color Theme": {
"on": {
"workbench.colorTheme": "Ayu Mirage"
},
"off": {
"workbench.colorTheme": "Ayu Light"
}
},
"Tests": {
"on": {
"files.exclude": {
"**/__tests__": false,
"**/__mocks__": false,
"**/__fixtures__": false,
"**/*.spec.js": false,
}
},
"off": {
"files.exclude": {
"**/__tests__": true,
"**/__mocks__": true,
"**/__fixtures__": true,
"**/*.spec.js": true,
}
}
}
}
The keys Color Theme and Tests will appear in your command palette:
The "on" or "off" that you see in the screenshot indicates the state that the setting will be
changed to if you select it. Before ever toggling a setting, it will be considered to be off.
You can specify any amount of settings inside the on or off
definitions. These settings will simply be written to your top-level settings object.
State keys may be written as on/off or turn_on/turn_off — both spellings are accepted.
Labels
You may also include a _label key to provide more clarity around what toggling the setting will
do:
"settingsOnFire.toggle": {
"Color Theme": {
"on": {
"_label": "Dark",
"workbench.colorTheme": "Ayu Mirage"
},
"off": {
"_label": "Light",
"workbench.colorTheme": "Ayu Light"
}
}
}
Merging vs Overwriting Settings
Settings that are objects will be merged into existing settings, while any other type of value will
simply overwrite the previous setting. For example, the Tests settings above will merge the values
in files.exclude with whatever the current setting is for that key. Object settings are deep-merged recursively, so multiple toggles that write into the same setting (for example workbench.editorAssociations) stack together instead of clobbering one another.
Web support
This is a web extension: it runs in vscode.dev and github.dev (browser) as well as desktop VS Code and Remote-SSH / WSL / Container workspaces. The toggle command uses only the core VS Code configuration API, so behaviour is identical across environments.