Skip to content

Commit 357694f

Browse files
authored
Merge pull request #4891 from Vogel612/fix/experimental-attribute-usage
Fixes experimental attribute usage and surfaces experimental features in general settings; see #4270
2 parents 7e4ddd2 + 5461a68 commit 357694f

20 files changed

+267
-36
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyCaseBlockInspection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
using Antlr4.Runtime.Misc;
22
using Rubberduck.Inspections.Abstract;
33
using Rubberduck.Inspections.Results;
4-
using Rubberduck.Parsing.Common;
54
using Rubberduck.Parsing.Grammar;
5+
using Rubberduck.Parsing.Common;
66
using Rubberduck.Parsing.Inspections.Abstract;
77
using Rubberduck.Resources.Inspections;
88
using Rubberduck.Parsing.VBA;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using Rubberduck.Resources.Experimentals;
1112

1213
namespace Rubberduck.Inspections.Concrete
1314
{
14-
[Experimental]
15+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1516
internal class EmptyCaseBlockInspection : ParseTreeInspectionBase
1617
{
1718
public EmptyCaseBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyDoWhileBlockInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
using Rubberduck.Parsing.VBA;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using Rubberduck.Resources.Experimentals;
1112

1213
namespace Rubberduck.Inspections.Concrete
1314
{
14-
[Experimental]
15+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1516
internal class EmptyDoWhileBlockInspection : ParseTreeInspectionBase
1617
{
1718
public EmptyDoWhileBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyElseBlockInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
using Rubberduck.Parsing.VBA;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using Rubberduck.Resources.Experimentals;
1112

1213
namespace Rubberduck.Inspections.Concrete
1314
{
14-
[Experimental]
15+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1516
internal class EmptyElseBlockInspection : ParseTreeInspectionBase
1617
{
1718
public EmptyElseBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyForEachBlockInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
using Rubberduck.Parsing.VBA;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using Rubberduck.Resources.Experimentals;
1112

1213
namespace Rubberduck.Inspections.Concrete
1314
{
14-
[Experimental]
15+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1516
internal class EmptyForEachBlockInspection : ParseTreeInspectionBase
1617
{
1718
public EmptyForEachBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyForLoopBlockInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
using Rubberduck.Parsing.VBA;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using Rubberduck.Resources.Experimentals;
1112

1213
namespace Rubberduck.Inspections.Concrete
1314
{
14-
[Experimental]
15+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1516
internal class EmptyForLoopBlockInspection : ParseTreeInspectionBase
1617
{
1718
public EmptyForLoopBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyIfBlockInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
using Rubberduck.Parsing.Grammar;
88
using Rubberduck.Parsing.Inspections.Abstract;
99
using Rubberduck.Resources.Inspections;
10+
using Rubberduck.Resources.Experimentals;
1011
using Rubberduck.Parsing.VBA;
1112
using System.Collections.Generic;
1213
using System.Linq;
1314

1415
namespace Rubberduck.Inspections.Concrete
1516
{
16-
[Experimental]
17+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1718
internal class EmptyIfBlockInspection : ParseTreeInspectionBase
1819
{
1920
public EmptyIfBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyWhileWendBlockInspection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
using Rubberduck.Parsing.VBA;
99
using System.Collections.Generic;
1010
using System.Linq;
11+
using Rubberduck.Resources.Experimentals;
1112

1213
namespace Rubberduck.Inspections.Concrete
1314
{
14-
[Experimental]
15+
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
1516
internal class EmptyWhileWendBlockInspection : ParseTreeInspectionBase
1617
{
1718
public EmptyWhileWendBlockInspection(RubberduckParserState state)

Rubberduck.Core/Settings/ExperimentalFeatures.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using System.Xml.Serialization;
22
using Rubberduck.UI;
3-
using Rubberduck.Resources;
3+
using Rubberduck.Resources.Experimentals;
44

55
namespace Rubberduck.Settings
66
{
7-
public class ExperimentalFeatures : ViewModelBase
7+
public class ExperimentalFeature : ViewModelBase
88
{
99
private bool _isEnabled;
1010
public bool IsEnabled
@@ -30,7 +30,7 @@ public string Key
3030
}
3131

3232
[XmlIgnore]
33-
public string DisplayValue => Key == null ? string.Empty : RubberduckUI.ResourceManager.GetString(Key);
33+
public string DisplayValue => Key == null ? string.Empty : ExperimentalNames.ResourceManager.GetString(Key);
3434

3535
public override string ToString()
3636
{
@@ -39,7 +39,7 @@ public override string ToString()
3939

4040
public override bool Equals(object obj)
4141
{
42-
return obj is ExperimentalFeatures value &&
42+
return obj is ExperimentalFeature value &&
4343
value.IsEnabled == IsEnabled &&
4444
value.Key == Key;
4545
}

Rubberduck.Core/Settings/GeneralSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface IGeneralSettings
2020
bool UserEditedLogLevel { get; set; }
2121
int MinimumLogLevel { get; set; }
2222
bool SetDpiUnaware { get; set; }
23-
List<ExperimentalFeatures> EnableExperimentalFeatures { get; set; }
23+
List<ExperimentalFeature> EnableExperimentalFeatures { get; set; }
2424
}
2525

2626
[SettingsSerializeAs(SettingsSerializeAs.Xml)]
@@ -73,7 +73,7 @@ public int MinimumLogLevel
7373

7474
public bool SetDpiUnaware { get; set; }
7575

76-
public List<ExperimentalFeatures> EnableExperimentalFeatures { get; set; } = new List<ExperimentalFeatures>();
76+
public List<ExperimentalFeature> EnableExperimentalFeatures { get; set; } = new List<ExperimentalFeature>();
7777

7878
public GeneralSettings()
7979
{

Rubberduck.Core/UI/Settings/GeneralSettings.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@
240240
</DataGrid.Columns>
241241
</DataGrid>
242242
<Label Content="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=GeneralSettings_ExperimentalFeatures}" FontWeight="SemiBold" />
243-
<Label Margin="5,0,0,5" FontWeight="Bold" Foreground="{x:Static SystemColors.HighlightTextBrush}">
243+
<Label Margin="5,0,0,5" FontWeight="Bold"
244+
Foreground="{x:Static SystemColors.InfoTextBrush}"
245+
Background="{x:Static SystemColors.InfoBrush}">
244246
<Label.Content>
245247
<AccessText TextWrapping="Wrap" Text="{Resx ResxName=Rubberduck.Resources.RubberduckUI, Key=GeneralSettings_ExperimentalFeaturesWarning}"/>
246248
</Label.Content>

0 commit comments

Comments
 (0)