提交 ee7d9c3b 编写于 作者: C CyrusNajmabadi

Merge pull request #5193 from CyrusNajmabadi/lowerCaseType

Don't offer 'Generate Type' on lowercase names in VB
......@@ -49,6 +49,12 @@ NewLines("Class C \n dim f as Foo \n End Class \n Friend Class Foo \n End Class"
index:=1)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)>
Public Sub TestMissingOnLowercaseName()
TestMissing(
NewLines("Class C \n dim f as [|foo|] \n End Class"))
End Sub
<WorkItem(539716)>
<Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateType)>
Public Sub TestGenerateClassFromFullyQualifiedFieldIntoSameNamespace()
......
......@@ -111,6 +111,16 @@ private State(Compilation compilation)
return false;
}
if (char.IsLower(name[0]) && !document.SemanticModel.Compilation.IsCaseSensitive)
{
// It's near universal in .Net that types start with a capital letter. As such,
// if this name starts with a lowercase letter, don't even bother to offer
// "generate type". The user most likely wants to run 'Add Import' (which will
// then fix up a case where they typed an existing type name in lowercase,
// intending the fix to case correct it).
return false;
}
this.NameOrMemberAccessExpression = generateTypeServiceStateOptions.NameOrMemberAccessExpression;
this.ObjectCreationExpressionOpt = generateTypeServiceStateOptions.ObjectCreationExpressionOpt;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册