Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
05f92699
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,发现更多精彩内容 >>
提交
05f92699
编写于
3月 18, 2019
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: contribute commands to debug toolbar properly
fixes #69153
上级
6a5b2f14
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
49 addition
and
53 deletion
+49
-53
src/vs/workbench/contrib/debug/browser/debugToolbar.ts
src/vs/workbench/contrib/debug/browser/debugToolbar.ts
+4
-47
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
+2
-3
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+2
-0
src/vs/workbench/contrib/debug/common/debugViewModel.ts
src/vs/workbench/contrib/debug/common/debugViewModel.ts
+9
-1
src/vs/workbench/contrib/debug/electron-browser/debug.contribution.ts
...ench/contrib/debug/electron-browser/debug.contribution.ts
+32
-2
未找到文件。
src/vs/workbench/contrib/debug/browser/debugToolbar.ts
浏览文件 @
05f92699
...
...
@@ -14,7 +14,6 @@ import { ActionBar, ActionsOrientation, Separator } from 'vs/base/browser/ui/act
import
{
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IDebugConfiguration
,
IDebugService
,
State
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
AbstractDebugAction
,
PauseAction
,
ContinueAction
,
StepBackAction
,
ReverseContinueAction
,
StopAction
,
DisconnectAction
,
StepOverAction
,
StepIntoAction
,
StepOutAction
,
RestartAction
,
FocusSessionAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
FocusSessionActionItem
}
from
'
vs/workbench/contrib/debug/browser/debugActionItems
'
;
import
{
IConfigurationService
,
IConfigurationChangeEvent
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
...
...
@@ -28,11 +27,10 @@ import { IContextViewService, IContextMenuService } from 'vs/platform/contextvie
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
'
;
import
{
FocusSessionAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
const
DEBUG_TOOLBAR_POSITION_KEY
=
'
debug.actionswidgetposition
'
;
const
DEBUG_TOOLBAR_Y_KEY
=
'
debug.actionswidgety
'
;
...
...
@@ -53,7 +51,6 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
private
$el
:
HTMLElement
;
private
dragArea
:
HTMLElement
;
private
actionBar
:
ActionBar
;
private
allActions
:
AbstractDebugAction
[]
=
[];
private
activeActions
:
IAction
[];
private
updateScheduler
:
RunOnceScheduler
;
private
debugToolbarMenu
:
IMenu
;
...
...
@@ -109,7 +106,7 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
return
this
.
hide
();
}
const
actions
=
DebugToolbar
.
getActions
(
this
.
debugToolbarMenu
,
this
.
allActions
,
this
.
toDispose
,
this
.
debugService
,
this
.
keybindin
gService
,
this
.
instantiationService
);
const
actions
=
DebugToolbar
.
getActions
(
this
.
debugToolbarMenu
,
this
.
debu
gService
,
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
});
...
...
@@ -267,48 +264,8 @@ export class DebugToolbar extends Themable implements IWorkbenchContribution {
dom
.
hide
(
this
.
$el
);
}
public
static
getActions
(
menu
:
IMenu
,
allActions
:
AbstractDebugAction
[],
toDispose
:
IDisposable
[],
debugService
:
IDebugService
,
keybindingService
:
IKeybindingService
,
instantiationService
:
IInstantiationService
):
IAction
[]
{
if
(
allActions
.
length
===
0
)
{
allActions
.
push
(
new
ContinueAction
(
ContinueAction
.
ID
,
ContinueAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
PauseAction
(
PauseAction
.
ID
,
PauseAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
StopAction
(
StopAction
.
ID
,
StopAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
DisconnectAction
(
DisconnectAction
.
ID
,
DisconnectAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
StepOverAction
(
StepOverAction
.
ID
,
StepOverAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
StepIntoAction
(
StepIntoAction
.
ID
,
StepIntoAction
.
LABEL
,
debugService
,
keybindingService
));
allActions
.
push
(
new
StepOutAction
(
StepOutAction
.
ID
,
StepOutAction
.
LABEL
,
debugService
,
keybindingService
));
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
.
forEach
(
a
=>
toDispose
.
push
(
a
));
}
const
state
=
debugService
.
state
;
const
session
=
debugService
.
getViewModel
().
focusedSession
;
const
attached
=
session
&&
session
.
configuration
.
request
===
'
attach
'
&&
!
isExtensionHostDebugging
(
session
.
configuration
);
const
actions
:
IAction
[]
=
allActions
.
filter
(
a
=>
{
if
(
a
.
id
===
ContinueAction
.
ID
)
{
return
state
!==
State
.
Running
;
}
if
(
a
.
id
===
PauseAction
.
ID
)
{
return
state
===
State
.
Running
;
}
if
(
a
.
id
===
StepBackAction
.
ID
)
{
return
session
&&
session
.
capabilities
.
supportsStepBack
;
}
if
(
a
.
id
===
ReverseContinueAction
.
ID
)
{
return
session
&&
session
.
capabilities
.
supportsStepBack
;
}
if
(
a
.
id
===
DisconnectAction
.
ID
)
{
return
attached
;
}
if
(
a
.
id
===
StopAction
.
ID
)
{
return
!
attached
;
}
return
true
;
}).
sort
((
first
,
second
)
=>
(
first
.
weight
||
0
)
-
(
second
.
weight
||
0
));
public
static
getActions
(
menu
:
IMenu
,
debugService
:
IDebugService
,
instantiationService
:
IInstantiationService
):
IAction
[]
{
const
actions
:
IAction
[]
=
[];
fillInActionBarActions
(
menu
,
undefined
,
actions
,
()
=>
false
);
if
(
debugService
.
getViewModel
().
isMultiSessionView
())
{
actions
.
push
(
instantiationService
.
createInstance
(
FocusSessionAction
,
FocusSessionAction
.
ID
,
FocusSessionAction
.
LABEL
));
...
...
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
浏览文件 @
05f92699
...
...
@@ -10,7 +10,7 @@ import * as DOM from 'vs/base/browser/dom';
import
{
IActionItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
ViewContainerViewlet
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
IDebugService
,
VIEWLET_ID
,
State
,
BREAKPOINTS_VIEW_ID
,
IDebugConfiguration
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
StartAction
,
ToggleReplAction
,
ConfigureAction
,
AbstractDebugAction
,
SelectAndStartAction
,
FocusSessionAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
StartAction
,
ToggleReplAction
,
ConfigureAction
,
SelectAndStartAction
,
FocusSessionAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
StartDebugActionItem
,
FocusSessionActionItem
}
from
'
vs/workbench/contrib/debug/browser/debugActionItems
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
...
...
@@ -38,7 +38,6 @@ export class DebugViewlet extends ViewContainerViewlet {
private
progressRunner
:
IProgressRunner
;
private
breakpointView
:
ViewletPanel
;
private
panelListeners
=
new
Map
<
string
,
IDisposable
>
();
private
allActions
:
AbstractDebugAction
[]
=
[];
private
debugToolbarMenu
:
IMenu
;
constructor
(
...
...
@@ -112,7 +111,7 @@ export class DebugViewlet extends ViewContainerViewlet {
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
.
keybindin
gService
,
this
.
instantiationService
);
return
DebugToolbar
.
getActions
(
this
.
debugToolbarMenu
,
this
.
debu
gService
,
this
.
instantiationService
);
}
get
showInitialDebugActions
():
boolean
{
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
05f92699
...
...
@@ -51,6 +51,8 @@ export const CONTEXT_BREAKPOINT_SELECTED = new RawContextKey<boolean>('breakpoin
export
const
CONTEXT_CALLSTACK_ITEM_TYPE
=
new
RawContextKey
<
string
>
(
'
callStackItemType
'
,
undefined
);
export
const
CONTEXT_LOADED_SCRIPTS_SUPPORTED
=
new
RawContextKey
<
boolean
>
(
'
loadedScriptsSupported
'
,
false
);
export
const
CONTEXT_LOADED_SCRIPTS_ITEM_TYPE
=
new
RawContextKey
<
string
>
(
'
loadedScriptsItemType
'
,
undefined
);
export
const
CONTEXT_FOCUSED_SESSION_IS_ATTACH
=
new
RawContextKey
<
boolean
>
(
'
focusedSessionIsAttach
'
,
false
);
export
const
CONTEXT_STEP_BACK_SUPPORTED
=
new
RawContextKey
<
boolean
>
(
'
stepBackSupported
'
,
false
);
export
const
EDITOR_CONTRIBUTION_ID
=
'
editor.contrib.debug
'
;
export
const
DEBUG_SCHEME
=
'
debug
'
;
...
...
src/vs/workbench/contrib/debug/common/debugViewModel.ts
浏览文件 @
05f92699
...
...
@@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
CONTEXT_EXPRESSION_SELECTED
,
IViewModel
,
IStackFrame
,
IDebugSession
,
IThread
,
IExpression
,
IFunctionBreakpoint
,
CONTEXT_BREAKPOINT_SELECTED
,
CONTEXT_LOADED_SCRIPTS_SUPPORTED
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
CONTEXT_EXPRESSION_SELECTED
,
IViewModel
,
IStackFrame
,
IDebugSession
,
IThread
,
IExpression
,
IFunctionBreakpoint
,
CONTEXT_BREAKPOINT_SELECTED
,
CONTEXT_LOADED_SCRIPTS_SUPPORTED
,
CONTEXT_STEP_BACK_SUPPORTED
,
CONTEXT_FOCUSED_SESSION_IS_ATTACH
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
isExtensionHostDebugging
}
from
'
vs/workbench/contrib/debug/common/debugUtils
'
;
export
class
ViewModel
implements
IViewModel
{
...
...
@@ -23,6 +24,8 @@ export class ViewModel implements IViewModel {
private
expressionSelectedContextKey
:
IContextKey
<
boolean
>
;
private
breakpointSelectedContextKey
:
IContextKey
<
boolean
>
;
private
loadedScriptsSupportedContextKey
:
IContextKey
<
boolean
>
;
private
stepBackSupportedContextKey
:
IContextKey
<
boolean
>
;
private
focusedSessionIsAttach
:
IContextKey
<
boolean
>
;
constructor
(
contextKeyService
:
IContextKeyService
)
{
this
.
_onDidFocusSession
=
new
Emitter
<
IDebugSession
|
undefined
>
();
...
...
@@ -32,6 +35,8 @@ export class ViewModel implements IViewModel {
this
.
expressionSelectedContextKey
=
CONTEXT_EXPRESSION_SELECTED
.
bindTo
(
contextKeyService
);
this
.
breakpointSelectedContextKey
=
CONTEXT_BREAKPOINT_SELECTED
.
bindTo
(
contextKeyService
);
this
.
loadedScriptsSupportedContextKey
=
CONTEXT_LOADED_SCRIPTS_SUPPORTED
.
bindTo
(
contextKeyService
);
this
.
stepBackSupportedContextKey
=
CONTEXT_STEP_BACK_SUPPORTED
.
bindTo
(
contextKeyService
);
this
.
focusedSessionIsAttach
=
CONTEXT_FOCUSED_SESSION_IS_ATTACH
.
bindTo
(
contextKeyService
);
}
getId
():
string
{
...
...
@@ -59,6 +64,9 @@ export class ViewModel implements IViewModel {
this
.
_focusedSession
=
session
;
this
.
loadedScriptsSupportedContextKey
.
set
(
session
?
!!
session
.
capabilities
.
supportsLoadedSourcesRequest
:
false
);
this
.
stepBackSupportedContextKey
.
set
(
session
?
!!
session
.
capabilities
.
supportsStepBack
:
false
);
const
attach
=
!!
session
&&
session
.
configuration
.
request
===
'
attach
'
&&
!
isExtensionHostDebugging
(
session
.
configuration
);
this
.
focusedSessionIsAttach
.
set
(
attach
);
if
(
shouldEmitForSession
)
{
this
.
_onDidFocusSession
.
fire
(
session
);
...
...
src/vs/workbench/contrib/debug/electron-browser/debug.contribution.ts
浏览文件 @
05f92699
...
...
@@ -22,14 +22,14 @@ import { CallStackView } from 'vs/workbench/contrib/debug/browser/callStackView'
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
{
IDebugService
,
VIEWLET_ID
,
REPL_ID
,
CONTEXT_IN_DEBUG_MODE
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
,
CONTEXT_DEBUG_STATE
,
VARIABLES_VIEW_ID
,
CALLSTACK_VIEW_ID
,
WATCH_VIEW_ID
,
BREAKPOINTS_VIEW_ID
,
VIEW_CONTAINER
,
LOADED_SCRIPTS_VIEW_ID
,
CONTEXT_LOADED_SCRIPTS_SUPPORTED
CONTEXT_DEBUG_STATE
,
VARIABLES_VIEW_ID
,
CALLSTACK_VIEW_ID
,
WATCH_VIEW_ID
,
BREAKPOINTS_VIEW_ID
,
VIEW_CONTAINER
,
LOADED_SCRIPTS_VIEW_ID
,
CONTEXT_LOADED_SCRIPTS_SUPPORTED
,
CONTEXT_FOCUSED_SESSION_IS_ATTACH
,
CONTEXT_STEP_BACK_SUPPORTED
,
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IWorkbenchLayoutService
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
DebugEditorModelManager
}
from
'
vs/workbench/contrib/debug/browser/debugEditorModelManager
'
;
import
{
StepOverAction
,
FocusReplAction
,
StepIntoAction
,
StepOutAction
,
StartAction
,
RestartAction
,
ContinueAction
,
StopAction
,
DisconnectAction
,
PauseAction
,
AddFunctionBreakpointAction
,
ConfigureAction
,
DisableAllBreakpointsAction
,
EnableAllBreakpointsAction
,
RemoveAllBreakpointsAction
,
RunAction
,
ReapplyBreakpointsAction
,
SelectAndStartAction
,
TerminateThreadAction
ConfigureAction
,
DisableAllBreakpointsAction
,
EnableAllBreakpointsAction
,
RemoveAllBreakpointsAction
,
RunAction
,
ReapplyBreakpointsAction
,
SelectAndStartAction
,
TerminateThreadAction
,
StepBackAction
,
ReverseContinueAction
,
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
DebugToolbar
}
from
'
vs/workbench/contrib/debug/browser/debugToolbar
'
;
import
*
as
service
from
'
vs/workbench/contrib/debug/electron-browser/debugService
'
;
...
...
@@ -240,6 +240,36 @@ registerCommands();
const
statusBar
=
Registry
.
as
<
IStatusbarRegistry
>
(
StatusExtensions
.
Statusbar
);
statusBar
.
registerStatusbarItem
(
new
StatusbarItemDescriptor
(
DebugStatus
,
StatusbarAlignment
.
LEFT
,
30
/* Low Priority */
));
// Debug toolbar
const
registerDebugToolbarItem
=
(
id
:
string
,
title
:
string
,
icon
:
string
,
order
:
number
,
when
?:
ContextKeyExpr
,
precondition
?:
ContextKeyExpr
)
=>
{
MenuRegistry
.
appendMenuItem
(
MenuId
.
DebugToolbar
,
{
group
:
'
navigation
'
,
when
,
order
,
command
:
{
id
,
title
,
iconLocation
:
{
light
:
URI
.
parse
(
require
.
toUrl
(
`vs/workbench/contrib/debug/browser/media/
${
icon
}
.svg`
)),
dark
:
URI
.
parse
(
require
.
toUrl
(
`vs/workbench/contrib/debug/browser/media/
${
icon
}
-inverse.svg`
))
},
precondition
}
});
};
registerDebugToolbarItem
(
ContinueAction
.
ID
,
ContinueAction
.
LABEL
,
'
continue
'
,
10
,
CONTEXT_DEBUG_STATE
.
notEqualsTo
(
'
running
'
));
registerDebugToolbarItem
(
PauseAction
.
ID
,
PauseAction
.
LABEL
,
'
pause
'
,
10
,
CONTEXT_DEBUG_STATE
.
isEqualTo
(
'
running
'
));
registerDebugToolbarItem
(
StopAction
.
ID
,
StopAction
.
LABEL
,
'
stop
'
,
70
,
CONTEXT_FOCUSED_SESSION_IS_ATTACH
.
toNegated
());
registerDebugToolbarItem
(
DisconnectAction
.
ID
,
DisconnectAction
.
LABEL
,
'
disconnect
'
,
70
,
CONTEXT_FOCUSED_SESSION_IS_ATTACH
);
registerDebugToolbarItem
(
StepOverAction
.
ID
,
StepOverAction
.
LABEL
,
'
step-over
'
,
20
,
undefined
,
CONTEXT_DEBUG_STATE
.
isEqualTo
(
'
stopped
'
));
registerDebugToolbarItem
(
StepIntoAction
.
ID
,
StepIntoAction
.
LABEL
,
'
step-into
'
,
30
,
undefined
,
CONTEXT_DEBUG_STATE
.
isEqualTo
(
'
stopped
'
));
registerDebugToolbarItem
(
StepOutAction
.
ID
,
StepOutAction
.
LABEL
,
'
step-out
'
,
40
,
undefined
,
CONTEXT_DEBUG_STATE
.
isEqualTo
(
'
stopped
'
));
registerDebugToolbarItem
(
RestartAction
.
ID
,
RestartAction
.
LABEL
,
'
restart
'
,
60
);
registerDebugToolbarItem
(
StepBackAction
.
ID
,
StepBackAction
.
LABEL
,
'
step-back
'
,
50
,
CONTEXT_STEP_BACK_SUPPORTED
,
CONTEXT_DEBUG_STATE
.
isEqualTo
(
'
stopped
'
));
registerDebugToolbarItem
(
ReverseContinueAction
.
ID
,
ReverseContinueAction
.
LABEL
,
'
reverse-continue
'
,
60
,
CONTEXT_STEP_BACK_SUPPORTED
,
CONTEXT_DEBUG_STATE
.
isEqualTo
(
'
stopped
'
));
// View menu
MenuRegistry
.
appendMenuItem
(
MenuId
.
MenubarViewMenu
,
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录