Skip to content

Commit

Permalink
Feature Request: Insert blank lines before/after single-line fields
Browse files Browse the repository at this point in the history
Fixes #433

Add "single-line fields" option to the cleaning insert options view and view model.
  • Loading branch information
jasonjtyler committed Oct 23, 2018
1 parent 5182f2b commit 5425afc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ToggleButton Content="enumerations" IsChecked="{Binding InsertBlankLinePaddingBeforeEnumerations}" />
<ToggleButton Content="events" IsChecked="{Binding InsertBlankLinePaddingBeforeEvents}" />
<ToggleButton Content="multi-line fields" IsChecked="{Binding InsertBlankLinePaddingBeforeFieldsMultiLine}" />
<ToggleButton Content="single-line fields" IsChecked="{Binding InsertBlankLinePaddingBeforeFieldsSingleLine}" />
<ToggleButton Content="interfaces" IsChecked="{Binding InsertBlankLinePaddingBeforeInterfaces}" />
<ToggleButton Content="methods" IsChecked="{Binding InsertBlankLinePaddingBeforeMethods}" />
<ToggleButton Content="multi-line properties" IsChecked="{Binding InsertBlankLinePaddingBeforePropertiesMultiLine}" />
Expand All @@ -42,6 +43,7 @@
<ToggleButton Content="enumerations" IsChecked="{Binding InsertBlankLinePaddingAfterEnumerations}" />
<ToggleButton Content="events" IsChecked="{Binding InsertBlankLinePaddingAfterEvents}" />
<ToggleButton Content="multi-line fields" IsChecked="{Binding InsertBlankLinePaddingAfterFieldsMultiLine}" />
<ToggleButton Content="single-line fields" IsChecked="{Binding InsertBlankLinePaddingAfterFieldsSingleLine}" />
<ToggleButton Content="interfaces" IsChecked="{Binding InsertBlankLinePaddingAfterInterfaces}" />
<ToggleButton Content="methods" IsChecked="{Binding InsertBlankLinePaddingAfterMethods}" />
<ToggleButton Content="multi-line properties" IsChecked="{Binding InsertBlankLinePaddingAfterPropertiesMultiLine}" />
Expand Down
20 changes: 20 additions & 0 deletions CodeMaid/UI/Dialogs/Options/Cleaning/CleaningInsertViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public CleaningInsertViewModel(CodeMaidPackage package, Settings activeSettings)
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterEnumerations, x => InsertBlankLinePaddingAfterEnumerations),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterEvents, x => InsertBlankLinePaddingAfterEvents),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterFieldsMultiLine, x => InsertBlankLinePaddingAfterFieldsMultiLine),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterFieldsSingleLine, x => InsertBlankLinePaddingAfterFieldsSingleLine),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterInterfaces, x => InsertBlankLinePaddingAfterInterfaces),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterMethods, x => InsertBlankLinePaddingAfterMethods),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingAfterNamespaces, x => InsertBlankLinePaddingAfterNamespaces),
Expand All @@ -40,6 +41,7 @@ public CleaningInsertViewModel(CodeMaidPackage package, Settings activeSettings)
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeEnumerations, x => InsertBlankLinePaddingBeforeEnumerations),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeEvents, x => InsertBlankLinePaddingBeforeEvents),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeFieldsMultiLine, x => InsertBlankLinePaddingBeforeFieldsMultiLine),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeFieldsSingleLine, x => InsertBlankLinePaddingBeforeFieldsSingleLine),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeInterfaces, x => InsertBlankLinePaddingBeforeInterfaces),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeMethods, x => InsertBlankLinePaddingBeforeMethods),
new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Cleaning_InsertBlankLinePaddingBeforeNamespaces, x => InsertBlankLinePaddingBeforeNamespaces),
Expand Down Expand Up @@ -131,6 +133,15 @@ public bool InsertBlankLinePaddingAfterFieldsMultiLine
set { SetPropertyValue(value); }
}

/// <summary>
/// Gets or sets the flag indicating if blank line padding should be added after single-line fields.
/// </summary>
public bool InsertBlankLinePaddingAfterFieldsSingleLine
{
get { return GetPropertyValue<bool>(); }
set { SetPropertyValue(value); }
}

/// <summary>
/// Gets or sets the flag indicating if blank line padding should be added after interfaces.
/// </summary>
Expand Down Expand Up @@ -267,6 +278,15 @@ public bool InsertBlankLinePaddingBeforeFieldsMultiLine
set { SetPropertyValue(value); }
}

/// <summary>
/// Gets or sets the flag indicating if blank line padding should be added before single-line fields.
/// </summary>
public bool InsertBlankLinePaddingBeforeFieldsSingleLine
{
get { return GetPropertyValue<bool>(); }
set { SetPropertyValue(value); }
}

/// <summary>
/// Gets or sets the flag indicating if blank line padding should be added before interfaces.
/// </summary>
Expand Down

0 comments on commit 5425afc

Please sign in to comment.