Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b18139a6
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,发现更多精彩内容 >>
提交
b18139a6
编写于
3月 08, 2016
作者:
B
Balaji Krishnan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Insert traces for cases..
.. when completion can not have a session.
上级
dffda941
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
0 deletion
+37
-0
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs
...Core/Implementation/IntelliSense/Completion/Controller.cs
+6
-0
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_InvokeCompletionList.cs
...ntelliSense/Completion/Controller_InvokeCompletionList.cs
+2
-0
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
...ementation/IntelliSense/Completion/Controller_TypeChar.cs
+29
-0
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller.cs
浏览文件 @
b18139a6
...
...
@@ -3,6 +3,7 @@
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Diagnostics
;
using
Microsoft.CodeAnalysis.Completion
;
using
Microsoft.CodeAnalysis.Editor.Commands
;
using
Microsoft.CodeAnalysis.Editor.Options
;
...
...
@@ -146,6 +147,8 @@ private bool StartNewModelComputation(ICompletionService completionService, Comp
if
(
this
.
TextView
.
Selection
.
Mode
==
TextSelectionMode
.
Box
)
{
Trace
.
WriteLine
(
"Box selection, cannot have completion"
);
// No completion with multiple selection
return
false
;
}
...
...
@@ -154,6 +157,8 @@ private bool StartNewModelComputation(ICompletionService completionService, Comp
var
caret
=
TextView
.
GetCaretPoint
(
SubjectBuffer
);
if
(!
caret
.
HasValue
)
{
Trace
.
WriteLine
(
"Caret is not mappable to subject buffer, cannot have completion"
);
return
false
;
}
...
...
@@ -197,6 +202,7 @@ private ICompletionService GetCompletionService()
Workspace
workspace
;
if
(!
Workspace
.
TryGetWorkspace
(
this
.
SubjectBuffer
.
AsTextContainer
(),
out
workspace
))
{
Trace
.
WriteLine
(
"Failed to get a workspace, cannot have a completion session."
);
return
null
;
}
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_InvokeCompletionList.cs
浏览文件 @
b18139a6
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using
System
;
using
System.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.Commands
;
namespace
Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
...
...
@@ -31,6 +32,7 @@ void ICommandHandler<InvokeCompletionListCommandArgs>.ExecuteCommand(InvokeCompl
var
completionService
=
this
.
GetCompletionService
();
if
(
completionService
==
null
)
{
Trace
.
WriteLine
(
"Failed to get completion service, cannot have a completion session."
);
return
;
}
...
...
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_TypeChar.cs
浏览文件 @
b18139a6
...
...
@@ -2,6 +2,7 @@
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
Microsoft.CodeAnalysis.Completion
;
using
Microsoft.CodeAnalysis.Editor.Commands
;
...
...
@@ -27,6 +28,8 @@ CommandState ICommandHandler<TypeCharCommandArgs>.GetCommandState(TypeCharComman
void
ICommandHandler
<
TypeCharCommandArgs
>.
ExecuteCommand
(
TypeCharCommandArgs
args
,
Action
nextHandler
)
{
Trace
.
WriteLine
(
"Entered completion command handler for typechar."
);
AssertIsForeground
();
var
initialCaretPosition
=
GetCaretPointInViewBuffer
();
...
...
@@ -71,6 +74,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
// to proceed.
if
(
this
.
TextView
.
TypeCharWasHandledStrangely
(
this
.
SubjectBuffer
,
args
.
TypedChar
))
{
Trace
.
WriteLine
(
"typechar was handled by someone else, cannot have a completion session."
);
if
(
sessionOpt
!=
null
)
{
// If we're on a seam (razor) with a computation, and the user types a character
...
...
@@ -79,6 +84,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
// since the caret is no longer in our buffer.
if
(
isOnSeam
&&
this
.
IsCommitCharacter
(
args
.
TypedChar
))
{
Trace
.
WriteLine
(
"typechar was on seam and a commit char, cannot have a completion session."
);
this
.
CommitOnTypeChar
(
args
.
TypedChar
);
return
;
}
...
...
@@ -86,6 +93,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
this
.
SubjectBuffer
.
GetOption
(
InternalFeatureOnOffOptions
.
AutomaticPairCompletion
)
&&
this
.
IsCommitCharacter
(
args
.
TypedChar
))
{
Trace
.
WriteLine
(
"typechar was brace completion char and a commit char, cannot have a completion session."
);
// I don't think there is any better way than this. if typed char is one of auto brace completion char,
// we don't do multiple buffer change check
this
.
CommitOnTypeChar
(
args
.
TypedChar
);
...
...
@@ -93,6 +102,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
}
else
{
Trace
.
WriteLine
(
"we stop model computation, cannot have a completion session."
);
// If we were computing anything, we stop. We only want to process a typechar
// if it was a normal character.
this
.
StopModelComputation
();
...
...
@@ -105,6 +116,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
var
completionService
=
this
.
GetCompletionService
();
if
(
completionService
==
null
)
{
Trace
.
WriteLine
(
"handling typechar, completion service is null, cannot have a completion session."
);
return
;
}
...
...
@@ -122,6 +135,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
// computation and start computing the model in the background.
if
(
isTextuallyTriggered
)
{
Trace
.
WriteLine
(
"no completion session yet and this is a trigger char, starting model computation."
);
// First create the session that represents that we now have a potential
// completion list. Then tell it to start computing.
StartNewModelComputation
(
completionService
,
triggerInfo
,
filterItems
:
true
);
...
...
@@ -129,12 +144,16 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
}
else
{
Trace
.
WriteLine
(
"no completion session yet and this is NOT a trigger char, we won't have completion."
);
// No need to do anything. Just stay in the state where we have no session.
return
;
}
}
else
{
Trace
.
WriteLine
(
"we have a completion session."
);
sessionOpt
.
UpdateModelTrackingSpan
(
initialCaretPosition
);
// If the session is up, it may be in one of many states. It may know nothing
...
...
@@ -147,6 +166,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
{
if
(
isTextuallyTriggered
)
{
Trace
.
WriteLine
(
"computing completion again and filtering..."
);
// The character typed was something like "a". It can both filter a list if
// we have computed one, or it can trigger a new list. Ask the computation
// to compute again. If nothing has been computed, then it will try to
...
...
@@ -177,6 +198,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
// we have computed the list of completions.
if
(
this
.
IsFilterCharacter
(
args
.
TypedChar
))
{
Trace
.
WriteLine
(
"filtering the session..."
);
// Known to be a filter character for the currently selected item. So just
// filter the session.
sessionOpt
.
FilterModel
(
CompletionFilterReason
.
TypeChar
);
...
...
@@ -190,12 +213,16 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
// Now, commit if it was a commit character.
if
(
this
.
IsCommitCharacter
(
args
.
TypedChar
))
{
Trace
.
WriteLine
(
"committing the session..."
);
// Known to be a commit character for the currently selected item. So just
// commit the session.
this
.
CommitOnTypeChar
(
args
.
TypedChar
);
}
else
{
Trace
.
WriteLine
(
"dismissing the session..."
);
// Now dismiss the session.
this
.
StopModelComputation
();
}
...
...
@@ -205,6 +232,8 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
if
(
isTextuallyTriggered
)
{
Trace
.
WriteLine
(
"the char commit/dismiss -ed a session and is trigerring completion again. starting model computation."
);
// First create the session that represents that we now have a potential
// completion list.
StartNewModelComputation
(
completionService
,
triggerInfo
,
filterItems
:
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录