Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions localization/strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -1981,6 +1981,20 @@ You can also access more VS Code Remote options through the command palette with
<data name="Settings_VMIdleTimeout.Description" xml:space="preserve">
<value>The number of milliseconds that a VM is idle, before it is shut down.</value>
</data>
<data name="Settings_KeepVMAlive.Header" xml:space="preserve">
<value>Keep WSL VM alive</value>
</data>
<data name="Settings_KeepVMAlive.Description" xml:space="preserve">
<value>Keep the WSL virtual machine running instead of shutting it down after it has been idle. When enabled, the VM only stops on "wsl --shutdown" or when the service is stopped.</value>
<comment>{Locked="wsl --shutdown"} is a command that must not be translated.</comment>
</data>
<data name="Settings_KeepVMAliveToggleSwitch.AutomationProperties.Name" xml:space="preserve">
<value>Keep WSL VM alive.</value>
</data>
<data name="Settings_KeepVMAliveToggleSwitch.AutomationProperties.HelpText" xml:space="preserve">
<value>Keep the WSL virtual machine running instead of shutting it down after it has been idle. When enabled, the VM only stops on "wsl --shutdown" or when the service is stopped.</value>
<comment>{Locked="wsl --shutdown"} is a command that must not be translated.</comment>
</data>
<data name="Settings_VMIdleTimeoutResetButton.Content" xml:space="preserve">
<value>Reset timeout</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ public bool IsOnSparseVHD
set { Set(ref _sparseVHD!, value); }
}

public bool IsOnKeepVMAlive
{
get { return _vMIdleTimeout!.Int32Value < 0; }
set
{
Set(ref _vMIdleTimeout!, value ? -1 : _defaultVMIdleTimeout, nameof(IsOnKeepVMAlive));
OnPropertyChanged(nameof(VMIdleTimeout));
OnPropertyChanged(nameof(VMIdleTimeoutEnabled));
VMIdleTimeout_ResetEnabled = !Equals(_defaultVMIdleTimeout, _vMIdleTimeout!.Int32Value);
}
Comment on lines +78 to +84
}

public bool VMIdleTimeoutEnabled
{
get { return _vMIdleTimeout!.Int32Value >= 0; }
}
Comment on lines +87 to +90

public string VMIdleTimeout
{
get
Expand All @@ -85,6 +102,8 @@ public string VMIdleTimeout
if (Int32.TryParse(value, out int parsedValue))
{
Set(ref _vMIdleTimeout!, parsedValue);
OnPropertyChanged(nameof(IsOnKeepVMAlive));
OnPropertyChanged(nameof(VMIdleTimeoutEnabled));
Comment on lines 104 to +106
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
<ctControls:SettingsCard x:Uid="Settings_SparseVHD">
<ToggleSwitch x:Uid="Settings_SparseVHDToggleSwitch" HorizontalAlignment="Right" MinWidth="0" IsOn="{x:Bind ViewModel.IsOnSparseVHD, Mode=TwoWay}"/>
</ctControls:SettingsCard>
<ctControls:SettingsExpander x:Name="VMIdleTimeoutExpander" x:Uid="Settings_VMIdleTimeout">
<ctControls:SettingsCard x:Uid="Settings_KeepVMAlive">
<ToggleSwitch x:Uid="Settings_KeepVMAliveToggleSwitch" HorizontalAlignment="Right" MinWidth="0" IsOn="{x:Bind ViewModel.IsOnKeepVMAlive, Mode=TwoWay}"/>
</ctControls:SettingsCard>
<ctControls:SettingsExpander x:Name="VMIdleTimeoutExpander" x:Uid="Settings_VMIdleTimeout" IsEnabled="{x:Bind ViewModel.VMIdleTimeoutEnabled, Mode=OneWay}">
<TextBlock Style="{StaticResource TextBlockSettingStyle}" Text="{x:Bind ViewModel.VMIdleTimeout, Mode=OneWay, Converter={StaticResource MillisecondsStringConverter}}"/>
<ctControls:SettingsExpander.Items>
<ctControls:SettingsCard HorizontalContentAlignment="Left" ContentAlignment="Left" Margin="{StaticResource SettingsExpanderItemMargin}">
Expand Down
Loading