Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2500ab70
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,发现更多精彩内容 >>
提交
2500ab70
编写于
9月 22, 2020
作者:
C
Cyrus Najmabadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
before del
上级
57df9bf2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
58 addition
and
26 deletion
+58
-26
src/EditorFeatures/Core/Implementation/TodoComment/ITodoListProvider.cs
...ures/Core/Implementation/TodoComment/ITodoListProvider.cs
+3
-4
src/EditorFeatures/Core/Implementation/TodoComment/TodoItemBucket.cs
...eatures/Core/Implementation/TodoComment/TodoItemBucket.cs
+39
-0
src/Features/Core/Portable/Diagnostics/DiagnosticBucket.cs
src/Features/Core/Portable/Diagnostics/DiagnosticBucket.cs
+4
-4
src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseTodoListTable.cs
...entation/TableDataSource/VisualStudioBaseTodoListTable.cs
+11
-17
src/VisualStudio/Core/Def/Implementation/TodoComments/VisualStudioTodoCommentsService.cs
...mentation/TodoComments/VisualStudioTodoCommentsService.cs
+1
-1
未找到文件。
src/EditorFeatures/Core/Implementation/TodoComment/ITodoListProvider.cs
浏览文件 @
2500ab70
...
...
@@ -3,10 +3,8 @@
// See the LICENSE file in the project root for more information.
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Immutable
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.Common
;
using
Microsoft.CodeAnalysis.TodoComments
;
namespace
Microsoft.CodeAnalysis.Editor
...
...
@@ -27,8 +25,9 @@ internal interface ITodoListProvider
ImmutableArray
<
TodoCommentData
>
GetTodoItems
(
Workspace
workspace
,
DocumentId
documentId
,
CancellationToken
cancellationToken
);
/// <summary>
/// Get current UpdatedEventArgs stored in ITodoListProvider
/// Get current buckets stored our todo items are grouped into. Specific buckets can be retrieved by calling
/// <see cref="GetTodoItems"/>.
/// </summary>
I
Enumerable
<
UpdatedEventArgs
>
GetTodoItemsUpdatedEventArg
s
(
Workspace
workspace
,
CancellationToken
cancellationToken
);
I
mmutableArray
<
TodoItemBucket
>
GetTodoItemBucket
s
(
Workspace
workspace
,
CancellationToken
cancellationToken
);
}
}
src/EditorFeatures/Core/Implementation/TodoComment/TodoItemBucket.cs
0 → 100644
浏览文件 @
2500ab70
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#
nullable
enable
namespace
Microsoft.CodeAnalysis.Editor
{
internal
readonly
struct
TodoItemBucket
{
/// <summary>
/// The identity of bucket group.
/// </summary>
public
readonly
object
Id
;
/// <summary>
/// <see cref="Workspace"/> this bucket is associated with.
/// </summary>
public
readonly
Workspace
Workspace
;
/// <summary>
/// <see cref="ProjectId"/> this bucket is associated with, or <see langword="null"/>.
/// </summary>
public
readonly
ProjectId
?
ProjectId
;
/// <summary>
/// <see cref="DocumentId"/> this bucket is associated with, or <see langword="null"/>.
/// </summary>
public
readonly
DocumentId
?
DocumentId
;
public
TodoItemBucket
(
object
id
,
Workspace
workspace
,
ProjectId
?
projectId
,
DocumentId
?
documentId
)
{
Id
=
id
;
Workspace
=
workspace
;
ProjectId
=
projectId
;
DocumentId
=
documentId
;
}
}
}
src/Features/Core/Portable/Diagnostics/DiagnosticBucket.cs
浏览文件 @
2500ab70
...
...
@@ -9,22 +9,22 @@ namespace Microsoft.CodeAnalysis.Diagnostics
internal
readonly
struct
DiagnosticBucket
{
/// <summary>
/// The identity of
update
group.
/// The identity of
bucket
group.
/// </summary>
public
readonly
object
Id
;
/// <summary>
/// <see cref="Workspace"/> this
update
is associated with.
/// <see cref="Workspace"/> this
bucket
is associated with.
/// </summary>
public
readonly
Workspace
Workspace
;
/// <summary>
/// <see cref="ProjectId"/> this
update
is associated with, or <see langword="null"/>.
/// <see cref="ProjectId"/> this
bucket
is associated with, or <see langword="null"/>.
/// </summary>
public
readonly
ProjectId
?
ProjectId
;
/// <summary>
/// <see cref="DocumentId"/> this
update
is associated with, or <see langword="null"/>.
/// <see cref="DocumentId"/> this
bucket
is associated with, or <see langword="null"/>.
/// </summary>
public
readonly
DocumentId
?
DocumentId
;
...
...
src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseTodoListTable.cs
浏览文件 @
2500ab70
...
...
@@ -12,6 +12,7 @@
using
Microsoft.CodeAnalysis.Common
;
using
Microsoft.CodeAnalysis.Editor
;
using
Microsoft.CodeAnalysis.Text
;
using
Microsoft.CodeAnalysis.TodoComments
;
using
Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics
;
using
Microsoft.VisualStudio.Shell.Interop
;
using
Microsoft.VisualStudio.Shell.TableControl
;
...
...
@@ -67,7 +68,7 @@ protected override void RemoveTableSourceIfNecessary(Solution solution)
protected
override
void
ShutdownSource
()
=>
_source
.
Shutdown
();
private
class
TableDataSource
:
AbstractRoslynTableDataSource
<
TodoTableItem
,
UpdatedEvent
Args
>
private
class
TableDataSource
:
AbstractRoslynTableDataSource
<
TodoTableItem
,
TodoItemsUpdated
Args
>
{
private
readonly
Workspace
_workspace
;
private
readonly
string
_identifier
;
...
...
@@ -88,9 +89,9 @@ public TableDataSource(Workspace workspace, ITodoListProvider todoListProvider,
public
override
string
DisplayName
=>
ServicesVSResources
.
CSharp_VB_Todo_List_Table_Data_Source
;
public
override
string
SourceTypeIdentifier
=>
StandardTableDataSources
.
CommentTableDataSource
;
public
override
string
Identifier
=>
_identifier
;
public
override
object
GetItemKey
(
UpdatedEvent
Args
data
)
=>
data
.
DocumentId
;
public
override
object
GetItemKey
(
TodoItemsUpdated
Args
data
)
=>
data
.
DocumentId
;
protected
override
object
GetOrUpdateAggregationKey
(
UpdatedEvent
Args
data
)
protected
override
object
GetOrUpdateAggregationKey
(
TodoItemsUpdated
Args
data
)
{
var
key
=
TryGetAggregateKey
(
data
);
if
(
key
==
null
)
...
...
@@ -105,7 +106,7 @@ protected override object GetOrUpdateAggregationKey(UpdatedEventArgs data)
return
key
;
}
if
(!
CheckAggregateKey
((
ImmutableArray
<
DocumentId
>)
key
,
data
as
TodoItemsUpdatedArgs
))
if
(!
CheckAggregateKey
((
ImmutableArray
<
DocumentId
>)
key
,
data
))
{
RemoveStaledData
(
data
);
...
...
@@ -118,24 +119,19 @@ protected override object GetOrUpdateAggregationKey(UpdatedEventArgs data)
private
bool
CheckAggregateKey
(
ImmutableArray
<
DocumentId
>
key
,
TodoItemsUpdatedArgs
args
)
{
if
(
args
?.
DocumentId
==
null
||
args
?.
Solution
==
null
)
{
if
(
args
.
DocumentId
==
null
||
args
.
Solution
==
null
)
return
true
;
}
var
documents
=
GetDocumentsWithSameFilePath
(
args
.
Solution
,
args
.
DocumentId
);
return
key
==
documents
;
}
private
object
CreateAggregationKey
(
UpdatedEvent
Args
data
)
private
object
CreateAggregationKey
(
TodoItemsUpdated
Args
data
)
{
var
args
=
data
as
TodoItemsUpdatedArgs
;
if
(
args
?.
Solution
==
null
)
{
if
(
data
.
Solution
==
null
)
return
GetItemKey
(
data
);
}
return
GetDocumentsWithSameFilePath
(
args
.
Solution
,
args
.
DocumentId
);
return
GetDocumentsWithSameFilePath
(
data
.
Solution
,
data
.
DocumentId
);
}
public
override
AbstractTableEntriesSnapshot
<
TodoTableItem
>
CreateSnapshot
(
AbstractTableEntriesSource
<
TodoTableItem
>
source
,
int
version
,
ImmutableArray
<
TodoTableItem
>
items
,
ImmutableArray
<
ITrackingPoint
>
trackingPoints
)
...
...
@@ -152,10 +148,8 @@ public override IEnumerable<TodoTableItem> Order(IEnumerable<TodoTableItem> grou
private
void
PopulateInitialData
(
Workspace
workspace
,
ITodoListProvider
todoListService
)
{
foreach
(
var
args
in
todoListService
.
GetTodoItemsUpdatedEventArgs
(
workspace
,
cancellationToken
:
CancellationToken
.
None
))
{
OnDataAddedOrChanged
(
args
);
}
foreach
(
var
bucket
in
todoListService
.
GetTodoItemBuckets
(
workspace
,
cancellationToken
:
CancellationToken
.
None
))
OnDataAddedOrChanged
(
new
TodoItemsUpdatedArgs
(
bucket
.
Id
,
bucket
.
Workspace
,
solution
:
null
,
bucket
.
ProjectId
,
bucket
.
DocumentId
,
ImmutableArray
<
TodoCommentData
>.
Empty
));
}
private
void
OnTodoListUpdated
(
object
sender
,
TodoItemsUpdatedArgs
e
)
...
...
src/VisualStudio/Core/Def/Implementation/TodoComments/VisualStudioTodoCommentsService.cs
浏览文件 @
2500ab70
...
...
@@ -211,7 +211,7 @@ public ImmutableArray<TodoCommentData> GetTodoItems(Workspace workspace, Documen
:
ImmutableArray
<
TodoCommentData
>.
Empty
;
}
public
I
Enumerable
<
UpdatedEventArgs
>
GetTodoItemsUpdatedEventArg
s
(
public
I
mmutableArray
<
TodoItemBucket
>
GetTodoItemBucket
s
(
Workspace
workspace
,
CancellationToken
cancellationToken
)
{
// Don't need to implement this. OOP pushes all items over to VS. So there's no need
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录