Skip to content

Commit 5f97d91

Browse files
committed
Filter capabilities
1 parent 43e75dd commit 5f97d91

File tree

4 files changed

+57
-9
lines changed

4 files changed

+57
-9
lines changed

RetailCoder.VBE/UI/Settings/InspectionSettings.xaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,12 @@
293293
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SettingsCaption_ExportSettings}"/>
294294
</Grid>
295295
</StackPanel>
296-
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right"/>
297-
</DockPanel>
296+
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
297+
<Label Content="Description Filter"/>
298+
<TextBox MinWidth="75"
299+
Text="{Binding InspectionSettingsFilter, UpdateSourceTrigger=PropertyChanged}"/>
300+
</StackPanel>
301+
</DockPanel>
298302
</Label>
299303
<Border BorderBrush="DarkGray" BorderThickness="1" CornerRadius="2">
300304
<controls:GroupingGrid ItemsSource="{Binding InspectionSettings}"

RetailCoder.VBE/UI/Settings/InspectionSettingsViewModel.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,36 @@ public void UpdateCollection(CodeInspectionSeverity severity)
4242
InspectionSettings.CommitEdit();
4343
}
4444

45+
private string _inspectionSettingsFilter;
46+
public string InspectionSettingsFilter
47+
{
48+
get => _inspectionSettingsFilter;
49+
set
50+
{
51+
if (_inspectionSettingsFilter != value)
52+
{
53+
_inspectionSettingsFilter = value;
54+
OnPropertyChanged(nameof(InspectionSettings));
55+
}
56+
}
57+
}
58+
4559
private ListCollectionView _inspectionSettings;
4660
public ListCollectionView InspectionSettings
4761
{
48-
get => _inspectionSettings;
62+
get
63+
{
64+
if (string.IsNullOrEmpty(_inspectionSettingsFilter))
65+
{
66+
_inspectionSettings.Filter = null;
67+
}
68+
else
69+
{
70+
_inspectionSettings.Filter = filter => FilterInspectionSettings(filter);
71+
}
72+
return _inspectionSettings;
73+
}
74+
4975
set
5076
{
5177
if (_inspectionSettings != value)
@@ -56,6 +82,12 @@ public ListCollectionView InspectionSettings
5682
}
5783
}
5884

85+
private bool FilterInspectionSettings(object filter)
86+
{
87+
var cis = filter as CodeInspectionSetting;
88+
return cis.Description.ToUpper().Contains(_inspectionSettingsFilter.ToUpper());
89+
}
90+
5991
private bool _runInspectionsOnSuccessfulParse;
6092
public bool RunInspectionsOnSuccessfulParse
6193
{

Rubberduck.Parsing/Inspections/Resources/InspectionsUI.resx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -887,4 +887,7 @@ If the parameter can be null, ignore this inspection result; passing a null valu
887887
<data name="EmptyModuleInspectionResultFormat" xml:space="preserve">
888888
<value>Module/class {0} is empty.</value>
889889
</data>
890-
</root>
890+
<data name="ObsoleteErrorSyntaxInspectionName" xml:space="preserve">
891+
<value>Use of 'Error' statement</value>
892+
</data>
893+
</root>

Rubberduck.Parsing/Inspections/Resources/InspectionsUI1.Designer.cs

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)