Skip to content

Commit 5cf9cfa

Browse files
authored
Merge pull request #2397 from comintern/next
Misc Indenter fixes\improvements.
2 parents f7546c9 + d6ef047 commit 5cf9cfa

18 files changed

+293
-119
lines changed

RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldRefactoring.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private string GetPropertyText()
231231
(_model.ImplementSetSetterType ? setterText : string.Empty)).TrimEnd() + Environment.NewLine;
232232

233233
var propertyTextLines = propertyText.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
234-
return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, "test", false));
234+
return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, "test"));
235235
}
236236
}
237237
}

RetailCoder.VBE/Refactorings/ExtractMethod/ExtractMethodPresenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void GeneratePreview(IExtractMethodModel extractMethodModel,IExtractMeth
8585
*/
8686
var extractedMethod = extractMethodProc.createProc(extractMethodModel);
8787
var code = extractedMethod.Split(new[]{Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);
88-
code = _indenter.Indent(code, "Preview", false).ToArray();
88+
code = _indenter.Indent(code, "Preview").ToArray();
8989
_view.Preview = string.Join(Environment.NewLine, code);
9090
}
9191
}

RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private string GetPropertyText()
164164
(MustImplementSetSetterType ? setterText : string.Empty);
165165

166166
var propertyTextLines = propertyText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
167-
return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, "test", false));
167+
return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, "test"));
168168
}
169169

170170
private void ValidatePropertyName()

RetailCoder.VBE/UI/RubberduckUI.Designer.cs

Lines changed: 40 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/UI/RubberduckUI.de.resx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,64 +1686,67 @@ Allen Sternguckern, Likern & Followern, für das warme Kribbeln
16861686
<data name="RubberduckFatalError" xml:space="preserve">
16871687
<value>In Rubberduck ist ein Fehler aufgetreten. Bitte speichern Sie Ihre Arbeit und starten Sie das Hostprogramm neu. Laden Sie dann Ihre Logdatei zu unserer GitHub-Seite hoch.</value>
16881688
</data>
1689-
<data name="ToolsMenu_SourceControl">
1689+
<data name="ToolsMenu_SourceControl" xml:space="preserve">
16901690
<value>Version&amp;skontrolle</value>
16911691
</data>
1692-
<data name="RegexAssistant_NoPatternError">
1692+
<data name="RegexAssistant_NoPatternError" xml:space="preserve">
16931693
<value>(kein Ausdruck gegeben)</value>
16941694
</data>
1695-
<data name="TestExplorerMenu_AddTestModule">
1695+
<data name="TestExplorerMenu_AddTestModule" xml:space="preserve">
16961696
<value>Testm&amp;odul</value>
16971697
</data>
1698-
<data name="RegexAssistant_GlobalFlag">
1698+
<data name="RegexAssistant_GlobalFlag" xml:space="preserve">
16991699
<value>Global</value>
17001700
</data>
1701-
<data name="RegexAssistant_Caption">
1701+
<data name="RegexAssistant_Caption" xml:space="preserve">
17021702
<value>Rubberduck - Regexassistent</value>
17031703
</data>
1704-
<data name="ToolsMenu">
1704+
<data name="ToolsMenu" xml:space="preserve">
17051705
<value>T&amp;ools</value>
17061706
</data>
1707-
<data name="ToolsMenu_RegexAssistant">
1707+
<data name="ToolsMenu_RegexAssistant" xml:space="preserve">
17081708
<value>Regex&amp;assistent</value>
17091709
</data>
1710-
<data name="RegexAssistant_Title">
1710+
<data name="RegexAssistant_Title" xml:space="preserve">
17111711
<value>Assistent für Reguläre Ausdrücke</value>
17121712
</data>
1713-
<data name="CodeInspectionSettings_WhitelistedIdentifiersLabel">
1713+
<data name="CodeInspectionSettings_WhitelistedIdentifiersLabel" xml:space="preserve">
17141714
<value>Explizit erlaubte Namen</value>
17151715
</data>
1716-
<data name="ToolsMenu_TodoItems">
1716+
<data name="ToolsMenu_TodoItems" xml:space="preserve">
17171717
<value>To&amp;Do Liste</value>
17181718
</data>
1719-
<data name="RegexAssistant_Instructions">
1719+
<data name="RegexAssistant_Instructions" xml:space="preserve">
17201720
<value>Einen Regulären Ausdruck zur Analyse in die Box unten eingeben.</value>
17211721
</data>
1722-
<data name="TestExplorerMenu_AddTestMethod">
1722+
<data name="TestExplorerMenu_AddTestMethod" xml:space="preserve">
17231723
<value>Test&amp;methode</value>
17241724
</data>
1725-
<data name="RegexAssistant_IgnoreCaseFlag">
1725+
<data name="RegexAssistant_IgnoreCaseFlag" xml:space="preserve">
17261726
<value>Ignoriere Groß-/Kleinschreibung</value>
17271727
</data>
1728-
<data name="HotkeyDescription_SourceControl">
1728+
<data name="HotkeyDescription_SourceControl" xml:space="preserve">
17291729
<value>Versionskontrolle</value>
17301730
</data>
1731-
<data name="TestExplorerMenu_AddExpectedErrorTestMethod">
1731+
<data name="TestExplorerMenu_AddExpectedErrorTestMethod" xml:space="preserve">
17321732
<value>Testmethode (&amp;erwartet Fehler)</value>
17331733
</data>
1734-
<data name="CodeInspectionSettings_WhitelistedIdentifiersDescription">
1734+
<data name="CodeInspectionSettings_WhitelistedIdentifiersDescription" xml:space="preserve">
17351735
<value>Diese Namen werden von der Inspektion "Nutze aussagekräftige Namen" ignoriert.</value>
17361736
</data>
1737-
<data name="CodeInspectionSettings_InspectionSeveritySettingsLabel">
1737+
<data name="CodeInspectionSettings_InspectionSeveritySettingsLabel" xml:space="preserve">
17381738
<value>Inspektionsschwere</value>
17391739
</data>
1740-
<data name="RegexAssistant_DescriptionResultsLabel">
1740+
<data name="RegexAssistant_DescriptionResultsLabel" xml:space="preserve">
17411741
<value>Beschreibung</value>
17421742
</data>
1743-
<data name="CodeExplorer_Indent">
1743+
<data name="CodeExplorer_Indent" xml:space="preserve">
17441744
<value>Einrücken</value>
17451745
</data>
1746-
<data name="RegexAssistant_RegexPatternLabel">
1746+
<data name="RegexAssistant_RegexPatternLabel" xml:space="preserve">
17471747
<value>Ausdruck</value>
17481748
</data>
1749-
</root>
1749+
<data name="IndenterSettings_IndentEnumTypeAsProcedure" xml:space="preserve">
1750+
<value>Kommentare in Enums und Typen wie in Prozeduren einrücken</value>
1751+
</data>
1752+
</root>

