Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
6b62cad3
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6b62cad3
编写于
12月 22, 2015
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: browser/ linting
上级
90e54670
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
127 addition
and
140 deletion
+127
-140
src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
+3
-3
src/vs/workbench/parts/debug/browser/debugEditorContribution.ts
.../workbench/parts/debug/browser/debugEditorContribution.ts
+1
-1
src/vs/workbench/parts/debug/browser/debugEditorInputs.ts
src/vs/workbench/parts/debug/browser/debugEditorInputs.ts
+2
-2
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
.../workbench/parts/debug/browser/debugEditorModelManager.ts
+14
-15
src/vs/workbench/parts/debug/browser/debugHoverWidget.ts
src/vs/workbench/parts/debug/browser/debugHoverWidget.ts
+7
-7
src/vs/workbench/parts/debug/browser/debugViewer.ts
src/vs/workbench/parts/debug/browser/debugViewer.ts
+34
-39
src/vs/workbench/parts/debug/browser/debugViewlet.ts
src/vs/workbench/parts/debug/browser/debugViewlet.ts
+38
-39
src/vs/workbench/parts/debug/browser/replEditor.ts
src/vs/workbench/parts/debug/browser/replEditor.ts
+12
-12
src/vs/workbench/parts/debug/browser/replViewer.ts
src/vs/workbench/parts/debug/browser/replViewer.ts
+16
-21
src/vs/workbench/parts/debug/test/common/debugModel.test.ts
src/vs/workbench/parts/debug/test/common/debugModel.test.ts
+0
-1
未找到文件。
src/vs/workbench/parts/debug/browser/debugActionsWidget.ts
浏览文件 @
6b62cad3
...
...
@@ -20,7 +20,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
IDebugService
=
debug
.
IDebugService
;
var
$
=
builder
.
$
;
const
$
=
builder
.
$
;
export
class
DebugActionsWidget
implements
wbext
.
IWorkbenchContribution
{
private
static
ID
=
'
debug.actionsWidget
'
;
...
...
@@ -59,12 +59,12 @@ export class DebugActionsWidget implements wbext.IWorkbenchContribution {
this
.
onDebugStateChange
();
}));
this
.
toDispose
.
push
(
this
.
actionBar
.
actionRunner
.
addListener2
(
events
.
EventType
.
RUN
,
(
e
:
any
)
=>
{
//
Check for E
rror
//
check for e
rror
if
(
e
.
error
&&
!
errors
.
isPromiseCanceledError
(
e
.
error
))
{
this
.
messageService
.
show
(
severity
.
Error
,
e
.
error
);
}
//
L
og in telemetry
//
l
og in telemetry
if
(
this
.
telemetryService
)
{
this
.
telemetryService
.
publicLog
(
'
workbenchActionExecuted
'
,
{
id
:
e
.
action
.
id
,
from
:
'
debugActionsWidget
'
});
}
...
...
src/vs/workbench/parts/debug/browser/debugEditorContribution.ts
浏览文件 @
6b62cad3
...
...
@@ -176,7 +176,7 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution
private
onKeyDown
(
e
:
keyboard
.
StandardKeyboardEvent
):
void
{
const
stopKey
=
env
.
isMacintosh
?
KeyCode
.
Meta
:
KeyCode
.
Ctrl
;
if
(
e
.
keyCode
!==
stopKey
)
{
//
D
o not hide hover when Ctrl/Meta is pressed
//
d
o not hide hover when Ctrl/Meta is pressed
this
.
hoverWidget
.
hide
();
}
}
...
...
src/vs/workbench/parts/debug/browser/debugEditorInputs.ts
浏览文件 @
6b62cad3
...
...
@@ -47,11 +47,11 @@ export class ReplEditorInput extends wbeditorcommon.EditorInput {
return
ReplEditorInput
.
ID
;
}
public
getName
()
:
string
{
public
getName
():
string
{
return
ReplEditorInput
.
NAME
;
}
public
resolve
(
refresh
?:
boolean
):
TPromise
<
wbeditorcommon
.
EditorModel
>
{
public
resolve
(
refresh
?:
boolean
):
TPromise
<
wbeditorcommon
.
EditorModel
>
{
return
TPromise
.
as
(
null
);
}
}
src/vs/workbench/parts/debug/browser/debugEditorModelManager.ts
浏览文件 @
6b62cad3
...
...
@@ -12,7 +12,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
function
toMap
(
arr
:
string
[]):
{
[
key
:
string
]:
boolean
;
}
{
const
result
:
{
[
key
:
string
]:
boolean
;
}
=
{};
for
(
var
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
result
[
arr
[
i
]]
=
true
;
}
...
...
@@ -61,10 +61,9 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
}
public
dispose
():
void
{
var
modelUrlStr
:
string
;
for
(
modelUrlStr
in
this
.
modelData
)
{
for
(
let
modelUrlStr
in
this
.
modelData
)
{
if
(
this
.
modelData
.
hasOwnProperty
(
modelUrlStr
))
{
var
modelData
=
this
.
modelData
[
modelUrlStr
];
const
modelData
=
this
.
modelData
[
modelUrlStr
];
lifecycle
.
disposeAll
(
modelData
.
toDispose
);
modelData
.
model
.
deltaDecorations
(
modelData
.
breakpointDecorationIds
,
[]);
modelData
.
model
.
deltaDecorations
(
modelData
.
currentStackDecorations
,
[]);
...
...
@@ -88,8 +87,8 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
const
modelUrlStr
=
model
.
getAssociatedResource
().
toString
();
const
breakpoints
=
this
.
debugService
.
getModel
().
getBreakpoints
().
filter
(
bp
=>
bp
.
source
.
uri
.
toString
()
===
modelUrlStr
);
var
currentStackDecorations
=
model
.
deltaDecorations
([],
this
.
createCallStackDecorations
(
modelUrlStr
));
var
breakPointDecorations
=
model
.
deltaDecorations
([],
this
.
createBreakpointDecorations
(
breakpoints
));
const
currentStackDecorations
=
model
.
deltaDecorations
([],
this
.
createCallStackDecorations
(
modelUrlStr
));
const
breakPointDecorations
=
model
.
deltaDecorations
([],
this
.
createBreakpointDecorations
(
breakpoints
));
const
toDispose
:
lifecycle
.
IDisposable
[]
=
[
model
.
addListener2
(
editorcommon
.
EventType
.
ModelDecorationsChanged
,
(
e
:
editorcommon
.
IModelDecorationsChangedEvent
)
=>
this
.
onModelDecorationsChanged
(
modelUrlStr
,
e
))];
...
...
@@ -115,7 +114,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
}
}
//
C
all stack management. Represent data coming from the debug service.
//
c
all stack management. Represent data coming from the debug service.
private
onFocusedStackFrameUpdated
():
void
{
Object
.
keys
(
this
.
modelData
).
forEach
(
modelUrlStr
=>
{
...
...
@@ -132,12 +131,12 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
return
result
;
}
//
O
nly show decorations for the currently focussed thread.
//
o
nly show decorations for the currently focussed thread.
const
thread
=
allThreads
[
focusedStackFrame
.
threadId
];
thread
.
callStack
.
filter
(
sf
=>
sf
.
source
.
uri
.
toString
()
===
modelUrlStr
).
forEach
(
sf
=>
{
const
wholeLineRange
=
createRange
(
sf
.
lineNumber
,
sf
.
column
,
sf
.
lineNumber
,
Number
.
MAX_VALUE
);
//
C
ompute how to decorate the editor. Different decorations are used if this is a top stack frame, focussed stack frame,
//
c
ompute how to decorate the editor. Different decorations are used if this is a top stack frame, focussed stack frame,
// an exception or a stack frame that did not change the line number (we only decorate the columns, not the whole line).
if
(
sf
===
thread
.
callStack
[
0
])
{
result
.
push
({
...
...
@@ -183,12 +182,12 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
return
result
;
}
//
B
reakpoints management. Represent data coming from the debug service and also send data back.
//
b
reakpoints management. Represent data coming from the debug service and also send data back.
private
onModelDecorationsChanged
(
modelUrlStr
:
string
,
e
:
editorcommon
.
IModelDecorationsChangedEvent
):
void
{
const
modelData
=
this
.
modelData
[
modelUrlStr
];
if
(
!
e
.
addedOrChangedDecorations
.
some
(
d
=>
modelData
.
breakpointDecorationsAsMap
.
hasOwnProperty
(
d
.
id
)))
{
//
N
othing to do, my decorations did not change.
//
n
othing to do, my decorations did not change.
return
;
}
...
...
@@ -205,9 +204,9 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
const
modelUrl
=
modelData
.
model
.
getAssociatedResource
();
for
(
let
i
=
0
,
len
=
modelData
.
breakpointDecorationIds
.
length
;
i
<
len
;
i
++
)
{
const
decorationRange
=
modelData
.
model
.
getDecorationRange
(
modelData
.
breakpointDecorationIds
[
i
]);
//
C
heck if the line got deleted.
//
c
heck if the line got deleted.
if
(
decorationRange
.
endColumn
-
decorationRange
.
startColumn
>
0
)
{
//
S
ince we know it is collapsed, it cannot grow to multiple lines
//
s
ince we know it is collapsed, it cannot grow to multiple lines
data
.
push
({
uri
:
modelUrl
,
lineNumber
:
decorationRange
.
startLineNumber
,
...
...
@@ -262,7 +261,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
});
}
//
E
ditor decorations
//
e
ditor decorations
private
static
BREAKPOINT_DECORATION
:
editorcommon
.
IModelDecorationOptions
=
{
glyphMarginClassName
:
'
debug-breakpoint-glyph
'
,
...
...
@@ -279,7 +278,7 @@ export class DebugEditorModelManager implements IWorkbenchContribution {
stickiness
:
editorcommon
.
TrackedRangeStickiness
.
NeverGrowsWhenTypingAtEdges
};
//
W
e need a separate decoration for glyph margin, since we do not want it on each line of a multi line statement.
//
w
e need a separate decoration for glyph margin, since we do not want it on each line of a multi line statement.
private
static
TOP_STACK_FRAME_MARGIN
:
editorcommon
.
IModelDecorationOptions
=
{
glyphMarginClassName
:
'
debug-top-stack-frame-glyph
'
,
stickiness
:
editorcommon
.
TrackedRangeStickiness
.
NeverGrowsWhenTypingAtEdges
...
...
src/vs/workbench/parts/debug/browser/debugHoverWidget.ts
浏览文件 @
6b62cad3
...
...
@@ -11,12 +11,12 @@ import editorcommon = require('vs/editor/common/editorCommon');
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
{
tokenizeToHtmlContent
}
from
'
vs/editor/common/modes/textToHtmlTokenizer
'
;
var
$
=
dom
.
emmet
;
const
$
=
dom
.
emmet
;
export
class
DebugHoverWidget
implements
editorbrowser
.
IContentWidget
{
public
static
ID
=
'
debug.hoverWidget
'
;
//
E
ditor.IContentWidget.allowEditorOverflow
//
e
ditor.IContentWidget.allowEditorOverflow
public
allowEditorOverflow
=
true
;
private
domNode
:
HTMLElement
;
...
...
@@ -52,7 +52,7 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
return
;
}
//
S
tring magic to get the parents of the variable (a and b for a.b.foo)
//
s
tring magic to get the parents of the variable (a and b for a.b.foo)
const
lineContent
=
this
.
editor
.
getModel
().
getLineContent
(
pos
.
lineNumber
);
const
namesToFind
=
lineContent
.
substring
(
0
,
lineContent
.
indexOf
(
'
.
'
+
hoveringOver
))
.
split
(
'
.
'
).
map
(
word
=>
word
.
trim
()).
filter
(
word
=>
!!
word
);
...
...
@@ -71,9 +71,9 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
// get the scopes variables
.
map
((
scope
:
debug
.
IScope
)
=>
scope
.
getChildren
(
this
.
debugService
).
done
((
children
:
debug
.
IExpression
[])
=>
{
//
L
ook for our variable in the list. First find the parents of the hovered variable if there are any.
//
l
ook for our variable in the list. First find the parents of the hovered variable if there are any.
for
(
var
i
=
0
;
i
<
namesToFind
.
length
&&
children
;
i
++
)
{
//
S
ome languages pass the type as part of the name, so need to check if the last word of the name matches.
//
s
ome languages pass the type as part of the name, so need to check if the last word of the name matches.
const
filtered
=
children
.
filter
(
v
=>
typeof
v
.
name
===
'
string
'
&&
(
namesToFind
[
i
]
===
v
.
name
||
namesToFind
[
i
]
===
v
.
name
.
substr
(
v
.
name
.
lastIndexOf
(
'
'
)
+
1
)));
if
(
filtered
.
length
!==
1
)
{
break
;
...
...
@@ -111,14 +111,14 @@ export class DebugHoverWidget implements editorbrowser.IContentWidget {
this
.
lastHoveringOver
=
hoveringOver
;
if
(
variable
.
reference
>
0
&&
variable
.
value
.
indexOf
(
'
function
'
)
===
-
1
)
{
var
objectToString
=
'
{
\n
'
;
let
objectToString
=
'
{
\n
'
;
variable
.
getChildren
(
this
.
debugService
).
then
(
children
=>
{
if
(
!
children
)
{
this
.
hide
();
return
;
}
for
(
var
i
=
0
;
i
<
children
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
children
.
length
;
i
++
)
{
objectToString
+=
`
${
children
[
i
].
name
}
:
${
children
[
i
].
value
}
`
.
substr
(
0
,
80
);
if
(
i
<
children
.
length
-
1
)
{
objectToString
+=
'
,
\n
'
;
...
...
src/vs/workbench/parts/debug/browser/debugViewer.ts
浏览文件 @
6b62cad3
...
...
@@ -9,7 +9,6 @@ import lifecycle = require('vs/base/common/lifecycle');
import
paths
=
require
(
'
vs/base/common/paths
'
);
import
async
=
require
(
'
vs/base/common/async
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
severity
from
'
vs/base/common/severity
'
;
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
{
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
dom
=
require
(
'
vs/base/browser/dom
'
);
...
...
@@ -32,16 +31,16 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IMessageService
}
from
'
vs/platform/message/common/message
'
;
import
{
CommonKeybindings
}
from
'
vs/base/common/keyCodes
'
;
var
$
=
dom
.
emmet
;
var
booleanRegex
=
/^true|false$/i
;
var
stringRegex
=
/^
([
'"
])
.*
\1
$/
;
const
$
=
dom
.
emmet
;
const
booleanRegex
=
/^true|false$/i
;
const
stringRegex
=
/^
([
'"
])
.*
\1
$/
;
export
function
renderExpressionValue
(
tree
:
tree
.
ITree
,
arg2
:
debug
.
IExpression
|
string
,
debugInactive
:
boolean
,
container
:
HTMLElement
):
void
{
let
value
=
typeof
arg2
===
'
string
'
?
arg2
:
arg2
.
value
;
//
R
emove stale classes
//
r
emove stale classes
container
.
className
=
'
value
'
;
//
W
hen resolving expressions we represent errors from the server as a variable with name === null.
//
w
hen resolving expressions we represent errors from the server as a variable with name === null.
if
(
value
===
null
||
(
arg2
instanceof
model
.
Expression
&&
!
arg2
.
available
))
{
dom
.
addClass
(
container
,
'
unavailable
'
);
debugInactive
?
dom
.
removeClass
(
container
,
'
error
'
)
:
dom
.
addClass
(
container
,
'
error
'
);
...
...
@@ -62,7 +61,7 @@ export function renderVariable(tree: tree.ITree, variable: model.Variable, data:
if
(
variable
.
value
)
{
renderExpressionValue
(
tree
,
variable
,
debugInactive
,
data
.
value
);
if
(
variable
.
valueChanged
&&
showChanged
)
{
//
V
alue changed color has priority over other colors.
//
v
alue changed color has priority over other colors.
data
.
value
.
className
=
'
value changed
'
;
}
}
else
{
...
...
@@ -84,10 +83,10 @@ function renderRenameBox(debugService: debug.IDebugService, contextViewService:
inputBox
.
value
=
element
.
name
?
element
.
name
:
''
;
inputBox
.
focus
();
var
disposed
=
false
;
var
toDispose
:
[
lifecycle
.
IDisposable
]
=
[
inputBox
];
let
disposed
=
false
;
const
toDispose
:
[
lifecycle
.
IDisposable
]
=
[
inputBox
];
var
wrapUp
=
async
.
once
<
any
,
void
>
((
renamed
:
boolean
)
=>
{
const
wrapUp
=
async
.
once
<
any
,
void
>
((
renamed
:
boolean
)
=>
{
if
(
!
disposed
)
{
disposed
=
true
;
if
(
element
instanceof
model
.
Expression
&&
renamed
&&
inputBox
.
value
)
{
...
...
@@ -102,7 +101,7 @@ function renderRenameBox(debugService: debug.IDebugService, contextViewService:
tree
.
clearHighlight
();
tree
.
DOMFocus
();
//
N
eed to remove the input box since this template will be reused.
//
n
eed to remove the input box since this template will be reused.
container
.
removeChild
(
inputBoxContainer
);
lifecycle
.
disposeAll
(
toDispose
);
}
...
...
@@ -131,9 +130,7 @@ export class SimpleActionProvider implements renderer.IActionProvider {
}
public
getActions
(
tree
:
tree
.
ITree
,
element
:
any
):
TPromise
<
actions
.
IAction
[]
>
{
var
result
:
actions
.
IAction
[]
=
[];
return
Promise
.
as
(
result
);
return
Promise
.
as
([]);
}
public
hasSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
boolean
{
...
...
@@ -141,9 +138,7 @@ export class SimpleActionProvider implements renderer.IActionProvider {
}
public
getSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
TPromise
<
actions
.
IAction
[]
>
{
var
result
:
actions
.
IAction
[]
=
[];
return
Promise
.
as
(
result
);
return
Promise
.
as
([]);
}
public
getActionItem
(
tree
:
tree
.
ITree
,
element
:
any
,
action
:
actions
.
IAction
):
actionbar
.
IActionItem
{
...
...
@@ -177,7 +172,7 @@ export class BaseDebugController extends treedefaults.DefaultController {
}
if
(
this
.
actionProvider
.
hasSecondaryActions
(
tree
,
element
))
{
var
anchor
=
{
x
:
event
.
posx
+
1
,
y
:
event
.
posy
};
const
anchor
=
{
x
:
event
.
posx
+
1
,
y
:
event
.
posy
};
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
this
.
actionProvider
.
getSecondaryActions
(
tree
,
element
),
...
...
@@ -200,7 +195,7 @@ export class BaseDebugController extends treedefaults.DefaultController {
}
}
//
Call S
tack
//
call s
tack
export
class
CallStackDataSource
implements
tree
.
IDataSource
{
...
...
@@ -217,9 +212,9 @@ export class CallStackDataSource implements tree.IDataSource {
return
Promise
.
as
((
<
model
.
Thread
>
element
).
callStack
);
}
var
threads
=
(
<
model
.
Model
>
element
).
getThreads
();
var
threadsArray
:
debug
.
IThread
[]
=
[];
for
(
var
reference
in
threads
)
{
const
threads
=
(
<
model
.
Model
>
element
).
getThreads
();
const
threadsArray
:
debug
.
IThread
[]
=
[];
for
(
let
reference
in
threads
)
{
if
(
threads
.
hasOwnProperty
(
reference
))
{
threadsArray
.
push
(
threads
[
reference
]);
}
...
...
@@ -320,7 +315,7 @@ export class CallStackRenderer implements tree.IRenderer {
}
}
//
V
ariables
//
v
ariables
export
class
VariablesActionProvider
extends
SimpleActionProvider
{
...
...
@@ -452,7 +447,7 @@ export class VariablesRenderer implements tree.IRenderer {
}
}
//
W
atch expressions
//
w
atch expressions
export
class
WatchExpressionsActionProvider
extends
SimpleActionProvider
{
...
...
@@ -480,7 +475,7 @@ export class WatchExpressionsActionProvider extends SimpleActionProvider {
}
public
getSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
Promise
{
var
actions
:
actions
.
Action
[]
=
[];
const
actions
:
actions
.
Action
[]
=
[];
if
(
element
instanceof
model
.
Expression
)
{
const
expression
=
<
model
.
Expression
>
element
;
actions
.
push
(
this
.
instantiationService
.
createInstance
(
debugactions
.
AddWatchExpressionAction
,
debugactions
.
AddWatchExpressionAction
.
ID
,
debugactions
.
AddWatchExpressionAction
.
LABEL
));
...
...
@@ -523,7 +518,7 @@ export class WatchExpressionsDataSource implements tree.IDataSource {
return
true
;
}
var
watchExpression
=
<
model
.
Expression
>
element
;
const
watchExpression
=
<
model
.
Expression
>
element
;
return
watchExpression
.
reference
!==
0
&&
!
strings
.
equalsIgnoreCase
(
watchExpression
.
value
,
'
null
'
);
}
...
...
@@ -634,9 +629,9 @@ export class WatchExpressionsController extends BaseDebugController {
}
/* protected */
public
onLeftClick
(
tree
:
tree
.
ITree
,
element
:
any
,
event
:
mouse
.
StandardMouseEvent
):
boolean
{
//
Double
click on primitive value: open input box to be able to select and copy value.
//
double
click on primitive value: open input box to be able to select and copy value.
if
(
element
instanceof
model
.
Expression
&&
event
.
detail
===
2
)
{
var
expression
=
<
debug
.
IExpression
>
element
;
const
expression
=
<
debug
.
IExpression
>
element
;
if
(
expression
.
reference
===
0
)
{
this
.
debugService
.
getViewModel
().
setSelectedExpression
(
expression
);
}
...
...
@@ -647,9 +642,9 @@ export class WatchExpressionsController extends BaseDebugController {
}
protected
onRename
(
tree
:
tree
.
ITree
,
event
:
KeyboardEvent
):
boolean
{
var
element
=
tree
.
getFocus
();
const
element
=
tree
.
getFocus
();
if
(
element
instanceof
model
.
Expression
)
{
var
watchExpression
=
<
model
.
Expression
>
element
;
const
watchExpression
=
<
model
.
Expression
>
element
;
if
(
watchExpression
.
reference
===
0
)
{
this
.
debugService
.
getViewModel
().
setSelectedExpression
(
watchExpression
);
}
...
...
@@ -660,9 +655,9 @@ export class WatchExpressionsController extends BaseDebugController {
}
protected
onDelete
(
tree
:
tree
.
ITree
,
event
:
keyboard
.
StandardKeyboardEvent
):
boolean
{
var
element
=
tree
.
getFocus
();
const
element
=
tree
.
getFocus
();
if
(
element
instanceof
model
.
Expression
)
{
var
we
=
<
model
.
Expression
>
element
;
const
we
=
<
model
.
Expression
>
element
;
this
.
debugService
.
clearWatchExpressions
(
we
.
getId
());
return
true
;
...
...
@@ -672,7 +667,7 @@ export class WatchExpressionsController extends BaseDebugController {
}
}
//
B
reakpoints
//
b
reakpoints
export
class
BreakpointsActionProvider
extends
SimpleActionProvider
{
...
...
@@ -701,7 +696,7 @@ export class BreakpointsActionProvider extends SimpleActionProvider {
}
public
getSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
TPromise
<
actions
.
IAction
[]
>
{
var
actions
:
actions
.
Action
[]
=
[
this
.
instantiationService
.
createInstance
(
debugactions
.
ToggleEnablementAction
,
debugactions
.
ToggleEnablementAction
.
ID
,
debugactions
.
ToggleEnablementAction
.
LABEL
)];
const
actions
:
actions
.
Action
[]
=
[
this
.
instantiationService
.
createInstance
(
debugactions
.
ToggleEnablementAction
,
debugactions
.
ToggleEnablementAction
.
ID
,
debugactions
.
ToggleEnablementAction
.
LABEL
)];
actions
.
push
(
new
actionbar
.
Separator
());
actions
.
push
(
this
.
instantiationService
.
createInstance
(
debugactions
.
RemoveBreakpointAction
,
debugactions
.
RemoveBreakpointAction
.
ID
,
debugactions
.
RemoveBreakpointAction
.
LABEL
));
...
...
@@ -735,8 +730,8 @@ export class BreakpointsDataSource implements tree.IDataSource {
}
public
getChildren
(
tree
:
tree
.
ITree
,
element
:
any
):
Promise
{
var
model
=
<
model
.
Model
>
element
;
var
exBreakpoints
=
<
debug
.
IEnablement
[]
>
model
.
getExceptionBreakpoints
();
const
model
=
<
model
.
Model
>
element
;
const
exBreakpoints
=
<
debug
.
IEnablement
[]
>
model
.
getExceptionBreakpoints
();
return
Promise
.
as
(
exBreakpoints
.
concat
(
model
.
getFunctionBreakpoints
()).
concat
(
model
.
getBreakpoints
()));
}
...
...
@@ -799,7 +794,7 @@ export class BreakpointsRenderer implements tree.IRenderer {
}
public
renderTemplate
(
tree
:
tree
.
ITree
,
templateId
:
string
,
container
:
HTMLElement
):
any
{
var
data
:
IBreakpointTemplateData
=
Object
.
create
(
null
);
const
data
:
IBreakpointTemplateData
=
Object
.
create
(
null
);
if
(
templateId
===
BreakpointsRenderer
.
BREAKPOINT_TEMPLATE_ID
||
templateId
===
BreakpointsRenderer
.
FUNCTION_BREAKPOINT_TEMPLATE_ID
)
{
data
.
actionBar
=
new
actionbar
.
ActionBar
(
container
,
{
actionRunner
:
this
.
actionRunner
});
data
.
actionBar
.
push
(
this
.
actionProvider
.
getBreakpointActions
(),
{
icon
:
true
,
label
:
false
});
...
...
@@ -839,7 +834,7 @@ export class BreakpointsRenderer implements tree.IRenderer {
}
private
renderExceptionBreakpoint
(
exceptionBreakpoint
:
debug
.
IExceptionBreakpoint
,
data
:
IExceptionBreakpointTemplateData
):
void
{
var
namePascalCase
=
exceptionBreakpoint
.
name
.
charAt
(
0
).
toUpperCase
()
+
exceptionBreakpoint
.
name
.
slice
(
1
);
const
namePascalCase
=
exceptionBreakpoint
.
name
.
charAt
(
0
).
toUpperCase
()
+
exceptionBreakpoint
.
name
.
slice
(
1
);
data
.
name
.
textContent
=
`
${
namePascalCase
}
exceptions`
;
data
.
checkbox
.
checked
=
exceptionBreakpoint
.
enabled
;
}
...
...
@@ -892,7 +887,7 @@ export class BreakpointsController extends BaseDebugController {
private
doNotFocusExceptionBreakpoint
(
tree
:
tree
.
ITree
,
upSucceeded
:
boolean
)
:
boolean
{
if
(
upSucceeded
)
{
var
focus
=
tree
.
getFocus
();
const
focus
=
tree
.
getFocus
();
if
(
focus
instanceof
model
.
ExceptionBreakpoint
)
{
tree
.
focusNth
(
2
);
}
...
...
src/vs/workbench/parts/debug/browser/debugViewlet.ts
浏览文件 @
6b62cad3
...
...
@@ -17,7 +17,6 @@ import actionbarregistry = require('vs/workbench/browser/actionBarRegistry');
import
tree
=
require
(
'
vs/base/parts/tree/common/tree
'
);
import
treeimpl
=
require
(
'
vs/base/parts/tree/browser/treeImpl
'
);
import
splitview
=
require
(
'
vs/base/browser/ui/splitview/splitview
'
);
import
renderer
=
require
(
'
vs/base/parts/tree/browser/actionsRenderer
'
);
import
memento
=
require
(
'
vs/workbench/common/memento
'
);
import
viewlet
=
require
(
'
vs/workbench/browser/viewlet
'
);
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
...
...
@@ -36,18 +35,18 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
IDebugService
=
debug
.
IDebugService
;
function
renderViewTree
(
container
:
HTMLElement
):
HTMLElement
{
var
treeContainer
=
document
.
createElement
(
'
div
'
);
const
treeContainer
=
document
.
createElement
(
'
div
'
);
dom
.
addClass
(
treeContainer
,
'
debug-view-content
'
);
container
.
appendChild
(
treeContainer
);
return
treeContainer
;
}
var
debugTreeOptions
=
{
const
debugTreeOptions
=
{
indentPixels
:
8
,
twistiePixels
:
20
};
var
$
=
builder
.
$
;
const
$
=
builder
.
$
;
class
VariablesView
extends
viewlet
.
CollapsibleViewletView
{
...
...
@@ -64,7 +63,7 @@ class VariablesView extends viewlet.CollapsibleViewletView {
public
renderHeader
(
container
:
HTMLElement
):
void
{
super
.
renderHeader
(
container
);
var
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
const
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
$
(
'
span
'
).
text
(
nls
.
localize
(
'
variables
'
,
"
Variables
"
)).
appendTo
(
titleDiv
);
}
...
...
@@ -78,11 +77,11 @@ class VariablesView extends viewlet.CollapsibleViewletView {
controller
:
new
viewer
.
BaseDebugController
(
this
.
debugService
,
this
.
contextMenuService
,
new
viewer
.
VariablesActionProvider
(
this
.
instantiationService
))
},
debugTreeOptions
);
var
viewModel
=
this
.
debugService
.
getViewModel
();
const
viewModel
=
this
.
debugService
.
getViewModel
();
this
.
tree
.
setInput
(
viewModel
);
var
collapseAction
=
this
.
instantiationService
.
createInstance
(
viewlet
.
CollapseAction
,
this
.
tree
,
false
,
'
explorer-action collapse-explorer
'
);
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
()));
...
...
@@ -93,7 +92,7 @@ class VariablesView extends viewlet.CollapsibleViewletView {
private
onFocusedStackFrameUpdated
():
void
{
this
.
tree
.
refresh
().
then
(()
=>
{
var
stackFrame
=
this
.
debugService
.
getViewModel
().
getFocusedStackFrame
();
const
stackFrame
=
this
.
debugService
.
getViewModel
().
getFocusedStackFrame
();
if
(
stackFrame
)
{
return
stackFrame
.
getScopes
(
this
.
debugService
).
then
(
scopes
=>
{
if
(
scopes
.
length
>
0
)
{
...
...
@@ -122,7 +121,7 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
)
{
super
(
actionRunner
,
!!
settings
[
WatchExpressionsView
.
MEMENTO
],
'
expressionsView
'
,
messageService
,
contextMenuService
);
this
.
toDispose
.
push
(
this
.
debugService
.
getModel
().
addListener2
(
debug
.
ModelEvents
.
WATCH_EXPRESSIONS_UPDATED
,
(
we
)
=>
{
//
O
nly expand when a new watch expression is added.
//
o
nly expand when a new watch expression is added.
if
(
we
instanceof
model
.
Expression
)
{
this
.
expand
();
}
...
...
@@ -131,7 +130,7 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
public
renderHeader
(
container
:
HTMLElement
):
void
{
super
.
renderHeader
(
container
);
var
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
const
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
$
(
'
span
'
).
text
(
nls
.
localize
(
'
watch
'
,
"
Watch
"
)).
appendTo
(
titleDiv
);
}
...
...
@@ -139,7 +138,7 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
dom
.
addClass
(
container
,
'
debug-watch
'
);
this
.
treeContainer
=
renderViewTree
(
container
);
var
actionProvider
=
new
viewer
.
WatchExpressionsActionProvider
(
this
.
instantiationService
);
const
actionProvider
=
new
viewer
.
WatchExpressionsActionProvider
(
this
.
instantiationService
);
this
.
tree
=
new
treeimpl
.
Tree
(
this
.
treeContainer
,
{
dataSource
:
new
viewer
.
WatchExpressionsDataSource
(
this
.
debugService
),
renderer
:
this
.
instantiationService
.
createInstance
(
viewer
.
WatchExpressionsRenderer
,
actionProvider
,
this
.
actionRunner
),
...
...
@@ -148,9 +147,9 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
this
.
tree
.
setInput
(
this
.
debugService
.
getModel
());
var
addWatchExpressionAction
=
this
.
instantiationService
.
createInstance
(
dbgactions
.
AddWatchExpressionAction
,
dbgactions
.
AddWatchExpressionAction
.
ID
,
dbgactions
.
AddWatchExpressionAction
.
LABEL
);
var
collapseAction
=
this
.
instantiationService
.
createInstance
(
viewlet
.
CollapseAction
,
this
.
tree
,
false
,
'
explorer-action collapse-explorer
'
);
var
removeAllWatchExpressionsAction
=
this
.
instantiationService
.
createInstance
(
dbgactions
.
RemoveAllWatchExpressionsAction
,
dbgactions
.
RemoveAllWatchExpressionsAction
.
ID
,
dbgactions
.
RemoveAllWatchExpressionsAction
.
LABEL
);
const
addWatchExpressionAction
=
this
.
instantiationService
.
createInstance
(
dbgactions
.
AddWatchExpressionAction
,
dbgactions
.
AddWatchExpressionAction
.
ID
,
dbgactions
.
AddWatchExpressionAction
.
LABEL
);
const
collapseAction
=
this
.
instantiationService
.
createInstance
(
viewlet
.
CollapseAction
,
this
.
tree
,
false
,
'
explorer-action collapse-explorer
'
);
const
removeAllWatchExpressionsAction
=
this
.
instantiationService
.
createInstance
(
dbgactions
.
RemoveAllWatchExpressionsAction
,
dbgactions
.
RemoveAllWatchExpressionsAction
.
ID
,
dbgactions
.
RemoveAllWatchExpressionsAction
.
LABEL
);
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
)));
...
...
@@ -162,7 +161,7 @@ class WatchExpressionsView extends viewlet.CollapsibleViewletView {
this
.
tree
.
refresh
(
expression
,
false
).
then
(()
=>
{
this
.
tree
.
setHighlight
(
expression
);
var
unbind
=
this
.
tree
.
addListener
(
events
.
EventType
.
HIGHLIGHT
,
(
e
:
tree
.
IHighlightEvent
)
=>
{
const
unbind
=
this
.
tree
.
addListener
(
events
.
EventType
.
HIGHLIGHT
,
(
e
:
tree
.
IHighlightEvent
)
=>
{
if
(
!
e
.
highlight
)
{
this
.
debugService
.
getViewModel
().
setSelectedExpression
(
null
);
this
.
tree
.
refresh
(
expression
).
done
(
null
,
errors
.
onUnexpectedError
);
...
...
@@ -201,7 +200,7 @@ class CallStackView extends viewlet.CollapsibleViewletView {
public
renderHeader
(
container
:
HTMLElement
):
void
{
super
.
renderHeader
(
container
);
var
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
const
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
$
(
'
span
'
).
text
(
nls
.
localize
(
'
callStack
'
,
"
Call Stack
"
)).
appendTo
(
titleDiv
);
}
...
...
@@ -215,7 +214,7 @@ class CallStackView extends viewlet.CollapsibleViewletView {
renderer
:
this
.
instantiationService
.
createInstance
(
viewer
.
CallStackRenderer
)
},
debugTreeOptions
);
var
debugModel
=
this
.
debugService
.
getModel
();
const
debugModel
=
this
.
debugService
.
getModel
();
this
.
tree
.
setInput
(
debugModel
);
...
...
@@ -223,24 +222,24 @@ class CallStackView extends viewlet.CollapsibleViewletView {
if
(
!
e
.
selection
.
length
)
{
return
;
}
var
element
=
e
.
selection
[
0
];
const
element
=
e
.
selection
[
0
];
if
(
!
(
element
instanceof
model
.
StackFrame
))
{
return
;
}
var
stackFrame
=
<
debug
.
IStackFrame
>
element
;
const
stackFrame
=
<
debug
.
IStackFrame
>
element
;
this
.
debugService
.
setFocusedStackFrameAndEvaluate
(
stackFrame
);
var
isMouse
=
(
e
.
payload
.
origin
===
'
mouse
'
);
var
preserveFocus
=
isMouse
;
const
isMouse
=
(
e
.
payload
.
origin
===
'
mouse
'
);
let
preserveFocus
=
isMouse
;
var
originalEvent
:
KeyboardEvent
|
MouseEvent
=
e
&&
e
.
payload
&&
e
.
payload
.
originalEvent
;
const
originalEvent
:
KeyboardEvent
|
MouseEvent
=
e
&&
e
.
payload
&&
e
.
payload
.
originalEvent
;
if
(
originalEvent
&&
isMouse
&&
originalEvent
.
detail
===
2
)
{
preserveFocus
=
false
;
originalEvent
.
preventDefault
();
// focus moves to editor, we need to prevent default
}
var
sideBySide
=
(
originalEvent
&&
(
originalEvent
.
ctrlKey
||
originalEvent
.
metaKey
));
const
sideBySide
=
(
originalEvent
&&
(
originalEvent
.
ctrlKey
||
originalEvent
.
metaKey
));
this
.
debugService
.
openOrRevealEditor
(
stackFrame
.
source
,
stackFrame
.
lineNumber
,
preserveFocus
,
sideBySide
).
done
(
null
,
errors
.
onUnexpectedError
);
}));
...
...
@@ -259,10 +258,10 @@ class CallStackView extends viewlet.CollapsibleViewletView {
}));
this
.
toDispose
.
push
(
this
.
debugService
.
getViewModel
().
addListener2
(
debug
.
ViewModelEvents
.
FOCUSED_STACK_FRAME_UPDATED
,()
=>
{
var
focused
=
this
.
debugService
.
getViewModel
().
getFocusedStackFrame
();
const
focused
=
this
.
debugService
.
getViewModel
().
getFocusedStackFrame
();
if
(
focused
)
{
var
threads
=
this
.
debugService
.
getModel
().
getThreads
();
for
(
var
ref
in
threads
)
{
const
threads
=
this
.
debugService
.
getModel
().
getThreads
();
for
(
let
ref
in
threads
)
{
if
(
threads
[
ref
].
callStack
.
some
(
sf
=>
sf
===
focused
))
{
this
.
tree
.
expand
(
threads
[
ref
]);
}
...
...
@@ -310,14 +309,14 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
public
renderHeader
(
container
:
HTMLElement
):
void
{
super
.
renderHeader
(
container
);
var
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
const
titleDiv
=
$
(
'
div.title
'
).
appendTo
(
container
);
$
(
'
span
'
).
text
(
nls
.
localize
(
'
breakpoints
'
,
"
Breakpoints
"
)).
appendTo
(
titleDiv
);
}
public
renderBody
(
container
:
HTMLElement
):
void
{
dom
.
addClass
(
container
,
'
debug-breakpoints
'
);
this
.
treeContainer
=
renderViewTree
(
container
);
var
actionProvider
=
new
viewer
.
BreakpointsActionProvider
(
this
.
instantiationService
);
const
actionProvider
=
new
viewer
.
BreakpointsActionProvider
(
this
.
instantiationService
);
this
.
tree
=
new
treeimpl
.
Tree
(
this
.
treeContainer
,
{
dataSource
:
new
viewer
.
BreakpointsDataSource
(),
...
...
@@ -325,8 +324,8 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
controller
:
new
viewer
.
BreakpointsController
(
this
.
debugService
,
this
.
contextMenuService
,
actionProvider
),
sorter
:
{
compare
(
tree
:
tree
.
ITree
,
element
:
any
,
otherElement
:
any
):
number
{
var
first
=
<
debug
.
IBreakpoint
>
element
;
var
second
=
<
debug
.
IBreakpoint
>
otherElement
;
const
first
=
<
debug
.
IBreakpoint
>
element
;
const
second
=
<
debug
.
IBreakpoint
>
otherElement
;
if
(
first
instanceof
model
.
ExceptionBreakpoint
)
{
return
-
1
;
}
...
...
@@ -349,7 +348,7 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
}
},
debugTreeOptions
);
var
debugModel
=
this
.
debugService
.
getModel
();
const
debugModel
=
this
.
debugService
.
getModel
();
this
.
tree
.
setInput
(
debugModel
);
...
...
@@ -357,23 +356,23 @@ class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
if
(
!
e
.
selection
.
length
)
{
return
;
}
var
element
=
e
.
selection
[
0
];
const
element
=
e
.
selection
[
0
];
if
(
!
(
element
instanceof
model
.
Breakpoint
))
{
return
;
}
var
breakpoint
=
<
debug
.
IBreakpoint
>
element
;
const
breakpoint
=
<
debug
.
IBreakpoint
>
element
;
if
(
!
breakpoint
.
source
.
inMemory
)
{
var
isMouse
=
(
e
.
payload
.
origin
===
'
mouse
'
);
var
preserveFocus
=
isMouse
;
const
isMouse
=
(
e
.
payload
.
origin
===
'
mouse
'
);
let
preserveFocus
=
isMouse
;
var
originalEvent
:
KeyboardEvent
|
MouseEvent
=
e
&&
e
.
payload
&&
e
.
payload
.
originalEvent
;
const
originalEvent
:
KeyboardEvent
|
MouseEvent
=
e
&&
e
.
payload
&&
e
.
payload
.
originalEvent
;
if
(
originalEvent
&&
isMouse
&&
originalEvent
.
detail
===
2
)
{
preserveFocus
=
false
;
originalEvent
.
preventDefault
();
// focus moves to editor, we need to prevent default
}
var
sideBySide
=
(
originalEvent
&&
(
originalEvent
.
ctrlKey
||
originalEvent
.
metaKey
));
const
sideBySide
=
(
originalEvent
&&
(
originalEvent
.
ctrlKey
||
originalEvent
.
metaKey
));
this
.
debugService
.
openOrRevealEditor
(
breakpoint
.
source
,
breakpoint
.
lineNumber
,
preserveFocus
,
sideBySide
).
done
(
null
,
errors
.
onUnexpectedError
);
}
}));
...
...
@@ -438,14 +437,14 @@ export class DebugViewlet extends viewlet.Viewlet {
}));
}
//
V
iewlet
//
v
iewlet
public
create
(
parent
:
builder
.
Builder
):
TPromise
<
void
>
{
super
.
create
(
parent
);
this
.
$el
=
parent
.
div
().
addClass
(
'
debug-viewlet
'
);
if
(
this
.
contextService
.
getWorkspace
())
{
var
actionRunner
=
this
.
getActionRunner
();
const
actionRunner
=
this
.
getActionRunner
();
this
.
views
.
push
(
this
.
instantiationService
.
createInstance
(
VariablesView
,
actionRunner
,
this
.
viewletSettings
));
this
.
views
.
push
(
this
.
instantiationService
.
createInstance
(
WatchExpressionsView
,
actionRunner
,
this
.
viewletSettings
));
this
.
views
.
push
(
this
.
instantiationService
.
createInstance
(
CallStackView
,
actionRunner
,
this
.
viewletSettings
));
...
...
src/vs/workbench/parts/debug/browser/replEditor.ts
浏览文件 @
6b62cad3
...
...
@@ -8,7 +8,6 @@ import { TPromise, Promise } from 'vs/base/common/winjs.base';
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
builder
=
require
(
'
vs/base/browser/builder
'
);
import
async
=
require
(
'
vs/base/common/async
'
);
import
dom
=
require
(
'
vs/base/browser/dom
'
);
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
tree
=
require
(
'
vs/base/parts/tree/common/tree
'
);
...
...
@@ -18,7 +17,6 @@ import baseeditor = require('vs/workbench/browser/parts/editor/baseEditor');
import
editorinputs
=
require
(
'
vs/workbench/parts/debug/browser/debugEditorInputs
'
);
import
viewer
=
require
(
'
vs/workbench/parts/debug/browser/replViewer
'
);
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
model
=
require
(
'
vs/workbench/parts/debug/common/debugModel
'
);
import
debugactions
=
require
(
'
vs/workbench/parts/debug/electron-browser/debugActions
'
);
import
replhistory
=
require
(
'
vs/workbench/parts/debug/common/replHistory
'
);
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
...
...
@@ -29,15 +27,15 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
CommonKeybindings
}
from
'
vs/base/common/keyCodes
'
;
var
$
=
dom
.
emmet
;
const
$
=
dom
.
emmet
;
var
replTreeOptions
=
{
const
replTreeOptions
=
{
indentPixels
:
8
,
twistiePixels
:
20
,
paddingOnRow
:
false
};
var
HISTORY_STORAGE_KEY
=
'
debug.repl.history
'
;
const
HISTORY_STORAGE_KEY
=
'
debug.repl.history
'
;
export
class
Repl
extends
baseeditor
.
BaseEditor
{
...
...
@@ -98,11 +96,11 @@ export class Repl extends baseeditor.BaseEditor {
}
public
createEditor
(
parent
:
builder
.
Builder
):
void
{
var
container
=
dom
.
append
(
parent
.
getHTMLElement
(),
$
(
'
.repl
'
));
//
I
nherit the background color from selected theme.
const
container
=
dom
.
append
(
parent
.
getHTMLElement
(),
$
(
'
.repl
'
));
//
i
nherit the background color from selected theme.
dom
.
addClass
(
container
,
'
monaco-editor-background
'
);
this
.
treeContainer
=
dom
.
append
(
container
,
$
(
'
.repl-tree
'
));
var
replInputContainer
=
dom
.
append
(
container
,
$
(
platform
.
isWindows
?
'
.repl-input-wrapper.windows
'
:
platform
.
isMacintosh
?
'
.repl-input-wrapper.mac
'
:
'
.repl-input-wrapper.linux
'
));
const
replInputContainer
=
dom
.
append
(
container
,
$
(
platform
.
isWindows
?
'
.repl-input-wrapper.windows
'
:
platform
.
isMacintosh
?
'
.repl-input-wrapper.mac
'
:
'
.repl-input-wrapper.linux
'
));
this
.
replInput
=
<
HTMLInputElement
>
dom
.
append
(
replInputContainer
,
$
(
'
input.repl-input
'
));
dom
.
addStandardDisposableListener
(
this
.
replInput
,
'
keydown
'
,
(
e
:
dom
.
IKeyboardEvent
)
=>
{
...
...
@@ -113,11 +111,11 @@ export class Repl extends baseeditor.BaseEditor {
Repl
.
HISTORY
.
evaluated
(
trimmedValue
);
this
.
replInput
.
value
=
''
;
}
else
if
(
e
.
equals
(
CommonKeybindings
.
UP_ARROW
)
||
e
.
equals
(
CommonKeybindings
.
DOWN_ARROW
))
{
var
historyInput
=
e
.
equals
(
CommonKeybindings
.
UP_ARROW
)
?
Repl
.
HISTORY
.
previous
()
:
Repl
.
HISTORY
.
next
();
const
historyInput
=
e
.
equals
(
CommonKeybindings
.
UP_ARROW
)
?
Repl
.
HISTORY
.
previous
()
:
Repl
.
HISTORY
.
next
();
if
(
historyInput
)
{
Repl
.
HISTORY
.
remember
(
this
.
replInput
.
value
,
e
.
equals
(
CommonKeybindings
.
UP_ARROW
));
this
.
replInput
.
value
=
historyInput
;
//
A
lways leave cursor at the end.
//
a
lways leave cursor at the end.
e
.
preventDefault
();
}
}
...
...
@@ -175,7 +173,7 @@ export class Repl extends baseeditor.BaseEditor {
}
public
dispose
():
void
{
//
Destroy C
ontainer
//
destroy c
ontainer
this
.
toDispose
=
lifecycle
.
disposeAll
(
this
.
toDispose
);
super
.
dispose
();
...
...
@@ -199,7 +197,9 @@ export class ReplEditorActionContributor extends baseeditor.EditorInputActionCon
export
class
ReplInputFactory
implements
baseeditor
.
IEditorInputFactory
{
constructor
(@
INullService
ns
)
{}
constructor
(@
INullService
ns
)
{
// noop
}
public
serialize
(
editorInput
:
wbeditorcommon
.
EditorInput
):
string
{
return
editorInput
.
getId
();
...
...
src/vs/workbench/parts/debug/browser/replViewer.ts
浏览文件 @
6b62cad3
...
...
@@ -6,18 +6,13 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
Promise
,
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
actions
=
require
(
'
vs/base/common/actions
'
);
import
lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
URI
from
'
vs/base/common/uri
'
;
import
async
=
require
(
'
vs/base/common/async
'
);
import
{
isMacintosh
,
isLinux
,
isWindows
}
from
'
vs/base/common/platform
'
;
import
actionbar
=
require
(
'
vs/base/browser/ui/actionbar/actionbar
'
);
import
dom
=
require
(
'
vs/base/browser/dom
'
);
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
severity
from
'
vs/base/common/severity
'
;
import
mouse
=
require
(
'
vs/base/browser/mouseEvent
'
);
import
inputbox
=
require
(
'
vs/base/browser/ui/inputbox/inputBox
'
);
import
tree
=
require
(
'
vs/base/parts/tree/common/tree
'
);
import
renderer
=
require
(
'
vs/base/parts/tree/browser/actionsRenderer
'
);
import
treedefaults
=
require
(
'
vs/base/parts/tree/browser/treeDefaults
'
);
...
...
@@ -30,7 +25,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
var
$
=
dom
.
emmet
;
const
$
=
dom
.
emmet
;
function
getExpressionClassName
():
string
{
return
isMacintosh
?
'
.expression.mac
'
:
'
.expression.win-linux
'
...
...
@@ -222,7 +217,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
private
renderOutputValue
(
output
:
model
.
ValueOutputElement
,
templateData
:
IValueOutputTemplateData
):
void
{
//
C
ounter
//
c
ounter
if
(
output
.
counter
>
1
)
{
templateData
.
counter
.
textContent
=
String
(
output
.
counter
);
templateData
.
counter
.
className
=
(
output
.
severity
===
severity
.
Warning
)
?
'
counter warn
'
:
(
output
.
severity
===
severity
.
Error
)
?
'
counter error
'
:
'
counter info
'
;
...
...
@@ -231,14 +226,14 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
templateData
.
counter
.
className
=
'
counter
'
;
}
//
G
roup
//
g
roup
if
(
output
.
grouped
)
{
dom
.
addClass
(
templateData
.
container
,
'
grouped
'
);
}
else
{
dom
.
removeClass
(
templateData
.
container
,
'
grouped
'
);
}
//
V
alue
//
v
alue
dom
.
clearNode
(
templateData
.
value
);
let
result
=
this
.
handleANSIOutput
(
output
.
value
);
if
(
typeof
result
===
'
string
'
)
{
...
...
@@ -257,7 +252,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
for
(
let
i
=
0
,
len
=
text
.
length
;
i
<
len
;
i
++
)
{
//
S
tart of ANSI escape sequence (see http://ascii-table.com/ansi-escape-sequences.php)
//
s
tart of ANSI escape sequence (see http://ascii-table.com/ansi-escape-sequences.php)
if
(
text
.
charCodeAt
(
i
)
===
27
)
{
let
index
=
i
;
let
chr
=
(
++
index
<
len
?
text
.
charAt
(
index
)
:
null
);
...
...
@@ -279,7 +274,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
code
=
'
0
'
;
}
if
(
chr
===
'
m
'
)
{
//
S
et text color/mode.
if
(
chr
===
'
m
'
)
{
//
s
et text color/mode.
// only respect text-foreground ranges and ignore the values for "black" & "white" because those
// only make sense in combination with text-background ranges which we currently not support
...
...
@@ -296,7 +291,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
tokensContainer
=
document
.
createElement
(
'
span
'
);
}
//
F
lush text buffer if we have any
//
f
lush text buffer if we have any
if
(
buffer
)
{
this
.
insert
(
this
.
handleLinks
(
buffer
),
currentToken
||
tokensContainer
);
buffer
=
''
;
...
...
@@ -310,13 +305,13 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
}
}
//
N
ormal text
//
n
ormal text
else
{
buffer
+=
text
[
i
];
}
}
//
F
lush remaining text buffer if we have any
//
f
lush remaining text buffer if we have any
if
(
buffer
)
{
let
res
=
this
.
handleLinks
(
buffer
);
if
(
typeof
res
!==
'
string
'
||
currentToken
)
{
...
...
@@ -398,17 +393,17 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
private
renderOutputKeyValue
(
tree
:
tree
.
ITree
,
output
:
model
.
KeyValueOutputElement
,
templateData
:
IKeyValueOutputTemplateData
):
void
{
//
K
ey
//
k
ey
if
(
output
.
key
)
{
templateData
.
key
.
textContent
=
`
${
output
.
key
}
:`
;
}
else
{
templateData
.
key
.
textContent
=
''
;
}
//
V
alue
//
v
alue
debugviewer
.
renderExpressionValue
(
tree
,
output
.
value
,
false
,
templateData
.
value
);
//
A
nnotation if any
//
a
nnotation if any
if
(
output
.
annotation
)
{
templateData
.
annotation
.
className
=
'
annotation octicon octicon-info
'
;
templateData
.
annotation
.
title
=
output
.
annotation
;
...
...
@@ -417,7 +412,7 @@ export class ReplExpressionsRenderer implements tree.IRenderer {
templateData
.
annotation
.
title
=
''
;
}
//
G
roup
//
g
roup
if
(
output
.
grouped
)
{
dom
.
addClass
(
templateData
.
container
,
'
grouped
'
);
}
else
{
...
...
@@ -441,7 +436,7 @@ export class ReplExpressionsActionProvider extends debugviewer.SimpleActionProvi
}
public
getSecondaryActions
(
tree
:
tree
.
ITree
,
element
:
any
):
TPromise
<
actions
.
IAction
[]
>
{
var
actions
:
actions
.
IAction
[]
=
[];
const
actions
:
actions
.
IAction
[]
=
[];
if
(
element
instanceof
model
.
Variable
||
element
instanceof
model
.
Expression
)
{
actions
.
push
(
this
.
instantiationService
.
createInstance
(
dbgactions
.
AddToWatchExpressionsAction
,
dbgactions
.
AddToWatchExpressionsAction
.
ID
,
dbgactions
.
AddToWatchExpressionsAction
.
LABEL
,
element
));
actions
.
push
(
new
actionbar
.
Separator
());
...
...
@@ -473,7 +468,7 @@ export class ReplExpressionsController extends debugviewer.BaseDebugController {
/* protected */
public
onLeftClick
(
tree
:
tree
.
ITree
,
element
:
any
,
eventish
:
treedefaults
.
ICancelableEvent
,
origin
:
string
=
'
mouse
'
):
boolean
{
const
mouseEvent
=
<
mouse
.
StandardMouseEvent
>
eventish
;
//
I
nput and output are one element in the tree => we only expand if the user clicked on the output.
//
i
nput and output are one element in the tree => we only expand if the user clicked on the output.
if
((
element
.
reference
>
0
||
(
element
instanceof
model
.
KeyValueOutputElement
&&
element
.
getChildren
().
length
>
0
))
&&
mouseEvent
.
target
.
className
.
indexOf
(
'
input expression
'
)
===
-
1
)
{
super
.
onLeftClick
(
tree
,
element
,
eventish
,
origin
);
tree
.
clearFocus
();
...
...
@@ -482,7 +477,7 @@ export class ReplExpressionsController extends debugviewer.BaseDebugController {
const
selection
=
window
.
getSelection
();
if
(
selection
.
type
!==
'
Range
'
||
this
.
lastSelectedString
===
selection
.
toString
())
{
//
O
nly focus the input if the user is not currently selecting.
//
o
nly focus the input if the user is not currently selecting.
this
.
replInput
.
focus
();
}
this
.
lastSelectedString
=
selection
.
toString
();
...
...
src/vs/workbench/parts/debug/test/common/debugModel.test.ts
浏览文件 @
6b62cad3
...
...
@@ -6,7 +6,6 @@
import
assert
=
require
(
'
assert
'
);
import
uri
from
'
vs/base/common/uri
'
;
import
severity
from
'
vs/base/common/severity
'
;
import
debug
=
require
(
'
vs/workbench/parts/debug/common/debug
'
);
import
debugmodel
=
require
(
'
vs/workbench/parts/debug/common/debugModel
'
);
suite
(
'
Debug - Model
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录