Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3509f35d
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,发现更多精彩内容 >>
提交
3509f35d
编写于
6月 14, 2019
作者:
P
Peng Lyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
separate inline and context actions for comment node
上级
8c00f566
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
8 deletion
+42
-8
src/vs/workbench/contrib/comments/browser/commentMenus.ts
src/vs/workbench/contrib/comments/browser/commentMenus.ts
+1
-1
src/vs/workbench/contrib/comments/browser/commentNode.ts
src/vs/workbench/contrib/comments/browser/commentNode.ts
+41
-7
未找到文件。
src/vs/workbench/contrib/comments/browser/commentMenus.ts
浏览文件 @
3509f35d
...
...
@@ -47,7 +47,7 @@ export class CommentMenus implements IDisposable {
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
createAndFillInContextMenuActions
(
menu
,
{
shouldForwardArgs
:
true
},
result
,
this
.
contextMenuService
,
g
=>
true
);
createAndFillInContextMenuActions
(
menu
,
{
shouldForwardArgs
:
true
},
result
,
this
.
contextMenuService
,
g
=>
/^inline/
.
test
(
g
)
);
return
menu
;
}
...
...
src/vs/workbench/contrib/comments/browser/commentNode.ts
浏览文件 @
3509f35d
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
ActionsOrientation
,
ActionViewItem
,
ActionBar
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ActionsOrientation
,
ActionViewItem
,
ActionBar
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
Button
}
from
'
vs/base/browser/ui/button/button
'
;
import
{
Action
,
IActionRunner
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -35,7 +35,7 @@ import { ToggleReactionsAction, ReactionAction, ReactionActionViewItem } from '.
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICommentThreadWidget
}
from
'
vs/workbench/contrib/comments/common/commentThreadWidget
'
;
import
{
MenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
MenuItemAction
,
SubmenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
ContextAwareMenuEntryActionViewItem
}
from
'
vs/platform/actions/browser/menuEntryActionViewItem
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -153,6 +153,7 @@ export class CommentNode extends Disposable {
private
createActionsToolbar
()
{
const
actions
:
IAction
[]
=
[];
const
secondaryActions
:
IAction
[]
=
[];
let
hasReactionHandler
=
this
.
commentService
.
hasReactionHandler
(
this
.
owner
);
...
...
@@ -188,12 +189,22 @@ export class CommentNode extends Disposable {
const
menu
=
commentMenus
.
getCommentTitleActions
(
this
.
comment
,
this
.
_contextKeyService
);
this
.
_register
(
menu
);
this
.
_register
(
menu
.
onDidChange
(
e
=>
{
const
contributedActions
=
menu
.
getActions
({
shouldForwardArgs
:
true
}).
reduce
((
r
,
[,
actions
])
=>
[...
r
,
...
actions
],
<
MenuItemAction
[]
>
[]);
this
.
toolbar
.
setActions
(
contributedActions
);
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
fillInActions
(
contributedActions
,
result
,
false
,
g
=>
/^inline/
.
test
(
g
));
this
.
toolbar
.
setActions
(
primary
,
secondary
);
}));
const
contributedActions
=
menu
.
getActions
({
shouldForwardArgs
:
true
}).
reduce
((
r
,
[,
actions
])
=>
[...
r
,
...
actions
],
<
MenuItemAction
[]
>
[]);
actions
.
push
(...
contributedActions
);
const
contributedActions
=
menu
.
getActions
({
shouldForwardArgs
:
true
});
{
const
primary
:
IAction
[]
=
[];
const
secondary
:
IAction
[]
=
[];
const
result
=
{
primary
,
secondary
};
fillInActions
(
contributedActions
,
result
,
false
,
g
=>
/^inline/
.
test
(
g
));
actions
.
push
(...
primary
);
secondaryActions
.
push
(...
secondary
);
}
if
(
actions
.
length
)
{
this
.
toolbar
=
new
ToolBar
(
this
.
_actionsToolbarContainer
,
this
.
contextMenuService
,
{
...
...
@@ -224,7 +235,7 @@ export class CommentNode extends Disposable {
};
this
.
registerActionBarListeners
(
this
.
_actionsToolbarContainer
);
this
.
toolbar
.
setActions
(
actions
,
[]
)();
this
.
toolbar
.
setActions
(
actions
,
secondaryActions
)();
this
.
_register
(
this
.
toolbar
);
}
}
...
...
@@ -727,4 +738,27 @@ export class CommentNode extends Disposable {
},
3000
);
}
}
}
function
fillInActions
(
groups
:
[
string
,
Array
<
MenuItemAction
|
SubmenuItemAction
>
][],
target
:
IAction
[]
|
{
primary
:
IAction
[];
secondary
:
IAction
[];
},
useAlternativeActions
:
boolean
,
isPrimaryGroup
:
(
group
:
string
)
=>
boolean
=
group
=>
group
===
'
navigation
'
):
void
{
for
(
let
tuple
of
groups
)
{
let
[
group
,
actions
]
=
tuple
;
if
(
useAlternativeActions
)
{
actions
=
actions
.
map
(
a
=>
(
a
instanceof
MenuItemAction
)
&&
!!
a
.
alt
?
a
.
alt
:
a
);
}
if
(
isPrimaryGroup
(
group
))
{
const
to
=
Array
.
isArray
<
IAction
>
(
target
)
?
target
:
target
.
primary
;
to
.
unshift
(...
actions
);
}
else
{
const
to
=
Array
.
isArray
<
IAction
>
(
target
)
?
target
:
target
.
secondary
;
if
(
to
.
length
>
0
)
{
to
.
push
(
new
Separator
());
}
to
.
push
(...
actions
);
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录