Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
85d98e82
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,发现更多精彩内容 >>
提交
85d98e82
编写于
7月 19, 2017
作者:
C
CyrusNajmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Be resilient to getting back no spans to tag.
上级
46a8a989
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
10 deletion
+12
-10
src/EditorFeatures/Core/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs
...ceHighlighting/ReferenceHighlightingViewTaggerProvider.cs
+4
-1
src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs
...stractAsynchronousTaggerProvider.TagSource_ProduceTags.cs
+5
-6
src/EditorFeatures/Core/Tagging/TaggerContext.cs
src/EditorFeatures/Core/Tagging/TaggerContext.cs
+3
-3
未找到文件。
src/EditorFeatures/Core/ReferenceHighlighting/ReferenceHighlightingViewTaggerProvider.cs
浏览文件 @
85d98e82
...
...
@@ -69,6 +69,8 @@ protected override ITaggerEventSource CreateEventSource(ITextView textView, ITex
protected
override
IEnumerable
<
SnapshotSpan
>
GetSpansToTag
(
ITextView
textViewOpt
,
ITextBuffer
subjectBuffer
)
{
// Note: this may return no snapshot spans. We have to be resilient to that
// when processing the TaggerContext<>.SpansToTag below.
return
textViewOpt
.
BufferGraph
.
GetTextBuffers
(
b
=>
IsSupportedContentType
(
b
.
ContentType
))
.
Select
(
b
=>
b
.
CurrentSnapshot
.
GetFullSpan
())
.
ToList
();
...
...
@@ -91,7 +93,8 @@ protected override Task ProduceTagsAsync(TaggerContext<NavigableHighlightTag> co
return
SpecializedTasks
.
EmptyTask
;
}
var
document
=
context
.
SpansToTag
.
First
(
vt
=>
vt
.
SnapshotSpan
.
Snapshot
==
caretPosition
.
Snapshot
).
Document
;
// GetSpansToTag may have produced no actual spans to tag. Be resilient to that.
var
document
=
context
.
SpansToTag
.
FirstOrDefault
(
vt
=>
vt
.
SnapshotSpan
.
Snapshot
==
caretPosition
.
Snapshot
).
Document
;
if
(
document
==
null
)
{
return
SpecializedTasks
.
EmptyTask
;
...
...
src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs
浏览文件 @
85d98e82
...
...
@@ -335,7 +335,7 @@ private CancellationToken GetCancellationToken(bool initialTags)
?
_initialComputationCancellationTokenSource
.
Token
:
_workQueue
.
CancellationToken
;
private
List
<
DocumentSnapshotSpan
>
GetSpansAndDocumentsToTag
()
private
ImmutableArray
<
DocumentSnapshotSpan
>
GetSpansAndDocumentsToTag
()
{
_workQueue
.
AssertIsForeground
();
...
...
@@ -356,9 +356,8 @@ private List<DocumentSnapshotSpan> GetSpansAndDocumentsToTag()
// document can be null if the buffer the given span is part of is not part of our workspace.
return
new
DocumentSnapshotSpan
(
document
,
span
);
}).
To
List
();
}).
To
ImmutableArray
();
Debug
.
Assert
(
spansAndDocumentsToTag
.
Count
>
0
);
return
spansAndDocumentsToTag
;
}
...
...
@@ -573,7 +572,7 @@ private IEnumerable<ITagSpan<TTag>> GetNonIntersectingTagSpans(IEnumerable<Snaps
object
oldState
,
SnapshotPoint
?
caretPosition
,
TextChangeRange
?
textChangeRange
,
List
<
DocumentSnapshotSpan
>
spansToTag
,
ImmutableArray
<
DocumentSnapshotSpan
>
spansToTag
,
ImmutableDictionary
<
ITextBuffer
,
TagSpanIntervalTree
<
TTag
>>
oldTagTrees
,
bool
initialTags
,
CancellationToken
cancellationToken
)
...
...
@@ -618,7 +617,7 @@ private void ProduceTagsSynchronously(TaggerContext<TTag> context)
}
private
void
ProcessContext
(
List
<
DocumentSnapshotSpan
>
spansToTag
,
ImmutableArray
<
DocumentSnapshotSpan
>
spansToTag
,
ImmutableDictionary
<
ITextBuffer
,
TagSpanIntervalTree
<
TTag
>>
oldTagTrees
,
TaggerContext
<
TTag
>
context
,
bool
initialTags
)
...
...
@@ -636,7 +635,7 @@ private void ProduceTagsSynchronously(TaggerContext<TTag> context)
}
private
void
ProcessNewTagTrees
(
List
<
DocumentSnapshotSpan
>
spansToTag
,
ImmutableArray
<
DocumentSnapshotSpan
>
spansToTag
,
ImmutableDictionary
<
ITextBuffer
,
TagSpanIntervalTree
<
TTag
>>
oldTagTrees
,
ImmutableDictionary
<
ITextBuffer
,
TagSpanIntervalTree
<
TTag
>>
newTagTrees
,
object
newState
,
...
...
src/EditorFeatures/Core/Tagging/TaggerContext.cs
浏览文件 @
85d98e82
...
...
@@ -20,7 +20,7 @@ internal class TaggerContext<TTag> where TTag : ITag
internal
IEnumerable
<
DocumentSnapshotSpan
>
_spansTagged
;
internal
ImmutableArray
<
ITagSpan
<
TTag
>>.
Builder
tagSpans
=
ImmutableArray
.
CreateBuilder
<
ITagSpan
<
TTag
>>();
public
I
Enumerable
<
DocumentSnapshotSpan
>
SpansToTag
{
get
;
}
public
I
mmutableArray
<
DocumentSnapshotSpan
>
SpansToTag
{
get
;
}
public
SnapshotPoint
?
CaretPosition
{
get
;
}
/// <summary>
...
...
@@ -47,14 +47,14 @@ internal class TaggerContext<TTag> where TTag : ITag
SnapshotPoint
?
caretPosition
=
null
,
TextChangeRange
?
textChangeRange
=
null
,
CancellationToken
cancellationToken
=
default
)
:
this
(
null
,
new
[]
{
new
DocumentSnapshotSpan
(
document
,
snapshot
.
GetFullSpan
())
}
,
:
this
(
null
,
ImmutableArray
.
Create
(
new
DocumentSnapshotSpan
(
document
,
snapshot
.
GetFullSpan
()))
,
caretPosition
,
textChangeRange
,
null
,
cancellationToken
)
{
}
internal
TaggerContext
(
object
state
,
I
Enumerable
<
DocumentSnapshotSpan
>
spansToTag
,
I
mmutableArray
<
DocumentSnapshotSpan
>
spansToTag
,
SnapshotPoint
?
caretPosition
,
TextChangeRange
?
textChangeRange
,
ImmutableDictionary
<
ITextBuffer
,
TagSpanIntervalTree
<
TTag
>>
existingTags
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录