Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d15c0dce
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d15c0dce
编写于
4月 17, 2018
作者:
R
Rachel Macfarlane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Display message when PR has no comments
上级
0d39d57d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
50 addition
and
19 deletion
+50
-19
extensions/git-extended/src/prView/prProvider.ts
extensions/git-extended/src/prView/prProvider.ts
+1
-0
src/vs/workbench/api/electron-browser/mainThreadComments.ts
src/vs/workbench/api/electron-browser/mainThreadComments.ts
+1
-0
src/vs/workbench/parts/comments/common/commentModel.ts
src/vs/workbench/parts/comments/common/commentModel.ts
+14
-16
src/vs/workbench/parts/comments/electron-browser/commentsPanel.ts
...orkbench/parts/comments/electron-browser/commentsPanel.ts
+20
-3
src/vs/workbench/parts/comments/electron-browser/media/panel.css
...workbench/parts/comments/electron-browser/media/panel.css
+9
-0
src/vs/workbench/services/comments/electron-browser/commentService.ts
...ench/services/comments/electron-browser/commentService.ts
+5
-0
未找到文件。
extensions/git-extended/src/prView/prProvider.ts
浏览文件 @
d15c0dce
...
...
@@ -209,6 +209,7 @@ export class PRProvider implements vscode.TreeDataProvider<PRGroupTreeItem | Pul
ret
.
push
({
threadId
:
comment
.
id
,
resource
:
document
.
uri
,
range
,
comments
:
comments
.
map
(
comment
=>
{
return
{
...
...
src/vs/workbench/api/electron-browser/mainThreadComments.ts
浏览文件 @
d15c0dce
...
...
@@ -74,6 +74,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments
$unregisterCommentProvider
(
handle
:
number
):
void
{
this
.
_providers
.
delete
(
handle
);
this
.
_panelService
.
setPanelEnablement
(
COMMENTS_PANEL_ID
,
false
);
this
.
_commentService
.
removeAllComments
();
}
dispose
():
void
{
...
...
src/vs/workbench/parts/comments/common/commentModel.ts
浏览文件 @
d15c0dce
...
...
@@ -9,6 +9,7 @@ import URI from 'vs/base/common/uri';
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
Comment
,
CommentThread
}
from
'
vs/editor/common/modes
'
;
import
{
groupBy
}
from
'
vs/base/common/arrays
'
;
import
{
localize
}
from
'
vs/nls
'
;
export
class
CommentNode
{
threadId
:
string
;
...
...
@@ -56,36 +57,33 @@ export class ResourceCommentThreads {
export
class
CommentsModel
{
commentThreads
:
ResourceCommentThreads
[];
commentThreadsByResource
:
Map
<
string
,
ResourceCommentThreads
>
;
constructor
()
{
this
.
commentThreads
=
[];
this
.
commentThreadsByResource
=
new
Map
<
string
,
ResourceCommentThreads
>
();
}
public
setCommentThreadsForResource
(
resource
:
URI
,
commentThreads
:
CommentThread
[]):
boolean
{
if
(
!
commentThreads
.
length
||
this
.
commentThreadsByResource
.
get
(
resource
.
toString
()
))
{
return
false
;
public
setCommentThreads
(
commentThreads
:
CommentThread
[]):
void
{
const
commentThreadsByResource
=
new
Map
<
string
,
ResourceCommentThreads
>
();
for
(
const
group
of
groupBy
(
commentThreads
,
CommentsModel
.
_compareURIs
))
{
commentThreadsByResource
.
set
(
group
[
0
].
resource
,
new
ResourceCommentThreads
(
URI
.
parse
(
group
[
0
].
resource
),
group
))
;
}
this
.
commentThreadsByResource
.
set
(
resource
.
toString
(),
new
ResourceCommentThreads
(
resource
,
commentThreads
));
this
.
commentThreads
=
[];
this
.
commentThreadsByResource
.
forEach
((
v
,
i
,
m
)
=>
{
commentThreadsByResource
.
forEach
((
v
,
i
,
m
)
=>
{
this
.
commentThreads
.
push
(
v
);
});
}
return
true
;
public
hasCommentThreads
():
boolean
{
return
!!
this
.
commentThreads
.
length
;
}
public
setCommentThreads
(
commentThreads
:
CommentThread
[])
{
for
(
const
group
of
groupBy
(
commentThreads
,
CommentsModel
.
_compareURIs
))
{
this
.
commentThreadsByResource
.
set
(
group
[
0
].
resource
,
new
ResourceCommentThreads
(
URI
.
parse
(
group
[
0
].
resource
),
group
));
public
getMessage
():
string
{
if
(
!
this
.
commentThreads
.
length
)
{
return
localize
(
'
noComments
'
,
"
There are no comments on this review.
"
);
}
else
{
return
''
;
}
this
.
commentThreadsByResource
.
forEach
((
v
,
i
,
m
)
=>
{
this
.
commentThreads
.
push
(
v
);
});
}
private
static
_compareURIs
(
a
:
CommentThread
,
b
:
CommentThread
)
{
...
...
src/vs/workbench/parts/comments/electron-browser/commentsPanel.ts
浏览文件 @
d15c0dce
...
...
@@ -166,6 +166,8 @@ interface ICommentTemplateData {
export
class
CommentsPanel
extends
Panel
{
private
tree
:
WorkbenchTree
;
private
treeContainer
:
HTMLElement
;
private
messageBoxContainer
:
HTMLElement
;
private
messageBox
:
HTMLElement
;
private
commentsModel
:
CommentsModel
;
constructor
(
...
...
@@ -188,6 +190,7 @@ export class CommentsPanel extends Panel {
this
.
commentsModel
=
new
CommentsModel
();
this
.
createTree
();
this
.
createMessageBox
(
container
);
this
.
commentService
.
onDidSetAllCommentThreads
(
this
.
onAllCommentsChanged
,
this
);
...
...
@@ -196,16 +199,19 @@ export class CommentsPanel extends Panel {
private
onAllCommentsChanged
(
e
:
CommentThread
[])
{
this
.
commentsModel
.
setCommentThreads
(
e
);
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
!
this
.
commentsModel
.
hasCommentThreads
());
this
.
tree
.
refresh
().
then
(()
=>
{
console
.
log
(
'
tree refreshed
'
);
this
.
renderMessage
(
);
},
(
e
)
=>
{
console
.
log
(
e
);
});
}
private
render
():
TPromise
<
void
>
{
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
false
);
return
this
.
tree
.
setInput
(
this
.
commentsModel
);
dom
.
toggleClass
(
this
.
treeContainer
,
'
hidden
'
,
!
this
.
commentsModel
.
hasCommentThreads
());
return
this
.
tree
.
setInput
(
this
.
commentsModel
).
then
(()
=>
{
this
.
renderMessage
();
});
}
public
layout
(
dimensions
:
dom
.
Dimension
):
void
{
...
...
@@ -216,6 +222,17 @@ export class CommentsPanel extends Panel {
return
COMMENTS_PANEL_TITLE
;
}
private
createMessageBox
(
parent
:
HTMLElement
):
void
{
this
.
messageBoxContainer
=
dom
.
append
(
parent
,
dom
.
$
(
'
.message-box-container
'
));
this
.
messageBox
=
dom
.
append
(
this
.
messageBoxContainer
,
dom
.
$
(
'
span
'
));
this
.
messageBox
.
setAttribute
(
'
tabindex
'
,
'
0
'
);
}
private
renderMessage
():
void
{
this
.
messageBox
.
textContent
=
this
.
commentsModel
.
getMessage
();
dom
.
toggleClass
(
this
.
messageBoxContainer
,
'
hidden
'
,
this
.
commentsModel
.
hasCommentThreads
());
}
private
createTree
():
void
{
this
.
tree
=
this
.
instantiationService
.
createInstance
(
WorkbenchTree
,
this
.
treeContainer
,
{
dataSource
:
new
CommentsDataSource
(),
...
...
src/vs/workbench/parts/comments/electron-browser/media/panel.css
浏览文件 @
d15c0dce
...
...
@@ -36,4 +36,13 @@
display
:
inline-flex
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
.comments-panel
.comments-panel-container
.message-box-container
{
line-height
:
22px
;
padding-left
:
20px
;
}
.comments-panel
.comments-panel-container
.message-box-container
span
:focus
{
outline
:
none
;
}
\ No newline at end of file
src/vs/workbench/services/comments/electron-browser/commentService.ts
浏览文件 @
d15c0dce
...
...
@@ -24,6 +24,7 @@ export interface ICommentService {
readonly
onDidSetAllCommentThreads
:
Event
<
CommentThread
[]
>
;
setComments
(
resource
:
URI
,
commentThreads
:
CommentThread
[]):
void
;
setAllComments
(
commentsByResource
:
CommentThread
[]):
void
;
removeAllComments
():
void
;
}
export
class
CommentService
extends
Disposable
implements
ICommentService
{
...
...
@@ -47,4 +48,8 @@ export class CommentService extends Disposable implements ICommentService {
setAllComments
(
commentsByResource
:
CommentThread
[]):
void
{
this
.
_onDidSetAllCommentThreads
.
fire
(
commentsByResource
);
}
removeAllComments
():
void
{
this
.
_onDidSetAllCommentThreads
.
fire
([]);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录