-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Description
It would be nice to be able to add some conditionals to variables throughout the configuration. Specifically I'm interested in modifying the Window Title based on whether you're using a remote connection or not.
Specifically I hope to construct a title that looks like ssh://${remoteName}${activeEditorLong} when connected to a remote, or ${activeEditorLong} when not.
With javascript substitutions I could write:
This could be achieved and more use-cases by simply enabling javascript substitution
{
"window.title": "${remoteName === '' ? activeEditorLong : `ssh://${remoteName}${activeEditorLong}`}"
}But it seems like if that were an option with the config variable substitution, it would have already been done.
Most other ways I can think of become excessive real fast, nonetheless perhaps a new modifier in a similar vein to ${env:...} or ${config:..} -- it could be ${if:var}true_val${else}false_val${endif} for instance. Otherwise it could be similar to keybinding conditionals, moving outside of the config:
{
"conditionals": [
{
"key": "window.title",
"when": "remoteName",
"value": "ssh://${remoteName}${activeEditorLong}"
},
{
"key": "window.title",
"when": "!remoteName",
"value": "${activeEditorLong}"
}
]
}But this becomes complicated from a UI standpoint.
All I really want is the ability to achieve my use case, but it raises other possibilities when it comes to conditional preferences, hence the above discussion. Please let me know if this is simply out of scope or something that can be addressed (or in fact is and I'm not aware of it).
I'm currently using VS code version 1.43.1. Thanks for the awesome editor!