private IInspectionResult UnboundInspectionResult(IdentifierReference reference, IDeclarationFinderProvider declarationFinderProvider) { var result = new IdentifierReferenceInspectionResult( this, UnboundResultDescription(reference), declarationFinderProvider, reference); result.Properties.DisableFixes = "ExpandDefaultMemberQuickFix"; return(result); }
private IInspectionResult InspectionResult(IdentifierReference lhsReference, IdentifierReference rhsReference, bool isUnbound, IDeclarationFinderProvider declarationFinderProvider) { var result = new IdentifierReferenceInspectionResult( this, ResultDescription(lhsReference, rhsReference), declarationFinderProvider, lhsReference); result.Properties.RhSReference = rhsReference; if (isUnbound) { result.Properties.DisableFixes = "ExpandDefaultMemberQuickFix"; } return(result); }
private IVBComponent GetVBComponentMatchingSheetName(IdentifierReferenceInspectionResult reference) { // Second case accounts for global modules var indexExprContext = reference.Context.Parent.Parent as VBAParser.IndexExprContext ?? reference.Context.Parent as VBAParser.IndexExprContext; if (indexExprContext == null) { return(null); } var sheetArgumentContext = indexExprContext.argumentList().argument(0); var sheetName = FormatSheetName(sheetArgumentContext.GetText()); var project = State.Projects.First(p => p.ProjectId == reference.QualifiedName.ProjectId); return(project.VBComponents.FirstOrDefault(c => c.Type == ComponentType.Document && (string)c.Properties.First(property => property.Name == "Name").Value == sheetName)); }
private IVBComponent GetVBComponentMatchingSheetName(IdentifierReferenceInspectionResult reference) { // Second case accounts for global modules var indexExprContext = reference.Context.Parent.Parent as VBAParser.IndexExprContext ?? reference.Context.Parent as VBAParser.IndexExprContext; if (indexExprContext == null) { return(null); } var sheetArgumentContext = indexExprContext.argumentList().argument(0); var sheetName = FormatSheetName(sheetArgumentContext.GetText()); var project = State.ProjectsProvider.Project(reference.QualifiedName.ProjectId); using (var components = project.VBComponents) { foreach (var component in components) { using (var properties = component.Properties) { if (component.Type != ComponentType.Document) { component.Dispose(); continue; } foreach (var property in properties) { var found = property.Name.Equals("Name") && ((string)property.Value).Equals(sheetName); property.Dispose(); if (found) { return(component); } } } component.Dispose(); } return(null); } }