Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
113d877e
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,发现更多精彩内容 >>
提交
113d877e
编写于
4月 18, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: view model is no longer an EventEmitter
上级
dd7801f8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
16 deletion
+45
-16
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
.../workbench/parts/debug/browser/debugEditorModelManager.ts
+3
-3
src/vs/workbench/parts/debug/browser/debugViews.ts
src/vs/workbench/parts/debug/browser/debugViews.ts
+6
-7
src/vs/workbench/parts/debug/common/debug.ts
src/vs/workbench/parts/debug/common/debug.ts
+9
-1
src/vs/workbench/parts/debug/common/debugViewModel.ts
src/vs/workbench/parts/debug/common/debugViewModel.ts
+27
-5
未找到文件。
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
浏览文件 @
113d877e
...
...
@@ -8,7 +8,7 @@ import objects = require('vs/base/common/objects');
import
lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
editorcommon
=
require
(
'
vs/editor/common/editorCommon
'
);
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IDebugService
,
ModelEvents
,
ViewModelEvents
,
IBreakpoint
,
IRawBreakpoint
,
State
,
ServiceEvents
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IDebugService
,
ModelEvents
,
IBreakpoint
,
IRawBreakpoint
,
State
,
ServiceEvents
}
from
'
vs/workbench/parts/debug/common/debug
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
function
toMap
(
arr
:
string
[]):
{
[
key
:
string
]:
boolean
;
}
{
...
...
@@ -81,7 +81,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
this
.
toDispose
.
push
(
this
.
modelService
.
onModelRemoved
(
this
.
onModelRemoved
,
this
));
this
.
toDispose
.
push
(
this
.
debugService
.
getModel
().
addListener2
(
ModelEvents
.
BREAKPOINTS_UPDATED
,
()
=>
this
.
onBreakpointsChanged
()));
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
addListener2
(
ViewModelEvents
.
FOCUSED_STACK_FRAME_UPDATED
,
()
=>
this
.
onFocusedStackFrameUpdated
()));
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
onDidFocusStackFrame
(()
=>
this
.
onFocusStackFrame
()));
this
.
toDispose
.
push
(
this
.
debugService
.
addListener2
(
ServiceEvents
.
STATE_CHANGED
,
()
=>
{
if
(
this
.
debugService
.
getState
()
===
State
.
Inactive
)
{
Object
.
keys
(
this
.
modelData
).
forEach
(
key
=>
this
.
modelData
[
key
].
dirty
=
false
);
...
...
@@ -123,7 +123,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
// call stack management. Represent data coming from the debug service.
private
onFocus
edStackFrameUpdated
():
void
{
private
onFocus
StackFrame
():
void
{
Object
.
keys
(
this
.
modelData
).
forEach
(
modelUrlStr
=>
{
const
modelData
=
this
.
modelData
[
modelUrlStr
];
modelData
.
currentStackDecorations
=
modelData
.
model
.
deltaDecorations
(
modelData
.
currentStackDecorations
,
this
.
createCallStackDecorations
(
modelUrlStr
));
...
...
src/vs/workbench/parts/debug/browser/debugViews.ts
浏览文件 @
113d877e
...
...
@@ -82,7 +82,7 @@ export class VariablesView extends viewlet.CollapsibleViewletView {
const
collapseAction
=
this
.
instantiationService
.
createInstance
(
viewlet
.
CollapseAction
,
this
.
tree
,
false
,
'
explorer-action collapse-explorer
'
);
this
.
toolBar
.
setActions
(
actionbarregistry
.
prepareActions
([
collapseAction
]))();
this
.
toDispose
.
push
(
viewModel
.
addListener2
(
debug
.
ViewModelEvents
.
FOCUSED_STACK_FRAME_UPDATED
,
()
=>
this
.
onFocusedStackFrameUpdated
(
)));
this
.
toDispose
.
push
(
viewModel
.
onDidFocusStackFrame
(
sf
=>
this
.
onFocusStackFrame
(
sf
)));
this
.
toDispose
.
push
(
this
.
debugService
.
addListener2
(
debug
.
ServiceEvents
.
STATE_CHANGED
,
()
=>
{
collapseAction
.
enabled
=
this
.
debugService
.
getState
()
===
debug
.
State
.
Running
||
this
.
debugService
.
getState
()
===
debug
.
State
.
Stopped
;
}));
...
...
@@ -97,9 +97,8 @@ export class VariablesView extends viewlet.CollapsibleViewletView {
}));
}
private
onFocus
edStackFrameUpdated
(
):
void
{
private
onFocus
StackFrame
(
stackFrame
:
debug
.
IStackFrame
):
void
{
this
.
tree
.
refresh
().
then
(()
=>
{
const
stackFrame
=
this
.
debugService
.
getViewModel
().
getFocusedStackFrame
();
if
(
stackFrame
)
{
return
stackFrame
.
getScopes
(
this
.
debugService
).
then
(
scopes
=>
{
if
(
scopes
.
length
>
0
)
{
...
...
@@ -162,7 +161,7 @@ export class WatchExpressionsView extends viewlet.CollapsibleViewletView {
this
.
toolBar
.
setActions
(
actionbarregistry
.
prepareActions
([
addWatchExpressionAction
,
collapseAction
,
removeAllWatchExpressionsAction
]))();
this
.
toDispose
.
push
(
this
.
debugService
.
getModel
().
addListener2
(
debug
.
ModelEvents
.
WATCH_EXPRESSIONS_UPDATED
,
(
we
:
model
.
Expression
)
=>
this
.
onWatchExpressionsUpdated
(
we
)));
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
addListener2
(
debug
.
ViewModelEvents
.
SELECTED_EXPRESSION_UPDATED
,
(
expression
:
debug
.
IExpression
)
=>
{
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
onDidSelectExpression
(
expression
=>
{
if
(
!
expression
||
!
(
expression
instanceof
model
.
Expression
))
{
return
;
}
...
...
@@ -280,8 +279,8 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
this
.
tree
.
refresh
().
done
(
null
,
errors
.
onUnexpectedError
);
}));
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
addListener2
(
debug
.
ViewModelEvents
.
FOCUSED_STACK_FRAME_UPDATED
,
()
=>
{
const
focussedThread
=
this
.
debugService
.
getModel
().
getThreads
()[
this
.
debugService
.
getViewModel
().
getFocusedThreadId
()]
;
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
onDidFocusStackFrame
(
sf
=>
{
const
focussedThread
=
sf
?
this
.
debugService
.
getModel
().
getThreads
()[
sf
.
threadId
]
:
null
;
if
(
!
focussedThread
)
{
this
.
pauseMessage
.
hide
();
return
;
...
...
@@ -398,7 +397,7 @@ export class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
}
}));
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
addListener2
(
debug
.
ViewModelEvents
.
SELECTED_FUNCTION_BREAKPOINT_UPDATED
,
(
fbp
:
debug
.
IFunctionBreakpoint
)
=>
{
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
onDidSelectFunctionBreakpoint
(
fbp
=>
{
if
(
!
fbp
||
!
(
fbp
instanceof
model
.
FunctionBreakpoint
))
{
return
;
}
...
...
src/vs/workbench/parts/debug/common/debug.ts
浏览文件 @
113d877e
...
...
@@ -166,13 +166,17 @@ export var SessionEvents = {
// model interfaces
export
interface
IViewModel
extends
ee
.
EventEmitter
{
export
interface
IViewModel
{
getFocusedStackFrame
():
IStackFrame
;
getSelectedExpression
():
IExpression
;
getFocusedThreadId
():
number
;
setSelectedExpression
(
expression
:
IExpression
);
getSelectedFunctionBreakpoint
():
IFunctionBreakpoint
;
setSelectedFunctionBreakpoint
(
functionBreakpoint
:
IFunctionBreakpoint
):
void
;
onDidFocusStackFrame
:
Event
<
IStackFrame
>
;
onDidSelectExpression
:
Event
<
IExpression
>
;
onDidSelectFunctionBreakpoint
:
Event
<
IFunctionBreakpoint
>
;
}
export
interface
IModel
extends
ee
.
IEventEmitter
,
ITreeElement
{
...
...
@@ -281,6 +285,10 @@ export var IDebugService = createDecorator<IDebugService>(DEBUG_SERVICE_ID);
export
interface
IDebugService
extends
ee
.
IEventEmitter
{
serviceId
:
ServiceIdentifier
<
any
>
;
/**
* Gets the current debug state.
*/
getState
():
State
;
/**
...
...
src/vs/workbench/parts/debug/common/debugViewModel.ts
浏览文件 @
113d877e
...
...
@@ -2,14 +2,24 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
ee
=
require
(
'
vs/base/common/eventEmitter
'
);
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
export
class
ViewModel
extends
ee
.
EventEmitter
implements
debug
.
IViewModel
,
debug
.
ITreeElement
{
export
class
ViewModel
implements
debug
.
IViewModel
,
debug
.
ITreeElement
{
private
focusedStackFrame
:
debug
.
IStackFrame
;
private
selectedExpression
:
debug
.
IExpression
;
private
selectedFunctionBreakpoint
:
debug
.
IFunctionBreakpoint
;
private
_onDidFocusStackFrame
:
Emitter
<
debug
.
IStackFrame
>
;
private
_onDidSelectExpression
:
Emitter
<
debug
.
IExpression
>
;
private
_onDidSelectFunctionBreakpoint
:
Emitter
<
debug
.
IFunctionBreakpoint
>
;
constructor
()
{
this
.
_onDidFocusStackFrame
=
new
Emitter
<
debug
.
IStackFrame
>
();
this
.
_onDidSelectExpression
=
new
Emitter
<
debug
.
IExpression
>
();
this
.
_onDidSelectFunctionBreakpoint
=
new
Emitter
<
debug
.
IFunctionBreakpoint
>
();
}
public
getId
():
string
{
return
'
root
'
;
...
...
@@ -21,7 +31,11 @@ export class ViewModel extends ee.EventEmitter implements debug.IViewModel, debu
public
setFocusedStackFrame
(
focusedStackFrame
:
debug
.
IStackFrame
):
void
{
this
.
focusedStackFrame
=
focusedStackFrame
;
this
.
emit
(
debug
.
ViewModelEvents
.
FOCUSED_STACK_FRAME_UPDATED
);
this
.
_onDidFocusStackFrame
.
fire
(
focusedStackFrame
);
}
public
get
onDidFocusStackFrame
():
Event
<
debug
.
IStackFrame
>
{
return
this
.
_onDidFocusStackFrame
.
event
;
}
public
getFocusedThreadId
():
number
{
...
...
@@ -34,7 +48,11 @@ export class ViewModel extends ee.EventEmitter implements debug.IViewModel, debu
public
setSelectedExpression
(
expression
:
debug
.
IExpression
)
{
this
.
selectedExpression
=
expression
;
this
.
emit
(
debug
.
ViewModelEvents
.
SELECTED_EXPRESSION_UPDATED
,
expression
);
this
.
_onDidSelectExpression
.
fire
(
expression
);
}
public
get
onDidSelectExpression
():
Event
<
debug
.
IExpression
>
{
return
this
.
_onDidSelectExpression
.
event
;
}
public
getSelectedFunctionBreakpoint
():
debug
.
IFunctionBreakpoint
{
...
...
@@ -43,6 +61,10 @@ export class ViewModel extends ee.EventEmitter implements debug.IViewModel, debu
public
setSelectedFunctionBreakpoint
(
functionBreakpoint
:
debug
.
IFunctionBreakpoint
):
void
{
this
.
selectedFunctionBreakpoint
=
functionBreakpoint
;
this
.
emit
(
debug
.
ViewModelEvents
.
SELECTED_FUNCTION_BREAKPOINT_UPDATED
,
functionBreakpoint
);
this
.
_onDidSelectFunctionBreakpoint
.
fire
(
functionBreakpoint
);
}
public
get
onDidSelectFunctionBreakpoint
():
Event
<
debug
.
IFunctionBreakpoint
>
{
return
this
.
_onDidSelectFunctionBreakpoint
.
event
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录