private static void FixQualifierExpression([NotNull] ITextControl textControl, [NotNull] ICSharpExpression expression, [NotNull] ITypeElement ownerType) { var qualifierRange = expression.GetDocumentRange().TextRange; var comparer = DeclaredElementEqualityComparer.TypeElementComparer; // do not produce type qualifier when static method from containing type completed var typeDeclaration = expression.GetContainingTypeDeclaration(); if (typeDeclaration != null && comparer.Equals(typeDeclaration.DeclaredElement, ownerType)) { var reference = ReferenceExpressionNavigator.GetByQualifierExpression(expression).NotNull("reference != null"); var delimiter = reference.Delimiter; if (delimiter != null) { qualifierRange = qualifierRange.JoinRight(delimiter.GetDocumentRange().TextRange); } textControl.Document.ReplaceText(qualifierRange, string.Empty); } else { var keyword = CSharpTypeFactory.GetTypeKeyword(ownerType.GetClrName()); textControl.Document.ReplaceText(qualifierRange, keyword ?? "T"); } }