Conditional Config
A VSCode extension for dynamically managing configuration based on conditional rules.
Features
- Conditional Configuration Activation: Enable/disable configurations based on shell command execution results
- Rule-Based Configuration System: Flexible rule system with
when and whenNot conditions
Configuration
The extension uses a rule-based configuration system. Add rules to your settings.json:
Example
{
"conditionalConfig.rules": [
{
"name": "Enable OXC for Vite projects",
"condition": {
"when": "grep vite-plus package.json"
},
"then": {
"oxc.enable": true,
"[javascript][typescript][javascriptreact][typescriptreact]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
}
},
"else": {
"oxc.enable": false,
"[javascript][typescript][javascriptreact][typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
}
]
}
Configuration Options
name (optional)
Name for this rule. Used for logging and identification.
condition (optional)
Conditions for applying this rule.
when (optional): Shell command(s) that must return exit code 0 to satisfy the condition (e.g., "grep vite-plus package.json")
whenNot (optional): Shell command(s) that must return exit code 0 to NOT satisfy the condition (e.g., "npm ls biome")
then (required)
Configuration applied when the condition is satisfied.
Any valid VSCode setting can be specified as key-value pairs.
else (optional)
Configuration applied when the condition is not satisfied.
Any valid VSCode setting can be specified as key-value pairs.
Commands
Apply Configuration
Command ID: conditionalConfig.applyConditionalConfig
Manually trigger the evaluation and application of all configuration rules.