Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b4d581b7
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,发现更多精彩内容 >>
提交
b4d581b7
编写于
2月 21, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make debug toolbar customisable
fixes #45116
上级
beabc815
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
11 deletion
+45
-11
src/vs/platform/actions/common/actions.ts
src/vs/platform/actions/common/actions.ts
+1
-0
src/vs/workbench/api/common/menusExtensionPoint.ts
src/vs/workbench/api/common/menusExtensionPoint.ts
+1
-0
src/vs/workbench/contrib/debug/browser/debugToolbar.ts
src/vs/workbench/contrib/debug/browser/debugToolbar.ts
+27
-10
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
+16
-1
未找到文件。
src/vs/platform/actions/common/actions.ts
浏览文件 @
b4d581b7
...
...
@@ -65,6 +65,7 @@ export const enum MenuId {
DebugConsoleContext
,
DebugVariablesContext
,
DebugWatchContext
,
DebugToolbar
,
EditorContext
,
EditorTitle
,
EditorTitleContext
,
...
...
src/vs/workbench/api/common/menusExtensionPoint.ts
浏览文件 @
b4d581b7
...
...
@@ -34,6 +34,7 @@ namespace schema {
case
'
explorer/context
'
:
return
MenuId
.
ExplorerContext
;
case
'
editor/title/context
'
:
return
MenuId
.
EditorTitleContext
;
case
'
debug/callstack/context
'
:
return
MenuId
.
DebugCallStackContext
;
case
'
debug/toolbar
'
:
return
MenuId
.
DebugToolbar
;
case
'
scm/title
'
:
return
MenuId
.
SCMTitle
;
case
'
scm/sourceControl
'
:
return
MenuId
.
SCMSourceControl
;
case
'
scm/resourceGroup/context
'
:
return
MenuId
.
SCMResourceGroupContext
;
...
...
src/vs/workbench/contrib/debug/browser/debugToolbar.ts
浏览文件 @
b4d581b7
...
...
@@ -24,12 +24,15 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
registerColor
,
contrastBorder
,
widgetShadow
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextViewService
,
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
isExtensionHostDebugging
}
from
'
vs/workbench/contrib/debug/common/debugUtils
'
;
import
{
fillInActionBarActions
,
MenuItemActionItem
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
IMenu
,
IMenuService
,
MenuId
,
MenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
const
DEBUG_TOOLBAR_POSITION_KEY
=
'
debug.actionswidgetposition
'
;
const
DEBUG_TOOLBAR_Y_KEY
=
'
debug.actionswidgety
'
;
...
...
@@ -51,8 +54,9 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
private
dragArea
:
HTMLElement
;
private
actionBar
:
ActionBar
;
private
allActions
:
AbstractDebugAction
[]
=
[];
private
activeActions
:
AbstractDebug
Action
[];
private
activeActions
:
I
Action
[];
private
updateScheduler
:
RunOnceScheduler
;
private
debugToolbarMenu
:
IMenu
;
private
isVisible
:
boolean
;
private
isBuilt
:
boolean
;
...
...
@@ -67,7 +71,10 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
@
IThemeService
themeService
:
IThemeService
,
@
IKeybindingService
private
readonly
keybindingService
:
IKeybindingService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IMenuService
menuService
:
IMenuService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
)
{
super
(
themeService
);
...
...
@@ -77,6 +84,8 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
this
.
dragArea
=
dom
.
append
(
this
.
$el
,
dom
.
$
(
'
div.drag-area
'
));
const
actionBarContainer
=
dom
.
append
(
this
.
$el
,
dom
.
$
(
'
div.action-bar-container
'
));
this
.
debugToolbarMenu
=
menuService
.
createMenu
(
MenuId
.
DebugToolbar
,
contextKeyService
);
this
.
toDispose
.
push
(
this
.
debugToolbarMenu
);
this
.
activeActions
=
[];
this
.
actionBar
=
this
.
_register
(
new
ActionBar
(
actionBarContainer
,
{
...
...
@@ -85,6 +94,9 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
if
(
action
.
id
===
FocusSessionAction
.
ID
)
{
return
new
FocusSessionActionItem
(
action
,
this
.
debugService
,
this
.
themeService
,
contextViewService
);
}
if
(
action
instanceof
MenuItemAction
)
{
return
new
MenuItemActionItem
(
action
,
this
.
keybindingService
,
this
.
notificationService
,
contextMenuService
);
}
return
null
;
}
...
...
@@ -97,7 +109,7 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
return
this
.
hide
();
}
const
actions
=
DebugToolbar
.
getActions
(
this
.
allActions
,
this
.
toDispose
,
this
.
debugService
,
this
.
keybindingService
,
this
.
instantiationService
);
const
actions
=
DebugToolbar
.
getActions
(
this
.
debugToolbarMenu
,
this
.
allActions
,
this
.
toDispose
,
this
.
debugService
,
this
.
keybindingService
,
this
.
instantiationService
);
if
(
!
arrays
.
equals
(
actions
,
this
.
activeActions
,
(
first
,
second
)
=>
first
.
id
===
second
.
id
))
{
this
.
actionBar
.
clear
();
this
.
actionBar
.
push
(
actions
,
{
icon
:
true
,
label
:
false
});
...
...
@@ -252,7 +264,7 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
dom
.
hide
(
this
.
$el
);
}
public
static
getActions
(
allActions
:
AbstractDebugAction
[],
toDispose
:
IDisposable
[],
debugService
:
IDebugService
,
keybindingService
:
IKeybindingService
,
instantiationService
:
IInstantiationService
):
AbstractDebug
Action
[]
{
public
static
getActions
(
menu
:
IMenu
,
allActions
:
AbstractDebugAction
[],
toDispose
:
IDisposable
[],
debugService
:
IDebugService
,
keybindingService
:
IKeybindingService
,
instantiationService
:
IInstantiationService
):
I
Action
[]
{
if
(
allActions
.
length
===
0
)
{
allActions
.
push
(
new
ContinueAction
(
ContinueAction
.
ID
,
ContinueAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
PauseAction
(
PauseAction
.
ID
,
PauseAction
.
LABEL
,
debugService
,
keybindingService
));
...
...
@@ -264,7 +276,6 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
allActions
.
push
(
instantiationService
.
createInstance
(
RestartAction
,
RestartAction
.
ID
,
RestartAction
.
LABEL
));
allActions
.
push
(
new
StepBackAction
(
StepBackAction
.
ID
,
StepBackAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
ReverseContinueAction
(
ReverseContinueAction
.
ID
,
ReverseContinueAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
instantiationService
.
createInstance
(
FocusSessionAction
,
FocusSessionAction
.
ID
,
FocusSessionAction
.
LABEL
));
allActions
.
forEach
(
a
=>
toDispose
.
push
(
a
));
}
...
...
@@ -272,7 +283,7 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
const
session
=
debugService
.
getViewModel
().
focusedSession
;
const
attached
=
session
&&
session
.
configuration
.
request
===
'
attach
'
&&
!
isExtensionHostDebugging
(
session
.
configuration
);
return
allActions
.
filter
(
a
=>
{
const
actions
:
IAction
[]
=
allActions
.
filter
(
a
=>
{
if
(
a
.
id
===
ContinueAction
.
ID
)
{
return
state
!==
State
.
Running
;
}
...
...
@@ -291,12 +302,18 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
if
(
a
.
id
===
StopAction
.
ID
)
{
return
!
attached
;
}
if
(
a
.
id
===
FocusSessionAction
.
ID
)
{
return
debugService
.
getViewModel
().
isMultiSessionView
();
}
return
true
;
}).
sort
((
first
,
second
)
=>
first
.
weight
-
second
.
weight
);
const
primary
:
IAction
[]
=
[];
fillInActionBarActions
(
menu
,
undefined
,
{
primary
,
secondary
:
[]
});
actions
.
push
(...
primary
);
if
(
debugService
.
getViewModel
().
isMultiSessionView
())
{
actions
.
push
(
instantiationService
.
createInstance
(
FocusSessionAction
,
FocusSessionAction
.
ID
,
FocusSessionAction
.
LABEL
));
}
return
actions
;
}
public
dispose
():
void
{
...
...
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
浏览文件 @
b4d581b7
...
...
@@ -27,6 +27,10 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
DebugToolbar
}
from
'
vs/workbench/contrib/debug/browser/debugToolbar
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ViewletPanel
}
from
'
vs/workbench/browser/parts/views/panelViewlet
'
;
import
{
IMenu
,
MenuId
,
IMenuService
,
MenuItemAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
MenuItemActionItem
}
from
'
vs/platform/actions/browser/menuItemActionItem
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
export
class
DebugViewlet
extends
ViewContainerViewlet
{
...
...
@@ -35,6 +39,7 @@ export class DebugViewlet extends ViewContainerViewlet {
private
breakpointView
:
ViewletPanel
;
private
panelListeners
=
new
Map
<
string
,
IDisposable
>
();
private
allActions
:
AbstractDebugAction
[]
=
[];
private
debugToolbarMenu
:
IMenu
;
constructor
(
@
IPartService
partService
:
IPartService
,
...
...
@@ -50,6 +55,9 @@ export class DebugViewlet extends ViewContainerViewlet {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IKeybindingService
private
readonly
keybindingService
:
IKeybindingService
,
@
IContextViewService
private
readonly
contextViewService
:
IContextViewService
,
@
IMenuService
private
readonly
menuService
:
IMenuService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
)
{
super
(
VIEWLET_ID
,
`
${
VIEWLET_ID
}
.state`
,
false
,
configurationService
,
partService
,
telemetryService
,
storageService
,
instantiationService
,
themeService
,
contextMenuService
,
extensionService
,
contextService
);
...
...
@@ -102,7 +110,11 @@ export class DebugViewlet extends ViewContainerViewlet {
return
[
this
.
startAction
,
this
.
configureAction
,
this
.
toggleReplAction
];
}
return
DebugToolbar
.
getActions
(
this
.
allActions
,
this
.
toDispose
,
this
.
debugService
,
this
.
keybindingService
,
this
.
instantiationService
);
if
(
!
this
.
debugToolbarMenu
)
{
this
.
debugToolbarMenu
=
this
.
menuService
.
createMenu
(
MenuId
.
DebugToolbar
,
this
.
contextKeyService
);
this
.
toDispose
.
push
(
this
.
debugToolbarMenu
);
}
return
DebugToolbar
.
getActions
(
this
.
debugToolbarMenu
,
this
.
allActions
,
this
.
toDispose
,
this
.
debugService
,
this
.
keybindingService
,
this
.
instantiationService
);
}
get
showInitialDebugActions
():
boolean
{
...
...
@@ -126,6 +138,9 @@ export class DebugViewlet extends ViewContainerViewlet {
if
(
action
.
id
===
FocusSessionAction
.
ID
)
{
return
new
FocusSessionActionItem
(
action
,
this
.
debugService
,
this
.
themeService
,
this
.
contextViewService
);
}
if
(
action
instanceof
MenuItemAction
)
{
return
new
MenuItemActionItem
(
action
,
this
.
keybindingService
,
this
.
notificationService
,
this
.
contextMenuService
);
}
return
null
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录