From 26ca2ba448f6bc3280df934c435c013e6392fa52 Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Fri, 20 May 2016 16:47:10 -0700 Subject: [PATCH] Be less aggressive when offering to generate a method in VB. --- .../GenerateParameterizedMemberCodeFixProvider.vb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Features/VisualBasic/Portable/CodeFixes/GenerateParameterizedMember/GenerateParameterizedMemberCodeFixProvider.vb b/src/Features/VisualBasic/Portable/CodeFixes/GenerateParameterizedMember/GenerateParameterizedMemberCodeFixProvider.vb index 0cd59a2f568..0f4dc785233 100644 --- a/src/Features/VisualBasic/Portable/CodeFixes/GenerateParameterizedMember/GenerateParameterizedMemberCodeFixProvider.vb +++ b/src/Features/VisualBasic/Portable/CodeFixes/GenerateParameterizedMember/GenerateParameterizedMemberCodeFixProvider.vb @@ -43,6 +43,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod End Function Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean + ' If we have a diagnostic on "a.b.c" in something like a.b.c(...), then don't try to + ' perform fixes on 'a' or 'a.b'. + Dim diagnosticSpan = diagnostic.Location.SourceSpan + If node.Span.Start = diagnosticSpan.Start AndAlso node.Span.End < diagnosticSpan.End Then + Return False + End If + Return TypeOf node Is QualifiedNameSyntax OrElse TypeOf node Is SimpleNameSyntax OrElse TypeOf node Is MemberAccessExpressionSyntax OrElse -- GitLab