提交 3601e907 编写于 作者: K Kevin Halverson

Merge pull request #3678 from KevinH-MS/master

Further refinement for GetCurrentBlock in Script code...
......@@ -205,21 +205,24 @@ namespace N
<Fact, Trait(Traits.Feature, Traits.Features.VsLanguageBlock)>
Public Sub GetCurrentBlock_NotInGlobalCode_CS()
VerifyNoBlock("
S$$ystem.Console.WriteLine(""Hello"");
var message = ""Hello"";
System.Console$$.WriteLine(message);
", LanguageNames.CSharp, SourceCodeKind.Script)
End Sub
<Fact, Trait(Traits.Feature, Traits.Features.VsLanguageBlock)>
Public Sub GetCurrentBlock_NotInGlobalCode_VB()
VerifyNoBlock("
S$$ystem.Console.WriteLine(""Hello"")
Dim message = ""Hello""
System.Console$$.WriteLine(message)
", LanguageNames.VisualBasic, SourceCodeKind.Script)
End Sub
Private Sub VerifyNoBlock(markup As String, languageName As String, Optional sourceCodeKind As SourceCodeKind = SourceCodeKind.Regular)
Dim xml = <Workspace>
<Project Language=<%= languageName %> CommonReferences="True">
<Document Kind=<%= sourceCodeKind %>>
<Document>
<ParseOptions Kind=<%= sourceCodeKind %>/>
<%= markup %>
</Document>
</Project>
......
......@@ -724,7 +724,7 @@ public SyntaxNode GetContainingMemberDeclaration(SyntaxNode root, int position,
{
if (useFullSpan || node.Span.Contains(position))
{
if (node is MemberDeclarationSyntax)
if ((node.Kind() != SyntaxKind.GlobalStatement) && (node is MemberDeclarationSyntax))
{
return node;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册