Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7285f791
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 搜索 >>
提交
7285f791
编写于
1月 13, 2021
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use menu
上级
9bfa4c1d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
14 deletion
+33
-14
src/vs/workbench/contrib/comments/browser/commentsView.ts
src/vs/workbench/contrib/comments/browser/commentsView.ts
+33
-14
未找到文件。
src/vs/workbench/contrib/comments/browser/commentsView.ts
浏览文件 @
7285f791
...
...
@@ -7,10 +7,9 @@ import 'vs/css!./media/panel';
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
basename
}
from
'
vs/base/common/resources
'
;
import
{
IAction
,
Action
}
from
'
vs/base/common/actions
'
;
import
{
CollapseAllAction
}
from
'
vs/base/browser/ui/tree/treeDefaults
'
;
import
{
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
CommentNode
,
CommentsModel
,
ResourceWithCommentThreads
,
ICommentThreadChangedEvent
}
from
'
vs/workbench/contrib/comments/common/commentModel
'
;
import
{
CommentController
}
from
'
vs/workbench/contrib/comments/browser/commentsEditorContribution
'
;
...
...
@@ -20,15 +19,19 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import
{
textLinkForeground
,
textLinkActiveForeground
,
focusBorder
,
textPreformatForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
ResourceLabels
}
from
'
vs/workbench/browser/labels
'
;
import
{
CommentsList
,
COMMENTS_VIEW_ID
,
COMMENTS_VIEW_TITLE
}
from
'
vs/workbench/contrib/comments/browser/commentsTreeViewer
'
;
import
{
ViewPane
,
IViewPaneOptions
}
from
'
vs/workbench/browser/parts/views/viewPane
'
;
import
{
ViewPane
,
IViewPaneOptions
,
ViewAction
}
from
'
vs/workbench/browser/parts/views/viewPane
'
;
import
{
IViewDescriptorService
,
IViewsService
}
from
'
vs/workbench/common/views
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ContextKeyAndExpr
,
ContextKeyEqualsExpr
,
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IUriIdentityService
}
from
'
vs/workbench/services/uriIdentity/common/uriIdentity
'
;
import
{
MenuId
,
registerAction2
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Codicon
}
from
'
vs/base/common/codicons
'
;
const
CONTEXT_KEY_HAS_COMMENTS
=
new
RawContextKey
<
boolean
>
(
'
commentsView.hasComments
'
,
false
);
export
class
CommentsPanel
extends
ViewPane
{
private
treeLabels
!
:
ResourceLabels
;
...
...
@@ -36,7 +39,7 @@ export class CommentsPanel extends ViewPane {
private
treeContainer
!
:
HTMLElement
;
private
messageBoxContainer
!
:
HTMLElement
;
private
commentsModel
!
:
CommentsModel
;
private
collapseAllAction
?:
IAction
;
private
readonly
hasCommentsContextKey
:
IContextKey
<
boolean
>
;
readonly
onDidChangeVisibility
=
this
.
onDidChangeBodyVisibility
;
...
...
@@ -56,6 +59,7 @@ export class CommentsPanel extends ViewPane {
@
IUriIdentityService
private
readonly
uriIdentityService
:
IUriIdentityService
)
{
super
(
options
,
keybindingService
,
contextMenuService
,
configurationService
,
contextKeyService
,
viewDescriptorService
,
instantiationService
,
openerService
,
themeService
,
telemetryService
);
this
.
hasCommentsContextKey
=
CONTEXT_KEY_HAS_COMMENTS
.
bindTo
(
contextKeyService
);
}
public
renderBody
(
container
:
HTMLElement
):
void
{
...
...
@@ -131,13 +135,10 @@ export class CommentsPanel extends ViewPane {
await
this
.
tree
.
setInput
(
this
.
commentsModel
);
}
public
getActions
():
IAction
[]
{
if
(
!
this
.
collapseAllAction
)
{
this
.
collapseAllAction
=
new
Action
(
'
vs.tree.collapse
'
,
nls
.
localize
(
'
collapseAll
'
,
"
Collapse All
"
),
'
collapse-all
'
,
true
,
()
=>
this
.
tree
?
new
CollapseAllAction
<
any
,
any
>
(
this
.
tree
,
true
).
run
()
:
Promise
.
resolve
());
this
.
_register
(
this
.
collapseAllAction
);
public
collapseAll
()
{
if
(
this
.
tree
)
{
new
CollapseAllAction
<
any
,
any
>
(
this
.
tree
,
true
).
run
();
}
return
[
this
.
collapseAllAction
];
}
public
layoutBody
(
height
:
number
,
width
:
number
):
void
{
...
...
@@ -245,9 +246,7 @@ export class CommentsPanel extends ViewPane {
private
async
refresh
():
Promise
<
void
>
{
if
(
this
.
isVisible
())
{
if
(
this
.
collapseAllAction
)
{
this
.
collapseAllAction
.
enabled
=
this
.
commentsModel
.
hasCommentThreads
();
}
this
.
hasCommentsContextKey
.
set
(
this
.
commentsModel
.
hasCommentThreads
());
this
.
treeContainer
.
classList
.
toggle
(
'
hidden
'
,
!
this
.
commentsModel
.
hasCommentThreads
());
this
.
renderMessage
();
...
...
@@ -283,3 +282,23 @@ CommandsRegistry.registerCommand({
viewsService
.
openView
(
COMMENTS_VIEW_ID
,
true
);
}
});
registerAction2
(
class
Collapse
extends
ViewAction
<
CommentsPanel
>
{
constructor
()
{
super
({
viewId
:
COMMENTS_VIEW_ID
,
id
:
'
comments.collapse
'
,
title
:
nls
.
localize
(
'
collapseAll
'
,
"
Collapse All
"
),
f1
:
false
,
icon
:
Codicon
.
collapseAll
,
menu
:
{
id
:
MenuId
.
ViewTitle
,
group
:
'
navigation
'
,
when
:
ContextKeyAndExpr
.
create
([
ContextKeyEqualsExpr
.
create
(
'
view
'
,
COMMENTS_VIEW_ID
),
CONTEXT_KEY_HAS_COMMENTS
])
}
});
}
runInView
(
_accessor
:
ServicesAccessor
,
view
:
CommentsPanel
)
{
view
.
collapseAll
();
}
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录