Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
4a79e90e
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,发现更多精彩内容 >>
提交
4a79e90e
编写于
6月 08, 2016
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11870 from CyrusNajmabadi/removeUnnecessary3
Remove unnecessary field.
上级
bebd101c
4a8ff341
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
22 addition
and
39 deletion
+22
-39
src/EditorFeatures/Core/Extensibility/Completion/CompletionHelper.cs
...eatures/Core/Extensibility/Completion/CompletionHelper.cs
+6
-18
src/EditorFeatures/Core/Extensibility/Completion/CompletionHelperFactory.cs
.../Core/Extensibility/Completion/CompletionHelperFactory.cs
+1
-1
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TabKey.cs
...plementation/IntelliSense/Completion/Controller_TabKey.cs
+4
-1
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
...ementation/IntelliSense/Completion/Controller_TypeChar.cs
+1
-2
src/EditorFeatures/Next/IntelliSense/Completion/Presentation/Roslyn15CompletionSet.cs
...lliSense/Completion/Presentation/Roslyn15CompletionSet.cs
+1
-2
src/EditorFeatures/Test/Completion/AbstractCompletionProviderTests.cs
...atures/Test/Completion/AbstractCompletionProviderTests.cs
+4
-4
src/EditorFeatures/Test2/IntelliSense/CompletionRulesTests.vb
...EditorFeatures/Test2/IntelliSense/CompletionRulesTests.vb
+2
-4
src/EditorFeatures/VisualBasic/Completion/VisualBasicCompletionHelper.vb
...res/VisualBasic/Completion/VisualBasicCompletionHelper.vb
+2
-6
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/AbstractVisualBasicCompletionProviderTests.vb
...onProviders/AbstractVisualBasicCompletionProviderTests.vb
+1
-1
未找到文件。
src/EditorFeatures/Core/Extensibility/Completion/CompletionHelper.cs
浏览文件 @
4a79e90e
...
...
@@ -15,20 +15,11 @@ namespace Microsoft.CodeAnalysis.Editor
{
internal
class
CompletionHelper
{
private
readonly
CompletionRules
_rules
;
private
readonly
string
_language
;
public
CompletionService
CompletionService
{
get
;
}
protected
CompletionHelper
(
CompletionService
completionService
)
protected
CompletionHelper
()
{
CompletionService
=
completionService
;
_language
=
CompletionService
.
Language
;
_rules
=
CompletionService
.
GetRules
();
}
public
static
CompletionHelper
GetHelper
(
Workspace
workspace
,
string
language
,
CompletionService
completionService
)
public
static
CompletionHelper
GetHelper
(
Workspace
workspace
,
string
language
)
{
var
ls
=
workspace
.
Services
.
GetLanguageServices
(
language
);
if
(
ls
!=
null
)
...
...
@@ -36,21 +27,18 @@ protected CompletionHelper(CompletionService completionService)
var
factory
=
ls
.
GetService
<
CompletionHelperFactory
>();
if
(
factory
!=
null
)
{
return
factory
.
CreateCompletionHelper
(
completionService
);
return
factory
.
CreateCompletionHelper
();
}
if
(
completionService
!=
null
)
{
return
new
CompletionHelper
(
completionService
);
}
return
new
CompletionHelper
();
}
return
null
;
}
public
static
CompletionHelper
GetHelper
(
Document
document
,
CompletionService
service
)
public
static
CompletionHelper
GetHelper
(
Document
document
)
{
return
GetHelper
(
document
.
Project
.
Solution
.
Workspace
,
document
.
Project
.
Language
,
service
);
return
GetHelper
(
document
.
Project
.
Solution
.
Workspace
,
document
.
Project
.
Language
);
}
public
IReadOnlyList
<
TextSpan
>
GetHighlightedSpans
(
CompletionItem
completionItem
,
string
filterText
)
...
...
src/EditorFeatures/Core/Extensibility/Completion/CompletionHelperFactory.cs
浏览文件 @
4a79e90e
...
...
@@ -8,6 +8,6 @@ namespace Microsoft.CodeAnalysis.Editor
{
internal
abstract
class
CompletionHelperFactory
:
ILanguageService
{
public
abstract
CompletionHelper
CreateCompletionHelper
(
CompletionService
completionService
);
public
abstract
CompletionHelper
CreateCompletionHelper
();
}
}
\ No newline at end of file
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TabKey.cs
浏览文件 @
4a79e90e
...
...
@@ -27,9 +27,12 @@ void ICommandHandler<TabKeyCommandArgs>.ExecuteCommand(TabKeyCommandArgs args, A
{
// The user may be trying to invoke snippets in VB
var
helper
=
GetCompletionHelper
();
var
completionService
=
GetCompletionService
();
if
(
helper
!=
null
&&
completionService
!=
null
&&
helper
.
QuestionTabInvokesSnippetCompletion
&&
TryInvokeSnippetCompletion
(
args
,
helper
.
C
ompletionService
))
TryInvokeSnippetCompletion
(
args
,
c
ompletionService
))
{
// We've taken care of the tab. Don't send it to the buffer.
return
;
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
浏览文件 @
4a79e90e
...
...
@@ -272,8 +272,7 @@ private CompletionHelper GetCompletionHelper()
var
document
=
this
.
SubjectBuffer
.
CurrentSnapshot
.
GetOpenDocumentInCurrentContextWithChanges
();
if
(
document
!=
null
)
{
return
CompletionHelper
.
GetHelper
(
document
,
document
.
GetLanguageService
<
CompletionService
>());
return
CompletionHelper
.
GetHelper
(
document
);
}
return
null
;
...
...
src/EditorFeatures/Next/IntelliSense/Completion/Presentation/Roslyn15CompletionSet.cs
浏览文件 @
4a79e90e
...
...
@@ -62,8 +62,7 @@ private CompletionHelper GetCompletionHelper()
var
document
=
GetDocument
();
if
(
document
!=
null
)
{
_completionHelper
=
CompletionHelper
.
GetHelper
(
document
,
document
.
Project
.
LanguageServices
.
GetService
<
CompletionService
>());
_completionHelper
=
CompletionHelper
.
GetHelper
(
document
);
}
}
...
...
src/EditorFeatures/Test/Completion/AbstractCompletionProviderTests.cs
浏览文件 @
4a79e90e
...
...
@@ -58,9 +58,9 @@ internal CompletionServiceWithProviders GetCompletionService(Workspace workspace
internal
abstract
CompletionServiceWithProviders
CreateCompletionService
(
Workspace
workspace
,
ImmutableArray
<
CompletionProvider
>
exclusiveProviders
);
internal
static
CompletionHelper
GetCompletionHelper
(
Document
document
,
CompletionService
service
)
internal
static
CompletionHelper
GetCompletionHelper
(
Document
document
)
{
return
CompletionHelper
.
GetHelper
(
document
,
service
);
return
CompletionHelper
.
GetHelper
(
document
);
}
internal
static
async
Task
<
CompletionContext
>
GetCompletionListContextAsync
(
...
...
@@ -310,7 +310,7 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
var
customCommitCompletionProvider
=
service
.
ExclusiveProviders
?[
0
]
as
ICustomCommitCompletionProvider
;
if
(
customCommitCompletionProvider
!=
null
)
{
var
completionRules
=
GetCompletionHelper
(
document
,
service
);
var
completionRules
=
GetCompletionHelper
(
document
);
var
textView
=
(
await
WorkspaceFixture
.
GetWorkspaceAsync
()).
Documents
.
Single
().
GetTextView
();
VerifyCustomCommitWorker
(
service
,
customCommitCompletionProvider
,
firstItem
,
completionRules
,
textView
,
textBuffer
,
codeBeforeCommit
,
expectedCodeAfterCommit
,
commitChar
);
}
...
...
@@ -416,7 +416,7 @@ private async Task VerifyCustomCommitProviderCheckResultsAsync(Document document
var
items
=
(
await
GetCompletionListAsync
(
service
,
document
,
position
,
CompletionTrigger
.
Default
)).
Items
;
var
firstItem
=
items
.
First
(
i
=>
CompareItems
(
i
.
DisplayText
,
itemToCommit
));
var
completionRules
=
GetCompletionHelper
(
document
,
service
);
var
completionRules
=
GetCompletionHelper
(
document
);
var
commitChar
=
commitCharOpt
??
'\t'
;
var
text
=
await
document
.
GetTextAsync
();
...
...
src/EditorFeatures/Test2/IntelliSense/CompletionRulesTests.vb
浏览文件 @
4a79e90e
...
...
@@ -48,8 +48,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
Private
Sub
TestMatches
(
v
As
String
,
wordsToMatch
()
As
String
)
Using
New
CultureContext
(
"tr-TR"
)
Dim
workspace
=
New
TestWorkspace
Dim
helper
=
CompletionHelper
.
GetHelper
(
workspace
,
LanguageNames
.
CSharp
,
workspace
.
Services
.
GetLanguageServices
(
LanguageNames
.
CSharp
).
GetService
(
Of
CompletionService
))
Dim
helper
=
CompletionHelper
.
GetHelper
(
workspace
,
LanguageNames
.
CSharp
)
For
Each
word
In
wordsToMatch
Dim
item
=
CompletionItem
.
Create
(
word
)
Assert
.
True
(
helper
.
MatchesFilterText
(
item
,
v
,
CompletionTrigger
.
Default
,
CompletionFilterReason
.
TypeChar
),
$
"Expected item {word} does not match {v}"
)
...
...
@@ -60,8 +59,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
Private
Sub
TestNotMatches
(
v
As
String
,
wordsToNotMatch
()
As
String
)
Using
New
CultureContext
(
"tr-TR"
)
Dim
workspace
=
New
TestWorkspace
Dim
helper
=
CompletionHelper
.
GetHelper
(
workspace
,
LanguageNames
.
CSharp
,
workspace
.
Services
.
GetLanguageServices
(
LanguageNames
.
CSharp
).
GetService
(
Of
CompletionService
))
Dim
helper
=
CompletionHelper
.
GetHelper
(
workspace
,
LanguageNames
.
CSharp
)
For
Each
word
In
wordsToNotMatch
Dim
item
=
CompletionItem
.
Create
(
word
)
Assert
.
False
(
helper
.
MatchesFilterText
(
item
,
v
,
CompletionTrigger
.
Default
,
CompletionFilterReason
.
TypeChar
),
$
"Unexpected item {word} matches {v}"
)
...
...
src/EditorFeatures/VisualBasic/Completion/VisualBasicCompletionHelper.vb
浏览文件 @
4a79e90e
...
...
@@ -22,8 +22,8 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Completion
Public
Sub
New
()
End
Sub
Public
Overrides
Function
CreateCompletionHelper
(
service
As
CompletionService
)
As
CompletionHelper
Return
New
VisualBasicCompletionHelper
(
service
)
Public
Overrides
Function
CreateCompletionHelper
()
As
CompletionHelper
Return
New
VisualBasicCompletionHelper
()
End
Function
End
Class
End
Class
...
...
@@ -31,10 +31,6 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.Completion
Friend
Class
VisualBasicCompletionHelper
Inherits
CompletionHelper
Public
Sub
New
(
completionService
As
CompletionService
)
MyBase
.
New
(
completionService
)
End
Sub
Public
Overrides
ReadOnly
Property
QuestionTabInvokesSnippetCompletion
As
Boolean
Get
Return
True
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/AbstractVisualBasicCompletionProviderTests.vb
浏览文件 @
4a79e90e
...
...
@@ -142,7 +142,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
Dim
completionList
=
Await
GetCompletionListAsync
(
service
,
document
,
position
,
CompletionTrigger
.
Default
)
Dim
item
=
completionList
.
Items
.
First
()
Dim
helper
=
CompletionHelper
.
GetHelper
(
document
,
service
)
Dim
helper
=
CompletionHelper
.
GetHelper
(
document
)
For
Each
ch
In
chars
Assert
.
True
(
Controller
.
IsCommitCharacter
(
service
.
GetRules
(),
item
,
ch
,
textTypedSoFar
),
$
"Expected '{ch}' to be a commit character"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录