Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
3323aeee
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,发现更多精彩内容 >>
提交
3323aeee
编写于
6月 07, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tests.
上级
860ab0aa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
15 deletion
+22
-15
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AbstractCSharpCompletionProviderTests.cs
...pletionProviders/AbstractCSharpCompletionProviderTests.cs
+3
-4
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
...ementation/IntelliSense/Completion/Controller_TypeChar.cs
+8
-2
src/EditorFeatures/Test/Completion/AbstractCompletionProviderTests.cs
...atures/Test/Completion/AbstractCompletionProviderTests.cs
+8
-7
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/AbstractVisualBasicCompletionProviderTests.vb
...onProviders/AbstractVisualBasicCompletionProviderTests.vb
+3
-2
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AbstractCSharpCompletionProviderTests.cs
浏览文件 @
3323aeee
...
...
@@ -7,6 +7,7 @@
using
Microsoft.CodeAnalysis.Completion
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.CSharp.Completion
;
using
Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Completion
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
;
using
Microsoft.CodeAnalysis.Text
;
...
...
@@ -216,16 +217,14 @@ protected async Task VerifyCommitCharactersAsync(string initialMarkup, string te
var
completionList
=
await
GetCompletionListAsync
(
service
,
document
,
position
,
CompletionTrigger
.
Default
);
var
item
=
completionList
.
Items
.
First
(
i
=>
i
.
DisplayText
.
StartsWith
(
textTypedSoFar
));
var
completionRules
=
CompletionHelper
.
GetHelper
(
document
,
service
);
foreach
(
var
ch
in
validChars
)
{
Assert
.
True
(
completionRules
.
IsCommitCharacter
(
item
,
ch
,
textTypedSoFar
),
$"Expected '
{
ch
}
' to be a commit character"
);
Assert
.
True
(
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
item
,
ch
,
textTypedSoFar
),
$"Expected '
{
ch
}
' to be a commit character"
);
}
foreach
(
var
ch
in
invalidChars
)
{
Assert
.
False
(
completionRules
.
IsCommitCharacter
(
item
,
ch
,
textTypedSoFar
),
$"Expected '
{
ch
}
' NOT to be a commit character"
);
Assert
.
False
(
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
item
,
ch
,
textTypedSoFar
),
$"Expected '
{
ch
}
' NOT to be a commit character"
);
}
}
}
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
浏览文件 @
3323aeee
...
...
@@ -317,7 +317,10 @@ private bool IsCommitCharacter(char ch)
completionService
.
GetRules
(),
model
.
SelectedItem
.
Item
,
ch
,
filterText
);
}
private
bool
IsCommitCharacter
(
/// <summary>
/// Internal for testing purposes only.
/// </summary>
internal
static
bool
IsCommitCharacter
(
CompletionRules
completionRules
,
CompletionItem
item
,
char
ch
,
string
filterText
)
{
// general rule: if the filtering text exactly matches the start of the item then it must be a filter character
...
...
@@ -380,7 +383,10 @@ private static bool TextTypedSoFarMatchesItem(CompletionItem item, char ch, stri
item
.
FilterText
.
StartsWith
(
textTypedWithChar
,
StringComparison
.
CurrentCultureIgnoreCase
);
}
private
bool
IsFilterCharacter
(
CompletionItem
item
,
char
ch
,
string
filterText
)
/// <summary>
/// Internal for testing purposes only.
/// </summary>
internal
static
bool
IsFilterCharacter
(
CompletionItem
item
,
char
ch
,
string
filterText
)
{
// general rule: if the filtering text exactly matches the start of the item then it must be a filter character
if
(
TextTypedSoFarMatchesItem
(
item
,
ch
,
textTypedSoFar
:
filterText
))
...
...
src/EditorFeatures/Test/Completion/AbstractCompletionProviderTests.cs
浏览文件 @
3323aeee
...
...
@@ -9,6 +9,7 @@
using
System.Windows.Threading
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Completion
;
using
Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
;
using
Microsoft.CodeAnalysis.LanguageServices
;
using
Microsoft.CodeAnalysis.Options
;
...
...
@@ -313,7 +314,7 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
{
var
completionRules
=
GetCompletionHelper
(
document
,
service
);
var
textView
=
(
await
WorkspaceFixture
.
GetWorkspaceAsync
()).
Documents
.
Single
().
GetTextView
();
VerifyCustomCommitWorker
(
customCommitCompletionProvider
,
firstItem
,
completionRules
,
textView
,
textBuffer
,
codeBeforeCommit
,
expectedCodeAfterCommit
,
commitChar
);
VerifyCustomCommitWorker
(
service
,
customCommitCompletionProvider
,
firstItem
,
completionRules
,
textView
,
textBuffer
,
codeBeforeCommit
,
expectedCodeAfterCommit
,
commitChar
);
}
else
{
...
...
@@ -333,9 +334,7 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
string
actualExpectedCode
=
null
;
MarkupTestFile
.
GetPosition
(
expectedCodeAfterCommit
,
out
actualExpectedCode
,
out
expectedCaretPosition
);
CompletionHelper
completionRules
=
GetCompletionHelper
(
document
,
service
);
if
(
commitChar
.
HasValue
&&
!
completionRules
.
IsCommitCharacter
(
completionItem
,
commitChar
.
Value
,
string
.
Empty
))
if
(
commitChar
.
HasValue
&&
!
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
completionItem
,
commitChar
.
Value
,
string
.
Empty
))
{
Assert
.
Equal
(
codeBeforeCommit
,
actualExpectedCode
);
return
;
...
...
@@ -359,6 +358,7 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
}
internal
virtual
void
VerifyCustomCommitWorker
(
CompletionService
service
,
ICustomCommitCompletionProvider
customCommitCompletionProvider
,
CompletionItem
completionItem
,
CompletionHelper
completionRules
,
...
...
@@ -372,7 +372,7 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
string
actualExpectedCode
=
null
;
MarkupTestFile
.
GetPosition
(
expectedCodeAfterCommit
,
out
actualExpectedCode
,
out
expectedCaretPosition
);
if
(
commitChar
.
HasValue
&&
!
completionRules
.
IsCommitCharacter
(
completionItem
,
commitChar
.
Value
,
string
.
Empty
))
if
(
commitChar
.
HasValue
&&
!
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
completionItem
,
commitChar
.
Value
,
string
.
Empty
))
{
Assert
.
Equal
(
codeBeforeCommit
,
actualExpectedCode
);
return
;
...
...
@@ -407,7 +407,8 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
}
}
private
async
Task
VerifyProviderCommitCheckResultsAsync
(
Document
document
,
int
position
,
string
itemToCommit
,
string
expectedCodeAfterCommit
,
char
?
commitCharOpt
,
string
textTypedSoFar
)
private
async
Task
VerifyProviderCommitCheckResultsAsync
(
Document
document
,
int
position
,
string
itemToCommit
,
string
expectedCodeAfterCommit
,
char
?
commitCharOpt
,
string
textTypedSoFar
)
{
var
workspace
=
await
WorkspaceFixture
.
GetWorkspaceAsync
();
var
textBuffer
=
workspace
.
Documents
.
Single
().
TextBuffer
;
...
...
@@ -422,7 +423,7 @@ private async Task VerifyProviderCommitCheckResultsAsync(Document document, int
var
text
=
await
document
.
GetTextAsync
();
if
(
commitChar
==
'\t'
||
completionRules
.
IsCommitCharacter
(
firstItem
,
commitChar
,
textTypedSoFar
))
if
(
commitChar
==
'\t'
||
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
firstItem
,
commitChar
,
textTypedSoFar
))
{
var
textChange
=
CompletionHelper
.
GetTextChangeAsync
(
service
,
document
,
firstItem
,
commitChar
).
Result
;
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/AbstractVisualBasicCompletionProviderTests.vb
浏览文件 @
3323aeee
...
...
@@ -3,6 +3,7 @@
Imports
System.Collections.Immutable
Imports
Microsoft.CodeAnalysis
Imports
Microsoft.CodeAnalysis.Completion
Imports
Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.Completion
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports
Microsoft.CodeAnalysis.Text
...
...
@@ -145,11 +146,11 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
Dim
helper
=
CompletionHelper
.
GetHelper
(
document
,
service
)
For
Each
ch
In
chars
Assert
.
True
(
helper
.
IsCommitCharacter
(
item
,
ch
,
textTypedSoFar
),
$
"Expected '{ch}' to be a commit character"
)
Assert
.
True
(
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
item
,
ch
,
textTypedSoFar
),
$
"Expected '{ch}' to be a commit character"
)
Next
Dim
chr
=
"x"
c
Assert
.
False
(
helper
.
IsCommitCharacter
(
item
,
chr
,
textTypedSoFar
),
$
"Expected '{chr}' NOT to be a commit character"
)
Assert
.
False
(
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
item
,
chr
,
textTypedSoFar
),
$
"Expected '{chr}' NOT to be a commit character"
)
End
Using
End
Function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录