Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3df58b02
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,发现更多精彩内容 >>
提交
3df58b02
编写于
1月 14, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: use new view pane in debug console
上级
1f5a5470
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
80 addition
and
82 deletion
+80
-82
src/vs/workbench/contrib/debug/browser/debug.contribution.ts
src/vs/workbench/contrib/debug/browser/debug.contribution.ts
+22
-28
src/vs/workbench/contrib/debug/browser/debugCommands.ts
src/vs/workbench/contrib/debug/browser/debugCommands.ts
+5
-5
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
+4
-4
src/vs/workbench/contrib/debug/browser/debugService.ts
src/vs/workbench/contrib/debug/browser/debugService.ts
+6
-4
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
+12
-10
src/vs/workbench/contrib/debug/browser/repl.ts
src/vs/workbench/contrib/debug/browser/repl.ts
+29
-30
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+2
-1
未找到文件。
src/vs/workbench/contrib/debug/browser/debug.contribution.ts
浏览文件 @
3df58b02
...
...
@@ -14,16 +14,14 @@ import { IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry'
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IWorkbenchActionRegistry
,
Extensions
as
WorkbenchActionRegistryExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
ShowViewletAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
TogglePanelAction
,
Extensions
as
PanelExtensions
,
PanelRegistry
,
PanelDescriptor
}
from
'
vs/workbench/browser/panel
'
;
import
{
BreakpointsView
}
from
'
vs/workbench/contrib/debug/browser/breakpointsView
'
;
import
{
CallStackView
}
from
'
vs/workbench/contrib/debug/browser/callStackView
'
;
import
{
Extensions
as
WorkbenchExtensions
,
IWorkbenchContributionsRegistry
}
from
'
vs/workbench/common/contributions
'
;
import
{
IDebugService
,
VIEWLET_ID
,
REP
L_ID
,
CONTEXT_IN_DEBUG_MODE
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
,
CONTEXT_DEBUG_STATE
,
VARIABLES_VIEW_ID
,
CALLSTACK_VIEW_ID
,
WATCH_VIEW_ID
,
BREAKPOINTS_VIEW_ID
,
LOADED_SCRIPTS_VIEW_ID
,
CONTEXT_LOADED_SCRIPTS_SUPPORTED
,
CONTEXT_FOCUSED_SESSION_IS_ATTACH
,
CONTEXT_STEP_BACK_SUPPORTED
,
CONTEXT_CALLSTACK_ITEM_TYPE
,
CONTEXT_RESTART_FRAME_SUPPORTED
,
CONTEXT_JUMP_TO_CURSOR_SUPPORTED
,
CONTEXT_DEBUG_UX
,
BREAKPOINT_EDITOR_CONTRIBUTION_ID
,
IDebugService
,
VIEWLET_ID
,
DEBUG_PANE
L_ID
,
CONTEXT_IN_DEBUG_MODE
,
INTERNAL_CONSOLE_OPTIONS_SCHEMA
,
CONTEXT_DEBUG_STATE
,
VARIABLES_VIEW_ID
,
CALLSTACK_VIEW_ID
,
WATCH_VIEW_ID
,
BREAKPOINTS_VIEW_ID
,
LOADED_SCRIPTS_VIEW_ID
,
CONTEXT_LOADED_SCRIPTS_SUPPORTED
,
CONTEXT_FOCUSED_SESSION_IS_ATTACH
,
CONTEXT_STEP_BACK_SUPPORTED
,
CONTEXT_CALLSTACK_ITEM_TYPE
,
CONTEXT_RESTART_FRAME_SUPPORTED
,
CONTEXT_JUMP_TO_CURSOR_SUPPORTED
,
CONTEXT_DEBUG_UX
,
BREAKPOINT_EDITOR_CONTRIBUTION_ID
,
REPL_VIEW_ID
,
}
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
{
StartAction
,
AddFunctionBreakpointAction
,
ConfigureAction
,
DisableAllBreakpointsAction
,
EnableAllBreakpointsAction
,
RemoveAllBreakpointsAction
,
RunAction
,
ReapplyBreakpointsAction
,
SelectAndStartAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
DebugToolBar
}
from
'
vs/workbench/contrib/debug/browser/debugToolBar
'
;
import
*
as
service
from
'
vs/workbench/contrib/debug/browser/debugService
'
;
...
...
@@ -31,7 +29,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import
{
registerCommands
,
ADD_CONFIGURATION_ID
,
TOGGLE_INLINE_BREAKPOINT_ID
,
COPY_STACK_TRACE_ID
,
REVERSE_CONTINUE_ID
,
STEP_BACK_ID
,
RESTART_SESSION_ID
,
TERMINATE_THREAD_ID
,
STEP_OVER_ID
,
STEP_INTO_ID
,
STEP_OUT_ID
,
PAUSE_ID
,
DISCONNECT_ID
,
STOP_ID
,
RESTART_FRAME_ID
,
CONTINUE_ID
,
FOCUS_REPL_ID
,
JUMP_TO_CURSOR_ID
,
RESTART_LABEL
,
STEP_INTO_LABEL
,
STEP_OVER_LABEL
,
STEP_OUT_LABEL
,
PAUSE_LABEL
,
DISCONNECT_LABEL
,
STOP_LABEL
,
CONTINUE_LABEL
}
from
'
vs/workbench/contrib/debug/browser/debugCommands
'
;
import
{
IQuickOpenRegistry
,
Extensions
as
QuickOpenExtensions
,
QuickOpenHandlerDescriptor
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
StatusBarColorProvider
}
from
'
vs/workbench/contrib/debug/browser/statusbarColorProvider
'
;
import
{
IViewsRegistry
,
Extensions
as
ViewExtensions
,
IViewContainersRegistry
,
ViewContainerLocation
}
from
'
vs/workbench/common/views
'
;
import
{
IViewsRegistry
,
Extensions
as
ViewExtensions
,
IViewContainersRegistry
,
ViewContainerLocation
,
ViewContainer
}
from
'
vs/workbench/common/views
'
;
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
...
...
@@ -48,11 +46,12 @@ import { ClearReplAction, Repl } from 'vs/workbench/contrib/debug/browser/repl';
import
{
DebugContentProvider
}
from
'
vs/workbench/contrib/debug/common/debugContentProvider
'
;
import
{
StartView
}
from
'
vs/workbench/contrib/debug/browser/startView
'
;
import
{
ThemeIcon
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
DebugViewPaneContainer
}
from
'
vs/workbench/contrib/debug/browser/debugViewlet
'
;
import
{
DebugViewPaneContainer
,
OpenDebugPanelAction
}
from
'
vs/workbench/contrib/debug/browser/debugViewlet
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
CallStackEditorContribution
}
from
'
vs/workbench/contrib/debug/browser/callStackEditorContribution
'
;
import
{
BreakpointEditorContribution
}
from
'
vs/workbench/contrib/debug/browser/breakpointEditorContribution
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ViewPaneContainer
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
class
OpenDebugViewletAction
extends
ShowViewletAction
{
public
static
readonly
ID
=
VIEWLET_ID
;
...
...
@@ -69,20 +68,6 @@ class OpenDebugViewletAction extends ShowViewletAction {
}
}
class
OpenDebugPanelAction
extends
TogglePanelAction
{
public
static
readonly
ID
=
'
workbench.debug.action.toggleRepl
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
toggleDebugPanel
'
,
"
Debug Console
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IPanelService
panelService
:
IPanelService
,
@
IWorkbenchLayoutService
layoutService
:
IWorkbenchLayoutService
)
{
super
(
id
,
label
,
REPL_ID
,
panelService
,
layoutService
);
}
}
const
viewContainer
=
Registry
.
as
<
IViewContainersRegistry
>
(
ViewExtensions
.
ViewContainersRegistry
).
registerViewContainer
({
id
:
VIEWLET_ID
,
name
:
nls
.
localize
(
'
runAndDebug
'
,
"
Run and Debug
"
),
...
...
@@ -99,14 +84,23 @@ const openPanelKb: IKeybindings = {
};
// register repl panel
Registry
.
as
<
PanelRegistry
>
(
PanelExtensions
.
Panels
).
registerPanel
(
PanelDescriptor
.
create
(
Repl
,
REPL_ID
,
nls
.
localize
({
comment
:
[
'
Debug is a noun in this context, not a verb.
'
],
key
:
'
debugPanel
'
},
'
Debug Console
'
),
'
repl
'
,
30
,
OpenDebugPanelAction
.
ID
));
const
VIEW_CONTAINER
:
ViewContainer
=
Registry
.
as
<
IViewContainersRegistry
>
(
ViewExtensions
.
ViewContainersRegistry
).
registerViewContainer
({
id
:
DEBUG_PANEL_ID
,
name
:
nls
.
localize
(
'
runAndDebug
'
,
"
Run and Debug
"
),
ctorDescriptor
:
new
SyncDescriptor
(
ViewPaneContainer
,
[
DEBUG_PANEL_ID
,
DEBUG_PANEL_ID
,
{
mergeViewWithContainerWhenSingleView
:
true
,
donotShowContainerTitleWhenMergedWithContainer
:
true
}]),
focusCommand
:
{
id
:
OpenDebugPanelAction
.
ID
,
keybindings
:
openPanelKb
}
},
ViewContainerLocation
.
Panel
);
Registry
.
as
<
IViewsRegistry
>
(
ViewExtensions
.
ViewsRegistry
).
registerViews
([{
id
:
REPL_VIEW_ID
,
name
:
nls
.
localize
({
comment
:
[
'
Debug is a noun in this context, not a verb.
'
],
key
:
'
debugPanel
'
},
'
Debug Console
'
),
canToggleVisibility
:
false
,
ctorDescriptor
:
new
SyncDescriptor
(
Repl
),
}],
VIEW_CONTAINER
);
// Register default debug views
const
viewsRegistry
=
Registry
.
as
<
IViewsRegistry
>
(
ViewExtensions
.
ViewsRegistry
);
...
...
src/vs/workbench/contrib/debug/browser/debugCommands.ts
浏览文件 @
3df58b02
...
...
@@ -9,7 +9,7 @@ import { List } from 'vs/base/browser/ui/list/listWidget';
import
{
KeybindingsRegistry
,
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IDebugService
,
IEnablement
,
CONTEXT_BREAKPOINTS_FOCUSED
,
CONTEXT_WATCH_EXPRESSIONS_FOCUSED
,
CONTEXT_VARIABLES_FOCUSED
,
EDITOR_CONTRIBUTION_ID
,
IDebugEditorContribution
,
CONTEXT_IN_DEBUG_MODE
,
CONTEXT_EXPRESSION_SELECTED
,
CONTEXT_BREAKPOINT_SELECTED
,
IConfig
,
IStackFrame
,
IThread
,
IDebugSession
,
CONTEXT_DEBUG_STATE
,
REPL_ID
,
IDebugConfiguration
,
CONTEXT_JUMP_TO_CURSOR_SUPPORTE
D
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IDebugService
,
IEnablement
,
CONTEXT_BREAKPOINTS_FOCUSED
,
CONTEXT_WATCH_EXPRESSIONS_FOCUSED
,
CONTEXT_VARIABLES_FOCUSED
,
EDITOR_CONTRIBUTION_ID
,
IDebugEditorContribution
,
CONTEXT_IN_DEBUG_MODE
,
CONTEXT_EXPRESSION_SELECTED
,
CONTEXT_BREAKPOINT_SELECTED
,
IConfig
,
IStackFrame
,
IThread
,
IDebugSession
,
CONTEXT_DEBUG_STATE
,
IDebugConfiguration
,
CONTEXT_JUMP_TO_CURSOR_SUPPORTED
,
REPL_VIEW_I
D
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
Expression
,
Variable
,
Breakpoint
,
FunctionBreakpoint
,
DataBreakpoint
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
import
{
IExtensionsViewPaneContainer
,
VIEWLET_ID
as
EXTENSIONS_VIEWLET_ID
}
from
'
vs/workbench/contrib/extensions/common/extensions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
...
...
@@ -27,9 +27,9 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
ITextResourcePropertiesService
}
from
'
vs/editor/common/services/textResourceConfigurationService
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IQuickInputService
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
IViewsService
}
from
'
vs/workbench/common/views
'
;
export
const
ADD_CONFIGURATION_ID
=
'
debug.addConfiguration
'
;
export
const
TOGGLE_INLINE_BREAKPOINT_ID
=
'
editor.debug.action.toggleInlineBreakpoint
'
;
...
...
@@ -327,9 +327,9 @@ export function registerCommands(): void {
CommandsRegistry
.
registerCommand
({
id
:
FOCUS_REPL_ID
,
handler
:
(
accessor
)
=>
{
const
panelService
=
accessor
.
get
(
IPanel
Service
);
panelService
.
openPanel
(
REPL
_ID
,
true
);
handler
:
async
(
accessor
)
=>
{
const
viewsService
=
accessor
.
get
(
IViews
Service
);
await
viewsService
.
openView
(
REPL_VIEW
_ID
,
true
);
}
});
...
...
src/vs/workbench/contrib/debug/browser/debugEditorActions.ts
浏览文件 @
3df58b02
...
...
@@ -9,14 +9,14 @@ import { Range } from 'vs/editor/common/core/range';
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
ServicesAccessor
,
registerEditorAction
,
EditorAction
,
IActionOptions
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IDebugService
,
CONTEXT_IN_DEBUG_MODE
,
CONTEXT_DEBUG_STATE
,
State
,
REPL_ID
,
VIEWLET_ID
,
IDebugEditorContribution
,
EDITOR_CONTRIBUTION_ID
,
BreakpointWidgetContext
,
IBreakpoint
,
BREAKPOINT_EDITOR_CONTRIBUTION_ID
,
IBreakpointEditorContribution
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IDebugService
,
CONTEXT_IN_DEBUG_MODE
,
CONTEXT_DEBUG_STATE
,
State
,
VIEWLET_ID
,
IDebugEditorContribution
,
EDITOR_CONTRIBUTION_ID
,
BreakpointWidgetContext
,
IBreakpoint
,
BREAKPOINT_EDITOR_CONTRIBUTION_ID
,
IBreakpointEditorContribution
,
REPL_VIEW_ID
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
openBreakpointSource
}
from
'
vs/workbench/contrib/debug/browser/breakpointsView
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
PanelFocusContext
}
from
'
vs/workbench/common/panel
'
;
import
{
IViewsService
}
from
'
vs/workbench/common/views
'
;
export
const
TOGGLE_BREAKPOINT_ID
=
'
editor.debug.action.toggleBreakpoint
'
;
class
ToggleBreakpointAction
extends
EditorAction
{
...
...
@@ -169,7 +169,7 @@ class SelectionToReplAction extends EditorAction {
async
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
Promise
<
void
>
{
const
debugService
=
accessor
.
get
(
IDebugService
);
const
panelService
=
accessor
.
get
(
IPanel
Service
);
const
viewsService
=
accessor
.
get
(
IViews
Service
);
const
viewModel
=
debugService
.
getViewModel
();
const
session
=
viewModel
.
focusedSession
;
if
(
!
editor
.
hasModel
()
||
!
session
)
{
...
...
@@ -178,7 +178,7 @@ class SelectionToReplAction extends EditorAction {
const
text
=
editor
.
getModel
().
getValueInRange
(
editor
.
getSelection
());
await
session
.
addReplExpression
(
viewModel
.
focusedStackFrame
!
,
text
);
await
panelService
.
openPanel
(
REPL
_ID
,
true
);
await
viewsService
.
openView
(
REPL_VIEW
_ID
,
true
);
}
}
...
...
src/vs/workbench/contrib/debug/browser/debugService.ts
浏览文件 @
3df58b02
...
...
@@ -36,7 +36,7 @@ import { IAction } from 'vs/base/common/actions';
import
{
deepClone
,
equals
}
from
'
vs/base/common/objects
'
;
import
{
DebugSession
}
from
'
vs/workbench/contrib/debug/browser/debugSession
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDebugService
,
State
,
IDebugSession
,
CONTEXT_DEBUG_TYPE
,
CONTEXT_DEBUG_STATE
,
CONTEXT_IN_DEBUG_MODE
,
IThread
,
IDebugConfiguration
,
VIEWLET_ID
,
REPL_ID
,
IConfig
,
ILaunch
,
IViewModel
,
IConfigurationManager
,
IDebugModel
,
IEnablement
,
IBreakpoint
,
IBreakpointData
,
ICompound
,
IGlobalConfig
,
IStackFrame
,
AdapterEndEvent
,
getStateLabel
,
IDebugSessionOptions
,
CONTEXT_DEBUG_UX
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IDebugService
,
State
,
IDebugSession
,
CONTEXT_DEBUG_TYPE
,
CONTEXT_DEBUG_STATE
,
CONTEXT_IN_DEBUG_MODE
,
IThread
,
IDebugConfiguration
,
VIEWLET_ID
,
DEBUG_PANEL_ID
,
IConfig
,
ILaunch
,
IViewModel
,
IConfigurationManager
,
IDebugModel
,
IEnablement
,
IBreakpoint
,
IBreakpointData
,
ICompound
,
IGlobalConfig
,
IStackFrame
,
AdapterEndEvent
,
getStateLabel
,
IDebugSessionOptions
,
CONTEXT_DEBUG_UX
,
REPL_VIEW_ID
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
getExtensionHostDebugSession
}
from
'
vs/workbench/contrib/debug/common/debugUtils
'
;
import
{
isErrorWithActions
}
from
'
vs/base/common/errorsWithActions
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
...
...
@@ -45,6 +45,7 @@ import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
import
{
TaskRunResult
,
DebugTaskRunner
}
from
'
vs/workbench/contrib/debug/browser/debugTaskRunner
'
;
import
{
IActivityService
,
NumberBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IViewsService
}
from
'
vs/workbench/common/views
'
;
const
DEBUG_BREAKPOINTS_KEY
=
'
debug.breakpoint
'
;
const
DEBUG_FUNCTION_BREAKPOINTS_KEY
=
'
debug.functionbreakpoint
'
;
...
...
@@ -80,6 +81,7 @@ export class DebugService implements IDebugService {
@
ITextFileService
private
readonly
textFileService
:
ITextFileService
,
@
IViewletService
private
readonly
viewletService
:
IViewletService
,
@
IPanelService
private
readonly
panelService
:
IPanelService
,
@
IViewsService
private
readonly
viewsService
:
IViewsService
,
@
INotificationService
private
readonly
notificationService
:
INotificationService
,
@
IDialogService
private
readonly
dialogService
:
IDialogService
,
@
IWorkbenchLayoutService
private
readonly
layoutService
:
IWorkbenchLayoutService
,
...
...
@@ -466,7 +468,7 @@ export class DebugService implements IDebugService {
const
internalConsoleOptions
=
session
.
configuration
.
internalConsoleOptions
||
this
.
configurationService
.
getValue
<
IDebugConfiguration
>
(
'
debug
'
).
internalConsoleOptions
;
if
(
internalConsoleOptions
===
'
openOnSessionStart
'
||
(
this
.
viewModel
.
firstSessionStart
&&
internalConsoleOptions
===
'
openOnFirstSessionStart
'
))
{
this
.
panelService
.
openPanel
(
REPL
_ID
,
false
);
this
.
viewsService
.
openView
(
REPL_VIEW
_ID
,
false
);
}
this
.
viewModel
.
firstSessionStart
=
false
;
...
...
@@ -492,7 +494,7 @@ export class DebugService implements IDebugService {
// Show the repl if some error got logged there #5870
if
(
session
&&
session
.
getReplElements
().
length
>
0
)
{
this
.
panelService
.
openPanel
(
REPL
_ID
,
false
);
this
.
viewsService
.
openView
(
REPL_VIEW
_ID
,
false
);
}
if
(
session
.
configuration
&&
session
.
configuration
.
request
===
'
attach
'
&&
session
.
configuration
.
__autoAttach
)
{
...
...
@@ -577,7 +579,7 @@ export class DebugService implements IDebugService {
const
dataBreakpoints
=
this
.
model
.
getDataBreakpoints
().
filter
(
dbp
=>
!
dbp
.
canPersist
);
dataBreakpoints
.
forEach
(
dbp
=>
this
.
model
.
removeDataBreakpoints
(
dbp
.
getId
()));
if
(
this
.
panelService
.
getLastActivePanelId
()
===
REP
L_ID
&&
this
.
configurationService
.
getValue
<
IDebugConfiguration
>
(
'
debug
'
).
console
.
closeOnEnd
)
{
if
(
this
.
panelService
.
getLastActivePanelId
()
===
DEBUG_PANE
L_ID
&&
this
.
configurationService
.
getValue
<
IDebugConfiguration
>
(
'
debug
'
).
console
.
closeOnEnd
)
{
this
.
panelService
.
hideActivePanel
();
}
}
...
...
src/vs/workbench/contrib/debug/browser/debugViewlet.ts
浏览文件 @
3df58b02
...
...
@@ -8,7 +8,7 @@ import * as nls from 'vs/nls';
import
{
IAction
}
from
'
vs/base/common/actions
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
IActionViewItem
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
import
{
IDebugService
,
VIEWLET_ID
,
State
,
BREAKPOINTS_VIEW_ID
,
IDebugConfiguration
,
REP
L_ID
,
CONTEXT_DEBUG_UX
,
CONTEXT_DEBUG_UX_KEY
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IDebugService
,
VIEWLET_ID
,
State
,
BREAKPOINTS_VIEW_ID
,
IDebugConfiguration
,
DEBUG_PANE
L_ID
,
CONTEXT_DEBUG_UX
,
CONTEXT_DEBUG_UX_KEY
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
StartAction
,
ConfigureAction
,
SelectAndStartAction
,
FocusSessionAction
}
from
'
vs/workbench/contrib/debug/browser/debugActions
'
;
import
{
StartDebugActionViewItem
,
FocusSessionActionViewItem
}
from
'
vs/workbench/contrib/debug/browser/debugActionViewItems
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -105,8 +105,8 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
}
@
memoize
private
get
toggleReplAction
():
ToggleRep
lAction
{
return
this
.
_register
(
this
.
instantiationService
.
createInstance
(
ToggleReplAction
,
ToggleReplAction
.
ID
,
ToggleRep
lAction
.
LABEL
));
private
get
toggleReplAction
():
OpenDebugPane
lAction
{
return
this
.
_register
(
this
.
instantiationService
.
createInstance
(
OpenDebugPanelAction
,
OpenDebugPanelAction
.
ID
,
OpenDebugPane
lAction
.
LABEL
));
}
@
memoize
...
...
@@ -228,14 +228,16 @@ export class DebugViewPaneContainer extends ViewPaneContainer {
}
}
class
ToggleRep
lAction
extends
TogglePanelAction
{
static
readonly
ID
=
'
debug
.toggleRepl
'
;
static
readonly
LABEL
=
nls
.
localize
({
comment
:
[
'
Debug is a noun in this context, not a verb.
'
],
key
:
'
debugConsoleAction
'
},
'
Debug Console
'
);
export
class
OpenDebugPane
lAction
extends
TogglePanelAction
{
public
static
readonly
ID
=
'
workbench.debug.action
.toggleRepl
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
toggleDebugPanel
'
,
"
Debug Console
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IWorkbenchLayoutService
layoutService
:
IWorkbenchLayoutService
,
@
IPanelService
panelService
:
IPanelService
constructor
(
id
:
string
,
label
:
string
,
@
IPanelService
panelService
:
IPanelService
,
@
IWorkbenchLayoutService
layoutService
:
IWorkbenchLayoutService
)
{
super
(
id
,
label
,
REPL_ID
,
panelService
,
layoutService
,
'
debug-action codicon-terminal
'
);
super
(
id
,
label
,
DEBUG_PANEL_ID
,
panelService
,
layoutService
);
}
}
src/vs/workbench/contrib/debug/browser/repl.ts
浏览文件 @
3df58b02
...
...
@@ -18,17 +18,15 @@ import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IInstantiationService
,
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
Panel
}
from
'
vs/workbench/browser/panel
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ICodeEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
dispose
,
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
IDebugService
,
REPL_ID
,
DEBUG_SCHEME
,
CONTEXT_IN_DEBUG_REPL
,
IDebugSession
,
State
,
IReplElement
,
IDebugConfiguration
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IDebugService
,
DEBUG_SCHEME
,
CONTEXT_IN_DEBUG_REPL
,
IDebugSession
,
State
,
IReplElement
,
IDebugConfiguration
,
REPL_VIEW_ID
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
HistoryNavigator
}
from
'
vs/base/common/history
'
;
import
{
IHistoryNavigationWidget
}
from
'
vs/base/browser/history
'
;
import
{
createAndBindHistoryNavigationWidgetScopedContextKeyService
}
from
'
vs/platform/browser/contextScopedHistoryWidget
'
;
...
...
@@ -40,7 +38,6 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import
{
FocusSessionActionViewItem
}
from
'
vs/workbench/contrib/debug/browser/debugActionViewItems
'
;
import
{
CompletionContext
,
CompletionList
,
CompletionProviderRegistry
,
CompletionItem
,
completionKindFromString
,
CompletionItemKind
}
from
'
vs/editor/common/modes
'
;
import
{
first
}
from
'
vs/base/common/arrays
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ITreeNode
,
ITreeContextMenuEvent
,
IAsyncDataSource
}
from
'
vs/base/browser/ui/tree/tree
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
LinkDetector
}
from
'
vs/workbench/contrib/debug/browser/linkDetector
'
;
...
...
@@ -56,6 +53,9 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
import
{
PANEL_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
ReplDelegate
,
ReplVariablesRenderer
,
ReplSimpleElementsRenderer
,
ReplEvaluationInputsRenderer
,
ReplEvaluationResultsRenderer
,
ReplRawObjectsRenderer
,
ReplDataSource
,
ReplAccessibilityProvider
}
from
'
vs/workbench/contrib/debug/browser/replViewer
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
ViewPane
,
IViewPaneOptions
}
from
'
vs/workbench/browser/parts/views/viewPaneContainer
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IViewsService
}
from
'
vs/workbench/common/views
'
;
const
$
=
dom
.
$
;
...
...
@@ -77,7 +77,8 @@ function revealLastElement(tree: WorkbenchAsyncDataTree<any, any, any>) {
}
const
sessionsToIgnore
=
new
Set
<
IDebugSession
>
();
export
class
Repl
extends
Panel
implements
IPrivateReplService
,
IHistoryNavigationWidget
{
export
class
Repl
extends
ViewPane
implements
IPrivateReplService
,
IHistoryNavigationWidget
{
_serviceBrand
:
undefined
;
private
static
readonly
REFRESH_DELAY
=
100
;
// delay in ms to refresh the repl for new elements to show
...
...
@@ -100,21 +101,22 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
private
modelChangeListener
:
IDisposable
=
Disposable
.
None
;
constructor
(
options
:
IViewPaneOptions
,
@
IDebugService
private
readonly
debugService
:
IDebugService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
,
@
IStorageService
private
readonly
storageService
:
IStorageService
,
@
IThemeService
protected
themeService
:
IThemeService
,
@
IModelService
private
readonly
modelService
:
IModelService
,
@
IContextKeyService
private
readonly
contextKeyService
:
IContextKeyService
,
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
,
@
IContextMenuService
private
readonly
contextMenuService
:
IContextMenuService
,
@
IConfigurationService
private
readonly
configurationService
:
IConfigurationService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
ITextResourcePropertiesService
private
readonly
textResourcePropertiesService
:
ITextResourcePropertiesService
,
@
IClipboardService
private
readonly
clipboardService
:
IClipboardService
,
@
IEditorService
private
readonly
editorService
:
IEditorService
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
)
{
super
(
REPL_ID
,
telemetryService
,
themeService
,
storage
Service
);
super
(
{
...(
options
as
IViewPaneOptions
),
id
:
REPL_VIEW_ID
,
ariaHeaderLabel
:
localize
(
'
debugConsole
'
,
"
Debug Console
"
)
},
keybindingService
,
contextMenuService
,
configurationService
,
contextKey
Service
);
this
.
history
=
new
HistoryNavigator
(
JSON
.
parse
(
this
.
storageService
.
get
(
HISTORY_STORAGE_KEY
,
StorageScope
.
WORKSPACE
,
'
[]
'
)),
50
);
codeEditorService
.
registerDecorationType
(
DECORATION_KEY
,
{});
...
...
@@ -187,7 +189,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
if
(
!
input
||
input
.
state
===
State
.
Inactive
)
{
await
this
.
selectSession
(
newSession
);
}
this
.
update
TitleArea
();
this
.
update
Actions
();
}));
this
.
_register
(
this
.
themeService
.
onThemeChange
(()
=>
{
this
.
refreshReplElements
(
false
);
...
...
@@ -195,7 +197,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
this
.
updateInputDecoration
();
}
}));
this
.
_register
(
this
.
onDidChangeVisibility
(
visible
=>
{
this
.
_register
(
this
.
onDidChange
Body
Visibility
(
visible
=>
{
if
(
!
visible
)
{
dispose
(
this
.
model
);
}
else
{
...
...
@@ -328,7 +330,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
// Ignore inactive sessions which got cleared - so they are not shown any more
sessionsToIgnore
.
add
(
session
);
await
this
.
selectSession
();
this
.
update
TitleArea
();
this
.
update
Actions
();
}
}
this
.
replInput
.
focus
();
...
...
@@ -345,7 +347,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
this
.
replInputLineCount
=
1
;
if
(
shouldRelayout
)
{
// Trigger a layout to shrink a potential multi line input
this
.
layout
(
this
.
dimension
);
this
.
layout
Body
(
this
.
dimension
.
height
,
this
.
dimension
.
width
);
}
}
}
...
...
@@ -366,21 +368,21 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
return
removeAnsiEscapeCodes
(
text
);
}
layout
(
dimension
:
dom
.
Dimension
):
void
{
this
.
dimension
=
dimension
;
protected
layoutBody
(
height
:
number
,
width
:
number
):
void
{
this
.
dimension
=
new
dom
.
Dimension
(
width
,
height
)
;
const
replInputHeight
=
Repl
.
REPL_INPUT_LINE_HEIGHT
*
this
.
replInputLineCount
;
if
(
this
.
tree
)
{
const
lastElementVisible
=
this
.
tree
.
scrollTop
+
this
.
tree
.
renderHeight
>=
this
.
tree
.
scrollHeight
;
const
treeHeight
=
dimension
.
height
-
replInputHeight
;
const
treeHeight
=
height
-
replInputHeight
;
this
.
tree
.
getHTMLElement
().
style
.
height
=
`
${
treeHeight
}
px`
;
this
.
tree
.
layout
(
treeHeight
,
dimension
.
width
);
this
.
tree
.
layout
(
treeHeight
,
width
);
if
(
lastElementVisible
)
{
revealLastElement
(
this
.
tree
);
}
}
this
.
replInputContainer
.
style
.
height
=
`
${
replInputHeight
}
px`
;
this
.
replInput
.
layout
({
width
:
dimension
.
width
-
20
,
height
:
replInputHeight
});
this
.
replInput
.
layout
({
width
:
width
-
20
,
height
:
replInputHeight
});
}
focus
():
void
{
...
...
@@ -410,12 +412,12 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
// --- Cached locals
@
memoize
private
get
selectReplAction
():
SelectReplAction
{
return
this
.
scopedI
nstantiationService
.
createInstance
(
SelectReplAction
,
SelectReplAction
.
ID
,
SelectReplAction
.
LABEL
);
return
this
.
i
nstantiationService
.
createInstance
(
SelectReplAction
,
SelectReplAction
.
ID
,
SelectReplAction
.
LABEL
);
}
@
memoize
private
get
clearReplAction
():
ClearReplAction
{
return
this
.
scopedI
nstantiationService
.
createInstance
(
ClearReplAction
,
ClearReplAction
.
ID
,
ClearReplAction
.
LABEL
);
return
this
.
i
nstantiationService
.
createInstance
(
ClearReplAction
,
ClearReplAction
.
ID
,
ClearReplAction
.
LABEL
);
}
@
memoize
...
...
@@ -436,8 +438,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
// --- Creation
create
(
parent
:
HTMLElement
):
void
{
super
.
create
(
parent
);
protected
renderBody
(
parent
:
HTMLElement
):
void
{
this
.
container
=
dom
.
append
(
parent
,
$
(
'
.repl
'
));
const
treeContainer
=
dom
.
append
(
this
.
container
,
$
(
'
.repl-tree
'
));
this
.
createReplInput
(
this
.
container
);
...
...
@@ -511,7 +512,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
const
lineCount
=
model
?
Math
.
min
(
10
,
model
.
getLineCount
())
:
1
;
if
(
lineCount
!==
this
.
replInputLineCount
)
{
this
.
replInputLineCount
=
lineCount
;
this
.
layout
(
this
.
dimension
);
this
.
layout
Body
(
this
.
dimension
.
height
,
this
.
dimension
.
width
);
}
}));
// We add the input decoration only when the focus is in the input #61126
...
...
@@ -590,7 +591,7 @@ export class Repl extends Panel implements IPrivateReplService, IHistoryNavigati
this
.
replInput
.
setDecorations
(
DECORATION_KEY
,
decorations
);
}
protected
saveState
():
void
{
saveState
():
void
{
const
replHistory
=
this
.
history
.
getHistory
();
if
(
replHistory
.
length
)
{
this
.
storageService
.
store
(
HISTORY_STORAGE_KEY
,
JSON
.
stringify
(
replHistory
),
StorageScope
.
WORKSPACE
);
...
...
@@ -712,8 +713,6 @@ class SelectReplAction extends Action {
}
else
{
await
this
.
replService
.
selectSession
(
session
);
}
return
Promise
.
resolve
(
undefined
);
}
}
...
...
@@ -722,14 +721,14 @@ export class ClearReplAction extends Action {
static
readonly
LABEL
=
localize
(
'
clearRepl
'
,
"
Clear Console
"
);
constructor
(
id
:
string
,
label
:
string
,
@
I
PanelService
private
readonly
panelService
:
IPanel
Service
@
I
ViewsService
private
readonly
viewsService
:
IViews
Service
)
{
super
(
id
,
label
,
'
debug-action codicon-clear-all
'
);
}
async
run
():
Promise
<
any
>
{
const
repl
=
<
Repl
>
this
.
panelService
.
openPanel
(
REPL_ID
)
;
await
repl
.
clearRepl
();
const
view
=
await
this
.
viewsService
.
openView
(
REPL_VIEW_ID
)
as
Repl
;
await
view
.
clearRepl
();
aria
.
status
(
localize
(
'
debugConsoleCleared
'
,
"
Debug console was cleared
"
));
}
}
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
3df58b02
...
...
@@ -31,7 +31,8 @@ export const WATCH_VIEW_ID = 'workbench.debug.watchExpressionsView';
export
const
CALLSTACK_VIEW_ID
=
'
workbench.debug.callStackView
'
;
export
const
LOADED_SCRIPTS_VIEW_ID
=
'
workbench.debug.loadedScriptsView
'
;
export
const
BREAKPOINTS_VIEW_ID
=
'
workbench.debug.breakPointsView
'
;
export
const
REPL_ID
=
'
workbench.panel.repl
'
;
export
const
DEBUG_PANEL_ID
=
'
workbench.panel.repl
'
;
export
const
REPL_VIEW_ID
=
'
workbench.panel.repl.view
'
;
export
const
DEBUG_SERVICE_ID
=
'
debugService
'
;
export
const
CONTEXT_DEBUG_TYPE
=
new
RawContextKey
<
string
>
(
'
debugType
'
,
undefined
);
export
const
CONTEXT_DEBUG_CONFIGURATION_TYPE
=
new
RawContextKey
<
string
>
(
'
debugConfigurationType
'
,
undefined
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录