diff --git a/Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerComponentViewModel.cs b/Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerComponentViewModel.cs index d92dcc2d0c..673cde704c 100644 --- a/Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerComponentViewModel.cs +++ b/Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerComponentViewModel.cs @@ -49,10 +49,11 @@ public CodeExplorerComponentViewModel(ICodeExplorerNode parent, Declaration decl Declaration.IsUserDefined && Declaration.DeclarationType == DeclarationType.ClassModule && Declaration.QualifiedName.QualifiedModuleName.ComponentType != ComponentType.Document && + Declaration.QualifiedName.QualifiedModuleName.ComponentType != ComponentType.UserForm && Declaration.Attributes.HasPredeclaredIdAttribute(out _); public bool IsTestModule => Declaration.DeclarationType == DeclarationType.ProceduralModule - && Declaration.Annotations.Any(annotation => annotation is TestModuleAnnotation); + && Declaration.Annotations.Any(annotation => annotation.Annotation is TestModuleAnnotation); public override void Synchronize(ref List updated) { diff --git a/Rubberduck.Core/UI/Converters/CodeExplorerNodeToIconConverter.cs b/Rubberduck.Core/UI/Converters/CodeExplorerNodeToIconConverter.cs index cf6ccf834e..adfccb5e70 100644 --- a/Rubberduck.Core/UI/Converters/CodeExplorerNodeToIconConverter.cs +++ b/Rubberduck.Core/UI/Converters/CodeExplorerNodeToIconConverter.cs @@ -62,7 +62,7 @@ public class CodeExplorerNodeToIconConverter : ImageSourceConverter, IMultiValue public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if ((value as ICodeExplorerNode )?.Declaration is null) + if ((value as ICodeExplorerNode)?.Declaration is null) { return NullIcon; } @@ -93,7 +93,7 @@ public override object Convert(object value, Type targetType, object parameter, } if (component.Declaration is ClassModuleDeclaration classModule && - (classModule.IsInterface || classModule.Annotations.Any(annotation => annotation is InterfaceAnnotation))) + (classModule.IsInterface || classModule.Annotations.Any(annotation => annotation.Annotation is InterfaceAnnotation))) { return InterfaceIcon; } @@ -105,7 +105,7 @@ public override object Convert(object value, Type targetType, object parameter, return value is ICodeExplorerNode node && node.Declaration != null && DeclarationIcons.ContainsKey(node.Declaration.DeclarationType) - ? node.Declaration.Annotations.Any(a => a is TestMethodAnnotation) + ? node.Declaration.Annotations.Any(a => a.Annotation is TestMethodAnnotation) ? TestMethodIcon : DeclarationIcons[node.Declaration.DeclarationType] : ExceptionIcon; diff --git a/Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs b/Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs index e7cfd249d2..a2194e1739 100644 --- a/Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs +++ b/Rubberduck.Parsing/Symbols/ClassModuleDeclaration.cs @@ -29,12 +29,13 @@ public ClassModuleDeclaration( bool isWithEvents = false, bool hasDefaultInstanceVariable = false, bool isControl = false, - bool isDocument = false) + bool isDocument = false, + bool isUserForm = false) : base( qualifiedName, projectDeclaration, name, - isDocument ? DeclarationType.Document : DeclarationType.ClassModule, + isDocument ? DeclarationType.Document : isUserForm ? DeclarationType.UserForm : DeclarationType.ClassModule, isUserDefined, annotations, attributes, diff --git a/Rubberduck.Parsing/VBA/DeclarationResolving/DeclarationResolveRunnerBase.cs b/Rubberduck.Parsing/VBA/DeclarationResolving/DeclarationResolveRunnerBase.cs index 79f8c35265..5e0185c95e 100644 --- a/Rubberduck.Parsing/VBA/DeclarationResolving/DeclarationResolveRunnerBase.cs +++ b/Rubberduck.Parsing/VBA/DeclarationResolving/DeclarationResolveRunnerBase.cs @@ -199,6 +199,14 @@ private ModuleDeclaration NewModuleDeclaration( true, moduleAnnotations, moduleAttributes); + case ComponentType.UserForm: + return new ClassModuleDeclaration( + qualifiedModuleName.QualifyMemberName(qualifiedModuleName.ComponentName), + projectDeclaration, + qualifiedModuleName.ComponentName, + true, + moduleAnnotations, + moduleAttributes, isUserForm:true); case ComponentType.Document: return new DocumentModuleDeclaration( qualifiedModuleName.QualifyMemberName(qualifiedModuleName.ComponentName),