Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d4b9d4c9
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,发现更多精彩内容 >>
提交
d4b9d4c9
编写于
7月 05, 2016
作者:
R
Ravi Chande
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Naming
上级
bbe46b6b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
10 deletion
+10
-10
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs
...plementation/IntelliSense/Completion/Controller_Commit.cs
+10
-10
未找到文件。
src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs
浏览文件 @
d4b9d4c9
...
@@ -78,14 +78,14 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
...
@@ -78,14 +78,14 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
if
(
provider
==
null
)
if
(
provider
==
null
)
{
{
var
viewBuffer
=
this
.
TextView
.
TextBuffer
;
var
viewBuffer
=
this
.
TextView
.
TextBuffer
;
var
commi
tDocument
=
model
.
TriggerSnapshot
.
AsText
().
GetDocumentWithFrozenPartialSemanticsAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
var
triggerSnapsho
tDocument
=
model
.
TriggerSnapshot
.
AsText
().
GetDocumentWithFrozenPartialSemanticsAsync
(
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
// Get the desired text changes for this item. Note that these changes are
// Get the desired text changes for this item. Note that these changes are
// specified in terms of the trigger snapshot.
// specified in terms of the trigger snapshot.
var
completionService
=
CompletionService
.
GetService
(
commi
tDocument
);
var
completionService
=
CompletionService
.
GetService
(
triggerSnapsho
tDocument
);
var
commi
tChange
=
completionService
.
GetChangeAsync
(
var
triggerSnapsho
tChange
=
completionService
.
GetChangeAsync
(
commi
tDocument
,
item
.
Item
,
commitChar
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
triggerSnapsho
tDocument
,
item
.
Item
,
commitChar
,
cancellationToken
).
WaitAndGetResult
(
cancellationToken
);
textChangesInTriggerSnapshot
=
commi
tChange
.
TextChanges
;
textChangesInTriggerSnapshot
=
triggerSnapsho
tChange
.
TextChanges
;
// Use character based diffing here to avoid overwriting the commit character placed into the editor.
// Use character based diffing here to avoid overwriting the commit character placed into the editor.
var
editOptions
=
new
EditOptions
(
new
StringDifferenceOptions
var
editOptions
=
new
EditOptions
(
new
StringDifferenceOptions
...
@@ -105,9 +105,9 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
...
@@ -105,9 +105,9 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
// Try mapping the item span against the trigger snapshot to the ViewBuffer's trigger snapshot.
// Try mapping the item span against the trigger snapshot to the ViewBuffer's trigger snapshot.
// Then map that forward to the ViewBuffer's current snapshot.
// Then map that forward to the ViewBuffer's current snapshot.
var
originalSpanInView
=
model
.
GetViewBufferSpan
(
triggerSnapshotTextChange
.
Span
).
TextSpan
.
ToSnapshotSpan
(
model
.
ViewTriggerSnapshot
);
var
originalSpanInView
=
model
.
GetViewBufferSpan
(
triggerSnapshotTextChange
.
Span
).
TextSpan
.
ToSnapshotSpan
(
model
.
ViewTriggerSnapshot
);
var
translatedOriginalSpanInView
=
originalSpanInView
.
TranslateTo
(
TextView
.
TextBuffer
.
CurrentSnapshot
,
SpanTrackingMode
.
EdgeInclusive
);
var
originalViewSpanTranslatedToCurrentViewSnapshot
=
originalSpanInView
.
TranslateTo
(
TextView
.
TextBuffer
.
CurrentSnapshot
,
SpanTrackingMode
.
EdgeInclusive
);
textChangesInCurrentViewSnapshot
.
Add
(
new
TextChange
(
translatedOriginalSpanInView
.
Span
.
ToTextSpan
(),
triggerSnapshotTextChange
.
NewText
));
textChangesInCurrentViewSnapshot
.
Add
(
new
TextChange
(
originalViewSpanTranslatedToCurrentViewSnapshot
.
Span
.
ToTextSpan
(),
triggerSnapshotTextChange
.
NewText
));
}
}
// Note: we currently create the edit on the textview's buffer. This is
// Note: we currently create the edit on the textview's buffer. This is
...
@@ -121,7 +121,7 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
...
@@ -121,7 +121,7 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
var
isLast
=
iChange
==
textChangesInCurrentViewSnapshot
.
Count
-
1
;
var
isLast
=
iChange
==
textChangesInCurrentViewSnapshot
.
Count
-
1
;
// add commit char to end of last change if not already included
// add commit char to end of last change if not already included
if
(
isLast
&&
!
commi
tChange
.
IncludesCommitCharacter
&&
commitChar
.
HasValue
)
if
(
isLast
&&
!
triggerSnapsho
tChange
.
IncludesCommitCharacter
&&
commitChar
.
HasValue
)
{
{
textChangeInView
=
new
TextChange
(
textChangeInView
=
new
TextChange
(
textChangeInView
.
Span
,
textChangeInView
.
NewText
+
commitChar
.
Value
);
textChangeInView
.
Span
,
textChangeInView
.
NewText
+
commitChar
.
Value
);
...
@@ -180,9 +180,9 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
...
@@ -180,9 +180,9 @@ private void Commit(PresentationItem item, Model model, char? commitChar, Cancel
}
}
// adjust the caret position if requested by completion service
// adjust the caret position if requested by completion service
if
(
commi
tChange
.
NewPosition
!=
null
)
if
(
triggerSnapsho
tChange
.
NewPosition
!=
null
)
{
{
var
target
=
new
SnapshotPoint
(
this
.
SubjectBuffer
.
CurrentSnapshot
,
commi
tChange
.
NewPosition
.
Value
);
var
target
=
new
SnapshotPoint
(
this
.
SubjectBuffer
.
CurrentSnapshot
,
triggerSnapsho
tChange
.
NewPosition
.
Value
);
this
.
TextView
.
TryMoveCaretToAndEnsureVisible
(
target
);
this
.
TextView
.
TryMoveCaretToAndEnsureVisible
(
target
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录