Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b60a08c5
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b60a08c5
编写于
7月 31, 2015
作者:
D
Dustin Campbell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CR Feedback: Doc comment and additional focused unit tests
上级
c7423cb8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
246 addition
and
7 deletion
+246
-7
src/EditorFeatures/Test2/EditorServicesTest2.vbproj
src/EditorFeatures/Test2/EditorServicesTest2.vbproj
+20
-7
src/EditorFeatures/Test2/LanguageServices/SyntaxFactsServiceTests.vb
...eatures/Test2/LanguageServices/SyntaxFactsServiceTests.vb
+220
-0
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
...anguageServices/SyntaxFactsService/ISyntaxFactsService.cs
+6
-0
未找到文件。
src/EditorFeatures/Test2/EditorServicesTest2.vbproj
浏览文件 @
b60a08c5
...
...
@@ -131,15 +131,27 @@
<DocumentationFile>
Roslyn.Services.Editor.UnitTests2.xml
</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Microsoft.VisualStudio.CoreUtility, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
><Private>
false
</Private></Reference>
<Reference
Include=
"Microsoft.VisualStudio.CoreUtility, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<Private>
false
</Private>
</Reference>
<Reference
Include=
"Microsoft.VisualStudio.Language.CallHierarchy, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
<Reference
Include=
"Microsoft.VisualStudio.Language.Intellisense, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
><Private>
false
</Private></Reference>
<Reference
Include=
"Microsoft.VisualStudio.Language.Intellisense, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<Private>
false
</Private>
</Reference>
<Reference
Include=
"Microsoft.VisualStudio.Platform.VSEditor, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
<Reference
Include=
"Microsoft.VisualStudio.Text.Data, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
><Private>
false
</Private></Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.Data, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<Private>
false
</Private>
</Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.Internal, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
<Reference
Include=
"Microsoft.VisualStudio.Text.Logic, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
><Private>
false
</Private></Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.UI, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
><Private>
false
</Private></Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.UI.Wpf, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
><Private>
false
</Private></Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.Logic, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<Private>
false
</Private>
</Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.UI, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<Private>
false
</Private>
</Reference>
<Reference
Include=
"Microsoft.VisualStudio.Text.UI.Wpf, Version=$(VisualStudioReferenceAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<Private>
false
</Private>
</Reference>
<Reference
Include=
"PresentationCore"
/>
<Reference
Include=
"PresentationFramework"
/>
<Reference
Include=
"System"
/>
...
...
@@ -182,6 +194,7 @@
<ItemGroup>
<Compile
Include=
"CallHierarchy\CallHierarchyTests.vb"
/>
<Compile
Include=
"Diagnostics\InMemoryAssemblyLoader.vb"
/>
<Compile
Include=
"LanguageServices\SyntaxFactsServiceTests.vb"
/>
<Compile
Include=
"Utilities\MockDocumentNavigationServiceProvider.vb"
/>
<Compile
Include=
"Utilities\MockSymbolNavigationServiceProvider.vb"
/>
<Compile
Include=
"CodeFixes\CodeFixServiceTests.vb"
/>
...
...
@@ -329,4 +342,4 @@
<Import
Project=
"..\..\..\build\Targets\Roslyn.Toolsets.Xunit.targets"
/>
<Import
Project=
"$(SolutionDir)\.nuget\NuGet.targets"
Condition=
"Exists('$(SolutionDir)\.nuget\NuGet.targets')"
/>
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
src/EditorFeatures/Test2/LanguageServices/SyntaxFactsServiceTests.vb
0 → 100644
浏览文件 @
b60a08c5
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports
System.Threading
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports
Microsoft.CodeAnalysis.LanguageServices
Imports
Microsoft.CodeAnalysis.Text
Imports
Roslyn.Utilities
Namespace
Microsoft.CodeAnalysis.Editor.UnitTests.LanguageServices
Public
Class
SyntaxFactsServiceTests
<
Fact
>
Public
Sub
CSharp_TestGetMemberBodySpanForSpeculativeBinding1
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
$$
void
M
()
{{
|
MemberBodySpan
:
var
x
=
42
;
|
}}
}
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
CSharp_TestGetMemberBodySpanForSpeculativeBinding2
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
void
$$
M
()
{{
|
MemberBodySpan
:
var
x
=
42
;
|
}}
}
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
CSharp_TestGetMemberBodySpanForSpeculativeBinding3
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
void
M
()
$$
{{
|
MemberBodySpan
:
var
x
=
42
;
|
}}
}
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
CSharp_TestGetMemberBodySpanForSpeculativeBinding4
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
void
M
()
{{
|
MemberBodySpan
:
var
$$
x
=
42
;
|
}}
}
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
CSharp_TestGetMemberBodySpanForSpeculativeBinding5
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"C#"
CommonReferences
=
"true"
>
<
Document
>
class
C
{
void
M
()
{
var
x
=
42
;
}
$$
}
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
VB_TestGetMemberBodySpanForSpeculativeBinding1
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"Visual Basic"
CommonReferences
=
"true"
>
<
Document
>
Class
C
$$
Sub
M
()
{
|
MemberBodySpan
:
Dim
x
=
42
|
}
End
Sub
End
Class
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
VB_TestGetMemberBodySpanForSpeculativeBinding2
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"Visual Basic"
CommonReferences
=
"true"
>
<
Document
>
Class
C
Sub
$$
M
()
{
|
MemberBodySpan
:
Dim
x
=
42
|
}
End
Sub
End
Class
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
VB_TestGetMemberBodySpanForSpeculativeBinding3
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"Visual Basic"
CommonReferences
=
"true"
>
<
Document
>
Class
C
Sub
M
()
$$
{
|
MemberBodySpan
:
Dim
x
=
42
|
}
End
Sub
End
Class
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
VB_TestGetMemberBodySpanForSpeculativeBinding4
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"Visual Basic"
CommonReferences
=
"true"
>
<
Document
>
Class
C
Sub
M
()
{
|
MemberBodySpan
:
Dim
$$
x
=
42
|
}
End
Sub
End
Class
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
<
Fact
>
Public
Sub
VB_TestGetMemberBodySpanForSpeculativeBinding5
()
Dim
definition
=
<
Workspace
>
<
Project
Language
=
"Visual Basic"
CommonReferences
=
"true"
>
<
Document
>
Class
C
Sub
M
()
Dim
x
=
42
End
Sub
$$
End
Class
</
Document
>
</
Project
>
</
Workspace
>
VerifyGetMemberBodySpanForSpeculativeBinding
(
definition
)
End
Sub
Private
Sub
VerifyGetMemberBodySpanForSpeculativeBinding
(
workspaceDefinition
As
XElement
)
Using
workspace
=
TestWorkspaceFactory
.
CreateWorkspace
(
workspaceDefinition
)
Dim
cursorDocument
=
workspace
.
DocumentWithCursor
Dim
cursorPosition
=
cursorDocument
.
CursorPosition
.
Value
Dim
document
=
workspace
.
CurrentSolution
.
GetDocument
(
cursorDocument
.
Id
)
Dim
root
=
document
.
GetSyntaxRootAsync
(
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
)
Dim
node
=
root
.
FindNode
(
New
TextSpan
(
cursorPosition
,
0
))
Dim
syntaxFactsService
=
document
.
GetLanguageService
(
Of
ISyntaxFactsService
)()
Dim
expected
=
If
(
cursorDocument
.
AnnotatedSpans
.
ContainsKey
(
"MemberBodySpan"
),
cursorDocument
.
AnnotatedSpans
!
MemberBodySpan
.
Single
(),
Nothing
)
Dim
actual
=
syntaxFactsService
.
GetMemberBodySpanForSpeculativeBinding
(
node
)
Assert
.
Equal
(
expected
,
actual
)
End
Using
End
Sub
End
Class
End
Namespace
\ No newline at end of file
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs
浏览文件 @
b60a08c5
...
...
@@ -136,6 +136,12 @@ internal interface ISyntaxFactsService : ILanguageService
int
GetMethodLevelMemberId
(
SyntaxNode
root
,
SyntaxNode
node
);
SyntaxNode
GetMethodLevelMember
(
SyntaxNode
root
,
int
memberId
);
/// <summary>
/// Given a <see cref="SyntaxNode"/>, return the <see cref="TextSpan"/> representing the span of the member body
/// it is contained within. This <see cref="TextSpan"/> is used to determine whether speculative binding should be
/// used in performance-critical typing scenarios. Note: if this method fails to find a relevant span, it returns
/// an empty <see cref="TextSpan"/> at position 0.
/// </summary>
TextSpan
GetMemberBodySpanForSpeculativeBinding
(
SyntaxNode
node
);
/// <summary>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录