Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
4be3afe7
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,发现更多精彩内容 >>
提交
4be3afe7
编写于
3月 01, 2017
作者:
R
Ravi Chande
提交者:
GitHub
3月 01, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17468 from rchande/basicSignatureHelp
Port BasicSignatureHelp.xml to the new framework
上级
80e8a77c
c2496d20
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
258 addition
and
2 deletion
+258
-2
src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs
...onTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs
+218
-0
src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj
...Test/IntegrationTests/VisualStudioIntegrationTests.csproj
+1
-0
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
.../IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
+33
-2
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
...rationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
+6
-0
未找到文件。
src/VisualStudio/IntegrationTest/IntegrationTests/VisualBasic/BasicSignatureHelp.cs
0 → 100644
浏览文件 @
4be3afe7
using
Microsoft.CodeAnalysis
;
using
Microsoft.VisualStudio.IntegrationTest.Utilities
;
using
Microsoft.VisualStudio.IntegrationTest.Utilities.Common
;
using
Microsoft.VisualStudio.IntegrationTest.Utilities.Input
;
using
Roslyn.Test.Utilities
;
using
Xunit
;
namespace
Roslyn.VisualStudio.IntegrationTests.CSharp
{
[
Collection
(
nameof
(
SharedIntegrationHostFixture
))]
public
class
BasicSignatureHelp
:
AbstractEditorTest
{
protected
override
string
LanguageName
=>
LanguageNames
.
VisualBasic
;
private
const
string
Baseline
=
@"
Class C
Sub M()
$$
End Sub
Function Method(i As Integer) As C
Return Nothing
End Function
''' <summary>
''' Hello World 2.0!
''' </summary>
''' <param name=""i"">an integer, preferably 42.</param>
''' <param name=""i2"">an integer, anything you like.</param>
''' <returns>returns an object of type C</returns>
Function Method(i As Integer, i2 As Integer) As C
Return Nothing
End Function
''' <summary>
''' Hello Generic World!
''' </summary>
''' <typeparam name=""T1"">Type Param 1</typeparam>
''' <param name=""i"">Param 1 of type T1</param>
''' <returns>Null</returns>
Function GenericMethod(Of T1)(i As T1) As C
Return Nothing
End Function
Function GenericMethod(Of T1, T2)(i As T1, i2 As T2) As C
Return Nothing
End Function
''' <summary>
''' Complex Method Params
''' </summary>
''' <param name=""strings"">Jagged MultiDimensional Array</param>
''' <param name=""outArr"">Out Array</param>
''' <param name=""d"">Dynamic and Params param</param>
''' <returns>Null</returns>
Sub OutAndParam(ByRef strings As String()(,), ByRef outArr As String(), ParamArray d As Object)
End Sub
End Class
"
;
public
BasicSignatureHelp
(
VisualStudioInstanceFactory
instanceFactory
)
:
base
(
instanceFactory
,
nameof
(
BasicSignatureHelp
))
{
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
MethodSignatureHelp
()
{
SetUpEditor
(
Baseline
);
SendKeys
(
"Dim m=Method(1,"
);
InvokeSignatureHelp
();
VerifyCurrentSignature
(
"C.Method(i As Integer, i2 As Integer) As C\r\nHello World 2.0!"
);
VerifyCurrentParameter
(
"i2"
,
"an integer, anything you like."
);
VerifyParameters
(
(
"i"
,
"an integer, preferably 42."
),
(
"i2"
,
"an integer, anything you like."
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
GenericMethodSignatureHelp1
()
{
SetUpEditor
(
Baseline
);
SendKeys
(
"Dim gm = GenericMethod"
);
SendKeys
(
VirtualKey
.
Escape
);
SendKeys
(
"("
);
VerifyCurrentSignature
(
"C.GenericMethod(Of T1)(i As T1) As C\r\nHello Generic World!"
);
VerifyCurrentParameter
(
"i"
,
"Param 1 of type T1"
);
VerifyParameters
(
(
"i"
,
"Param 1 of type T1"
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
GenericMethodSignatureHelp2
()
{
SetUpEditor
(
@"
Imports System
Class C(Of T, R)
Sub M()
$$
End Sub
''' <summary>
''' Generic Method with 1 Type Param
''' </summary>
''' <typeparam name=""T1"">Type Parameter</typeparam>
''' <param name=""i"">param i of type T1</param>
Sub GenericMethod(Of T1)(i As T1)
End Sub
''' <summary>
''' Generic Method with 2 Type Params
''' </summary>
''' <typeparam name=""T1"">Type Parameter 1</typeparam>
''' <typeparam name=""T2"">Type Parameter 2</typeparam>
''' <param name=""i"">param i of type T1</param>
''' <param name=""i2"">param i2 of type T2</param>
''' <returns>Null</returns>
Function GenericMethod(Of T1, T2)(i As T1, i2 As T2) As C(Of T, R)
Return Nothing
End Function
End Class"
);
SendKeys
(
"GenericMethod"
);
SendKeys
(
VirtualKey
.
Escape
);
SendKeys
(
"(Of "
);
VerifyCurrentSignature
(
"C(Of T, R).GenericMethod(Of T1)(i As T1)\r\nGeneric Method with 1 Type Param"
);
VerifyCurrentParameter
(
"T1"
,
"Type Parameter"
);
VerifyParameters
(
(
"T1"
,
"Type Parameter"
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
GenericMethodSignatureHelp_InvokeSighelp
()
{
SetUpEditor
(
@"
Imports System
Class C
Sub M()
GenericMethod(Of String, $$Integer)(Nothing, 1)
End Sub
Function GenericMethod(Of T1)(i As T1) As C
Return Nothing
End Function
Function GenericMethod(Of T1, T2)(i As T1, i2 As T2) As C
Return Nothing
End Function
End Class"
);
InvokeSignatureHelp
();
VerifyCurrentSignature
(
"C.GenericMethod(Of T1, T2)(i As T1, i2 As T2) As C"
);
VerifyCurrentParameter
(
"T2"
,
""
);
VerifyParameters
(
(
"T1"
,
""
),
(
"T2"
,
""
));
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
VerifyActiveParameterChanges
()
{
SetUpEditor
(
@"
Module M
Sub Method(a As Integer, b As Integer)
$$
End Sub
End Module"
);
SendKeys
(
"Method("
);
VerifyCurrentSignature
(
"M.Method(a As Integer, b As Integer)"
);
VerifyCurrentParameter
(
"a"
,
""
);
SendKeys
(
"1, "
);
VerifyCurrentParameter
(
"b"
,
""
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
BufferTextReplacedWithSigHelpActiveWithLengthOfUpdatedTextLessThanPositionOfInvocationExpression
()
{
SetUpEditor
(
@"
Class C
Sub Foo()
End Sub
Sub Test()
$$
End Sub
End Class"
);
SendKeys
(
"Foo("
);
VerifyCurrentSignature
(
"C.Foo()"
);
Editor
.
SetText
(
@"
Class C
'Marker"
);
Assert
.
False
(
Editor
.
IsSignatureHelpActive
());
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
SignatureHelp
)]
public
void
JaggedMultidimensionalArray
()
{
SetUpEditor
(
Baseline
);
SendKeys
(
"Dim op = OutAndParam("
);
VerifyCurrentSignature
(
"C.OutAndParam(ByRef strings As String()(,), ByRef outArr As String(), ParamArray d As Object)\r\nComplex Method Params"
);
VerifyCurrentParameter
(
"strings"
,
"Jagged MultiDimensional Array"
);
VerifyParameters
(
(
"strings"
,
"Jagged MultiDimensional Array"
),
(
"outArr"
,
"Out Array"
),
(
"d"
,
"Dynamic and Params param"
));
}
}
}
src/VisualStudio/IntegrationTest/IntegrationTests/VisualStudioIntegrationTests.csproj
浏览文件 @
4be3afe7
...
...
@@ -38,6 +38,7 @@
<Compile
Include=
"VisualBasic\BasicChangeSignatureDialog.cs"
/>
<Compile
Include=
"VisualBasic\BasicFindReferences.cs"
/>
<Compile
Include=
"VisualBasic\BasicIntelliSense.cs"
/>
<Compile
Include=
"VisualBasic\BasicSignatureHelp.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\..\Compilers\Core\Portable\CodeAnalysis.csproj"
>
...
...
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs
浏览文件 @
4be3afe7
...
...
@@ -142,6 +142,10 @@ public void MoveCaret(int position)
view
.
Caret
.
MoveTo
(
point
);
});
/// <remarks>
/// This method does not wait for async operations before
/// querying the editor
/// </remarks>
public
string
[]
GetCompletionItems
()
=>
ExecuteOnActiveView
(
view
=>
{
...
...
@@ -158,6 +162,10 @@ public string[] GetCompletionItems()
return
selectedCompletionSet
.
Completions
.
Select
(
c
=>
c
.
DisplayText
).
ToArray
();
});
/// <remarks>
/// This method does not wait for async operations before
/// querying the editor
/// </remarks>
public
string
GetCurrentCompletionItem
()
=>
ExecuteOnActiveView
(
view
=>
{
...
...
@@ -173,6 +181,10 @@ public string GetCurrentCompletionItem()
return
selectedCompletionSet
.
SelectionStatus
.
Completion
.
DisplayText
;
});
/// <remarks>
/// This method does not wait for async operations before
/// querying the editor
/// </remarks>
public
bool
IsCompletionActive
()
=>
ExecuteOnActiveView
(
view
=>
{
...
...
@@ -180,12 +192,27 @@ public bool IsCompletionActive()
return
broker
.
IsCompletionActive
(
view
);
});
/// <remarks>
/// This method does not wait for async operations before
/// querying the editor
/// </remarks>
public
bool
IsSignatureHelpActive
()
=>
ExecuteOnActiveView
(
view
=>
{
var
broker
=
GetComponentModelService
<
ISignatureHelpBroker
>();
return
broker
.
IsSignatureHelpActive
(
view
);
});
/// <remarks>
/// This method does not wait for async operations before
/// querying the editor
/// </remarks>
public
Signature
[]
GetSignatures
()
=>
ExecuteOnActiveView
(
view
=>
{
var
broke
n
=
GetComponentModelService
<
ISignatureHelpBroker
>();
var
broke
r
=
GetComponentModelService
<
ISignatureHelpBroker
>();
var
sessions
=
broke
n
.
GetSessions
(
view
);
var
sessions
=
broke
r
.
GetSessions
(
view
);
if
(
sessions
.
Count
!=
1
)
{
throw
new
InvalidOperationException
(
$"Expected exactly one session in the signature help, but found
{
sessions
.
Count
}
"
);
...
...
@@ -194,6 +221,10 @@ public Signature[] GetSignatures()
return
sessions
[
0
].
Signatures
.
Select
(
s
=>
new
Signature
(
s
)).
ToArray
();
});
/// <remarks>
/// This method does not wait for async operations before
/// querying the editor
/// </remarks>
public
Signature
GetCurrentSignature
()
=>
ExecuteOnActiveView
(
view
=>
{
...
...
src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/Editor_OutOfProc.cs
浏览文件 @
4be3afe7
...
...
@@ -61,6 +61,12 @@ public bool IsCompletionActive()
return
_inProc
.
IsCompletionActive
();
}
public
bool
IsSignatureHelpActive
()
{
WaitForSignatureHelp
();
return
_inProc
.
IsSignatureHelpActive
();
}
public
Signature
[]
GetSignatures
()
{
WaitForSignatureHelp
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录