RetailCoder.VBE/UI/RubberduckUI.resx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,4 +1796,48 @@ All our stargazers, likers &amp; followers, for the warm fuzzies
17961796
<data name="ReparseToolTipText" xml:space="preserve">
17971797
<value>{0}. Click to refresh.</value>
17981798
</data>
1799+
<data name="IndenterSettings_IndentEnumTypeAsProcedure" xml:space="preserve">
1800+
<value>Indent comments in Enum and Type blocks like in procedures</value>
1801+
</data>
1802+
<data name="IndenterSettings_PreviewCode" xml:space="preserve">
1803+
<value>Public Enum ExampleEnum
1804+
' Enum comment.
1805+
Foo
1806+
Bar ' Member comment.
1807+
End Enum
1808+
1809+
' Example Procedure
1810+
Sub ExampleProc()
1811+
1812+
' SMART INDENTER
1813+
' Original VB6 code graciously offered to Rubberduck by Stephen Bullen &amp; Rob Bovey
1814+
' © 2016 by Rubberduck VBA.
1815+
1816+
Dim count As Integer
1817+
Static name As String
1818+
1819+
If YouLikeRubberduck Then
1820+
' Star us on GitHub http://github.com/rubberduck-vba/Rubberduck
1821+
' Follow us on Twitter @rubberduck-vba/contributors
1822+
' Visit http://rubberduckvba.com for news and updates
1823+
1824+
Select Case X
1825+
Case "A"
1826+
' If you have any comments or suggestions, _
1827+
or find valid VBA code that isn't indented correctly,
1828+
1829+
#If VBA6 Then
1830+
MsgBox "Contact contact@rubberduck-vba.com"
1831+
#End If
1832+
1833+
Case "Continued strings and parameters can be" _
1834+
&amp; "lined up for easier reading, optionally ignoring" _
1835+
&amp; "any operators (&amp;+, etc) at the start of the line."
1836+
1837+
Debug.Print "X&lt;&gt;1"
1838+
End Select 'Case X
1839+
End If 'More Tools?
1840+
1841+
End Sub</value>
1842+
</data>
17991843
</root>

