Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
26d50c89
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,发现更多精彩内容 >>
提交
26d50c89
编写于
9月 22, 2016
作者:
R
Ravi Chande
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add additional null checks/contract assertions for the result of GetCompletionService
上级
38697471
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
8 deletion
+28
-8
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.Session_FilterModel.cs
...IntelliSense/Completion/Controller.Session_FilterModel.cs
+2
-0
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs
...Core/Implementation/IntelliSense/Completion/Controller.cs
+5
-0
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Backspace.cs
...mentation/IntelliSense/Completion/Controller_Backspace.cs
+5
-2
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs
...plementation/IntelliSense/Completion/Controller_Commit.cs
+2
-0
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TabKey.cs
...plementation/IntelliSense/Completion/Controller_TabKey.cs
+9
-6
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
...ementation/IntelliSense/Completion/Controller_TypeChar.cs
+5
-0
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.Session_FilterModel.cs
浏览文件 @
26d50c89
...
...
@@ -210,7 +210,9 @@ internal partial class Session
// matches the text typed so far.
// Ask the language to determine which of the *matched* items it wants to select.
// We have a Document so GetCompletionService should always succeed.
var
service
=
this
.
Controller
.
GetCompletionService
();
Contract
.
ThrowIfNull
(
service
,
nameof
(
service
));
var
matchingCompletionItems
=
filterResults
.
Where
(
r
=>
r
.
MatchedFilterText
)
.
Select
(
t
=>
t
.
PresentationItem
.
Item
)
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs
浏览文件 @
26d50c89
...
...
@@ -151,6 +151,11 @@ internal override void OnModelUpdated(Model modelOpt)
AssertIsForeground
();
Contract
.
ThrowIfTrue
(
sessionOpt
!=
null
);
if
(
completionService
==
null
)
{
return
false
;
}
if
(
this
.
TextView
.
Selection
.
Mode
==
TextSelectionMode
.
Box
)
{
// No completion with multiple selection
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Backspace.cs
浏览文件 @
26d50c89
...
...
@@ -65,8 +65,11 @@ private void ExecuteBackspaceOrDelete(ITextView textView, Action nextHandler, bo
var
trigger
=
CompletionTrigger
.
CreateDeletionTrigger
(
deletedChar
.
GetValueOrDefault
());
var
completionService
=
this
.
GetCompletionService
();
this
.
StartNewModelComputation
(
completionService
,
trigger
,
filterItems
:
false
,
dismissIfEmptyAllowed
:
true
);
if
(
completionService
!=
null
)
{
this
.
StartNewModelComputation
(
completionService
,
trigger
,
filterItems
:
false
,
dismissIfEmptyAllowed
:
true
);
}
return
;
}
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs
浏览文件 @
26d50c89
...
...
@@ -92,6 +92,8 @@ private CompletionProvider GetCompletionProvider(CompletionItem item)
var
triggerSnapshot
=
model
.
TriggerSnapshot
;
var
completionService
=
CompletionService
.
GetService
(
triggerDocument
);
Contract
.
ThrowIfNull
(
completionService
,
nameof
(
completionService
));
completionChange
=
completionService
.
GetChangeAsync
(
triggerDocument
,
item
.
Item
,
commitChar
,
CancellationToken
.
None
).
WaitAndGetResult
(
CancellationToken
.
None
);
var
textChange
=
completionChange
.
TextChange
;
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TabKey.cs
浏览文件 @
26d50c89
...
...
@@ -8,6 +8,7 @@
using
Microsoft.CodeAnalysis.LanguageServices
;
using
Microsoft.CodeAnalysis.Shared.Extensions
;
using
Microsoft.CodeAnalysis.Text
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
{
...
...
@@ -26,10 +27,7 @@ void ICommandHandler<TabKeyCommandArgs>.ExecuteCommand(TabKeyCommandArgs args, A
if
(
sessionOpt
==
null
)
{
// The user may be trying to invoke snippets through question-tab
var
completionService
=
GetCompletionService
();
if
(
completionService
!=
null
&&
TryInvokeSnippetCompletion
(
args
,
completionService
))
if
(
TryInvokeSnippetCompletion
(
args
))
{
// We've taken care of the tab. Don't send it to the buffer.
return
;
...
...
@@ -57,7 +55,7 @@ void ICommandHandler<TabKeyCommandArgs>.ExecuteCommand(TabKeyCommandArgs args, A
}
}
private
bool
TryInvokeSnippetCompletion
(
TabKeyCommandArgs
args
,
CompletionService
completionService
)
private
bool
TryInvokeSnippetCompletion
(
TabKeyCommandArgs
args
)
{
var
subjectBuffer
=
args
.
SubjectBuffer
;
var
caretPoint
=
args
.
TextView
.
GetCaretPoint
(
subjectBuffer
).
Value
.
Position
;
...
...
@@ -99,7 +97,12 @@ private bool TryInvokeSnippetCompletion(TabKeyCommandArgs args, CompletionServic
return
false
;
}
var
rules
=
GetCompletionService
().
GetRules
();
// There's was a buffer-Document mapping. We should be able
// to get a CompletionService.
var
completionService
=
GetCompletionService
();
Contract
.
ThrowIfNull
(
completionService
,
nameof
(
completionService
));
var
rules
=
completionService
.
GetRules
();
if
(
rules
.
SnippetsRule
!=
SnippetsRule
.
IncludeAfterTypingIdentifierQuestionTab
)
{
return
false
;
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
浏览文件 @
26d50c89
...
...
@@ -317,6 +317,11 @@ private bool IsCommitCharacter(char ch)
}
var
completionService
=
GetCompletionService
();
if
(
completionService
==
null
)
{
return
false
;
}
var
textTypedSoFar
=
GetTextTypedSoFar
(
model
,
model
.
SelectedItem
.
Item
);
return
IsCommitCharacter
(
completionService
.
GetRules
(),
model
.
SelectedItem
.
Item
,
ch
,
textTypedSoFar
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录