RetailCoder.VBE/UI/Settings/IndenterSettings.xaml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
</UserControl.Resources>
2727
<Grid>
2828
<Grid.RowDefinitions>
29-
<RowDefinition />
29+
<RowDefinition Height="280" MaxHeight="280"/>
3030
<RowDefinition Height="5" />
31-
<RowDefinition Height="200" />
31+
<RowDefinition />
3232
</Grid.RowDefinitions>
3333
<ScrollViewer>
3434
<StackPanel Margin="5">
@@ -104,6 +104,21 @@
104104
<AccessText Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=IndenterSettings_ForceCompilerDirectivesToColumn1}"
105105
TextWrapping="WrapWithOverflow" />
106106
</CheckBox>
107+
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=IndenterSettings_EndOfLineCommentStyle}"
108+
FontWeight="SemiBold"
109+
HorizontalAlignment="Left" />
110+
<StackPanel Orientation="Horizontal">
111+
<ComboBox Margin="5,0,0,5"
112+
Width="210"
113+
HorizontalAlignment="Left"
114+
ItemsSource="{Binding Source={StaticResource CommentStyles}, Converter={StaticResource LocalizedEndOfLineCommentStyles}, UpdateSourceTrigger=PropertyChanged}"
115+
SelectedItem="{Binding EndOfLineCommentStyle, Mode=TwoWay, Converter={StaticResource EndOfLineCommentStyleTextToEnumValue}, UpdateSourceTrigger=PropertyChanged}" />
116+
<controls:NumberPicker Margin="0,-4,0,0"
117+
NumValue="{Binding EndOfLineCommentColumnSpaceAlignment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
118+
Visibility="{Binding EndOfLineCommentStyle, Converter={StaticResource EndOfLineCommentStyleToVisibility}}"
119+
HorizontalAlignment="Left"
120+
MinNumber="0" />
121+
</StackPanel>
107122
</StackPanel>
108123

109124
<StackPanel Grid.Column="1">
@@ -130,6 +145,12 @@
130145
<AccessText Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=IndenterSettings_IndentFirstDeclarationBlock}"
131146
TextWrapping="WrapWithOverflow" />
132147
</CheckBox>
148+
<CheckBox IsChecked="{Binding IndentEnumTypeAsProcedure, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
149+
Margin="5,0,0,5"
150+
HorizontalAlignment="Left">
151+
<AccessText Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=IndenterSettings_IndentEnumTypeAsProcedure}"
152+
TextWrapping="WrapWithOverflow" />
153+
</CheckBox>
133154
<CheckBox IsChecked="{Binding IndentCase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
134155
Margin="5,0,0,5"
135156
HorizontalAlignment="Left">
@@ -161,21 +182,6 @@
161182
</CheckBox>
162183
</StackPanel>
163184
</Grid>
164-
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=IndenterSettings_EndOfLineCommentStyle}"
165-
FontWeight="SemiBold"
166-
HorizontalAlignment="Left" />
167-
<StackPanel Orientation="Horizontal">
168-
<ComboBox Margin="5,0,0,5"
169-
Width="210"
170-
HorizontalAlignment="Left"
171-
ItemsSource="{Binding Source={StaticResource CommentStyles}, Converter={StaticResource LocalizedEndOfLineCommentStyles}, UpdateSourceTrigger=PropertyChanged}"
172-
SelectedItem="{Binding EndOfLineCommentStyle, Mode=TwoWay, Converter={StaticResource EndOfLineCommentStyleTextToEnumValue}, UpdateSourceTrigger=PropertyChanged}" />
173-
<controls:NumberPicker Margin="0,-4,0,0"
174-
NumValue="{Binding EndOfLineCommentColumnSpaceAlignment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
175-
Visibility="{Binding EndOfLineCommentStyle, Converter={StaticResource EndOfLineCommentStyleToVisibility}}"
176-
HorizontalAlignment="Left"
177-
MinNumber="0" />
178-
</StackPanel>
179185
</StackPanel>
180186
</ScrollViewer>
181187

@@ -192,7 +198,8 @@
192198

193199
<ScrollViewer Grid.Row="2"
194200
VerticalScrollBarVisibility="Auto"
195-
HorizontalScrollBarVisibility="Auto">
201+
HorizontalScrollBarVisibility="Auto"
202+
Background="White">
196203
<TextBlock Background="White"
197204
xml:space="preserve"
198205
Margin="5,0"

0 commit comments

Comments
 (0)