Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5ef5a112
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,发现更多精彩内容 >>
提交
5ef5a112
编写于
12月 22, 2015
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debugService.ts - linting
上级
f5169146
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
43 deletion
+42
-43
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+42
-43
未找到文件。
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
5ef5a112
...
...
@@ -31,7 +31,6 @@ import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletSer
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IFileService
,
FileChangesEvent
,
FileChangeType
,
EventType
}
from
'
vs/platform/files/common/files
'
;
import
{
IEventService
}
from
'
vs/platform/event/common/event
'
;
...
...
@@ -40,18 +39,18 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IPluginService
,
IPluginDescription
}
from
'
vs/platform/plugins/common/plugins
'
;
import
{
IPluginService
}
from
'
vs/platform/plugins/common/plugins
'
;
import
{
IOutputService
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
IKeybindingService
,
IKeybindingContextKey
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
{
IWindowService
,
IBroadcast
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
import
{
ILogEntry
,
PLUGIN_LOG_BROADCAST_CHANNEL
,
PLUGIN_ATTACH_BROADCAST_CHANNEL
}
from
'
vs/workbench/services/thread/electron-browser/threadService
'
;
var
DEBUG_BREAKPOINTS_KEY
=
'
debug.breakpoint
'
;
var
DEBUG_BREAKPOINTS_ACTIVATED_KEY
=
'
debug.breakpointactivated
'
;
var
DEBUG_FUNCTION_BREAKPOINTS_KEY
=
'
debug.functionbreakpoint
'
;
var
DEBUG_EXCEPTION_BREAKPOINTS_KEY
=
'
debug.exceptionbreakpoint
'
;
var
DEBUG_WATCH_EXPRESSIONS_KEY
=
'
debug.watchexpressions
'
;
var
DEBUG_SELECTED_CONFIG_NAME_KEY
=
'
debug.selectedconfigname
'
;
const
DEBUG_BREAKPOINTS_KEY
=
'
debug.breakpoint
'
;
const
DEBUG_BREAKPOINTS_ACTIVATED_KEY
=
'
debug.breakpointactivated
'
;
const
DEBUG_FUNCTION_BREAKPOINTS_KEY
=
'
debug.functionbreakpoint
'
;
const
DEBUG_EXCEPTION_BREAKPOINTS_KEY
=
'
debug.exceptionbreakpoint
'
;
const
DEBUG_WATCH_EXPRESSIONS_KEY
=
'
debug.watchexpressions
'
;
const
DEBUG_SELECTED_CONFIG_NAME_KEY
=
'
debug.selectedconfigname
'
;
export
class
DebugService
extends
ee
.
EventEmitter
implements
debug
.
IDebugService
{
public
serviceId
=
debug
.
IDebugService
;
...
...
@@ -91,7 +90,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this
.
debugStringEditorInputs
=
[];
this
.
session
=
null
;
this
.
state
=
debug
.
State
.
Inactive
;
//
T
here is a cycle if taskService gets injected, use a workaround.
//
t
here is a cycle if taskService gets injected, use a workaround.
this
.
taskService
=
this
.
instantiationService
.
getInstance
(
ITaskService
);
if
(
!
this
.
contextService
.
getWorkspace
())
{
...
...
@@ -133,20 +132,20 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
private
onBroadcast
(
broadcast
:
IBroadcast
):
void
{
//
A
ttach: PH is ready to be attached to
//
a
ttach: PH is ready to be attached to
if
(
broadcast
.
channel
===
PLUGIN_ATTACH_BROADCAST_CHANNEL
)
{
this
.
rawAttach
(
broadcast
.
payload
.
port
);
return
;
}
//
F
rom this point on we require an active session
//
f
rom this point on we require an active session
let
session
=
this
.
getActiveSession
();
if
(
!
session
||
session
.
getType
()
!==
'
extensionHost
'
)
{
return
;
// we are only intersted if we have an active debug session for extensionHost
}
//
A
plugin logged output, show it inside the REPL
//
a
plugin logged output, show it inside the REPL
if
(
broadcast
.
channel
===
PLUGIN_LOG_BROADCAST_CHANNEL
)
{
let
extensionOutput
:
ILogEntry
=
broadcast
.
payload
;
let
sev
=
extensionOutput
.
severity
===
'
warn
'
?
severity
.
Warning
:
extensionOutput
.
severity
===
'
error
'
?
severity
.
Error
:
severity
.
Info
;
...
...
@@ -159,36 +158,36 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
args
.
push
(
extensionOutput
.
arguments
);
}
//
A
dd output for each argument logged
//
a
dd output for each argument logged
let
simpleVals
:
any
[]
=
[];
for
(
let
i
=
0
;
i
<
args
.
length
;
i
++
)
{
let
a
=
args
[
i
];
//
U
ndefined gets printed as 'undefined'
//
u
ndefined gets printed as 'undefined'
if
(
typeof
a
===
'
undefined
'
)
{
simpleVals
.
push
(
'
undefined
'
);
}
//
N
ull gets printed as 'null'
//
n
ull gets printed as 'null'
else
if
(
a
===
null
)
{
simpleVals
.
push
(
'
null
'
);
}
//
Objects & A
rrays are special because we want to inspect them in the REPL
//
objects & a
rrays are special because we want to inspect them in the REPL
else
if
(
types
.
isObject
(
a
)
||
Array
.
isArray
(
a
))
{
//
F
lush any existing simple values logged
//
f
lush any existing simple values logged
if
(
simpleVals
.
length
)
{
this
.
logToRepl
(
simpleVals
.
join
(
'
'
),
sev
);
simpleVals
=
[];
}
//
S
how object
//
s
how object
this
.
logToRepl
(
a
,
sev
);
}
//
S
tring: watch out for % replacement directive
//
S
tring substitution and formatting @ https://developer.chrome.com/devtools/docs/console
//
s
tring: watch out for % replacement directive
//
s
tring substitution and formatting @ https://developer.chrome.com/devtools/docs/console
else
if
(
typeof
a
===
'
string
'
)
{
let
buf
=
''
;
...
...
@@ -211,12 +210,12 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
}
//
F
lush simple values
//
f
lush simple values
if
(
simpleVals
.
length
)
{
this
.
logToRepl
(
simpleVals
.
join
(
'
'
),
sev
);
}
//
S
how repl
//
s
how repl
this
.
revealRepl
(
true
/* in background */
).
done
(
null
,
errors
.
onUnexpectedError
);
}
}
...
...
@@ -229,14 +228,14 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this
.
toDispose
.
push
(
this
.
session
.
addListener2
(
debug
.
SessionEvents
.
STOPPED
,
(
event
:
DebugProtocol
.
StoppedEvent
)
=>
{
this
.
setStateAndEmit
(
debug
.
State
.
Stopped
,
event
.
body
.
reason
);
var
threadId
=
event
.
body
.
threadId
;
const
threadId
=
event
.
body
.
threadId
;
this
.
getThreadData
(
threadId
).
then
(()
=>
{
this
.
session
.
stackTrace
({
threadId
:
threadId
,
levels
:
20
}).
done
((
result
)
=>
{
this
.
model
.
rawUpdate
({
threadId
:
threadId
,
callStack
:
result
.
body
.
stackFrames
,
exception
:
event
.
body
&&
event
.
body
.
reason
===
'
exception
'
});
this
.
windowService
.
getWindow
().
focus
();
var
callStack
=
this
.
model
.
getThreads
()[
threadId
].
callStack
;
const
callStack
=
this
.
model
.
getThreads
()[
threadId
].
callStack
;
if
(
callStack
.
length
>
0
)
{
this
.
setFocusedStackFrameAndEvaluate
(
callStack
[
0
]);
this
.
openOrRevealEditor
(
callStack
[
0
].
source
,
callStack
[
0
].
lineNumber
,
false
,
false
).
done
(
null
,
errors
.
onUnexpectedError
);
...
...
@@ -330,7 +329,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
private
loadExceptionBreakpoints
():
debug
.
IExceptionBreakpoint
[]
{
var
result
:
debug
.
IExceptionBreakpoint
[]
=
null
;
let
result
:
debug
.
IExceptionBreakpoint
[]
=
null
;
try
{
result
=
JSON
.
parse
(
this
.
storageService
.
get
(
DEBUG_EXCEPTION_BREAKPOINTS_KEY
,
StorageScope
.
WORKSPACE
,
'
[]
'
)).
map
((
exBreakpoint
:
any
)
=>
{
return
new
model
.
ExceptionBreakpoint
(
exBreakpoint
.
name
,
exBreakpoint
.
enabled
);
...
...
@@ -401,7 +400,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
public
toggleEnablement
(
element
:
debug
.
IEnablement
):
Promise
{
this
.
model
.
toggleEnablement
(
element
);
if
(
element
instanceof
model
.
Breakpoint
)
{
var
breakpoint
=
<
model
.
Breakpoint
>
element
;
const
breakpoint
=
<
model
.
Breakpoint
>
element
;
return
this
.
sendBreakpoints
(
breakpoint
.
source
.
uri
);
}
else
if
(
element
instanceof
model
.
FunctionBreakpoint
)
{
// TODO@Isidor send function breakpoints and return
...
...
@@ -532,7 +531,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return
Promise
.
as
(
true
);
}
//
R
un a build task before starting a debug session
//
r
un a build task before starting a debug session
return
this
.
taskService
.
tasks
().
then
(
descriptions
=>
{
let
filteredTasks
=
descriptions
.
filter
(
task
=>
task
.
name
===
config
.
preLaunchTask
);
if
(
filteredTasks
.
length
!==
1
)
{
...
...
@@ -540,17 +539,17 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return
Promise
.
as
(
true
);
}
//
T
ask is already running - nothing to do.
//
t
ask is already running - nothing to do.
if
(
this
.
lastTaskEvent
&&
this
.
lastTaskEvent
.
taskName
===
config
.
preLaunchTask
)
{
return
Promise
.
as
(
true
);
}
if
(
this
.
lastTaskEvent
)
{
//
T
here is a different task running currently.
//
t
here is a different task running currently.
return
Promise
.
wrapError
(
errors
.
create
(
nls
.
localize
(
'
differentTaskRunning
'
,
"
There is a task {0} running. Can not run pre launch task {1}.
"
,
this
.
lastTaskEvent
.
taskName
,
config
.
preLaunchTask
)));
}
//
N
o task running, execute the preLaunchTask.
//
n
o task running, execute the preLaunchTask.
this
.
outputService
.
showOutput
(
'
Tasks
'
,
true
,
true
);
const
taskPromise
=
this
.
taskService
.
run
(
filteredTasks
[
0
].
id
).
then
(
result
=>
{
...
...
@@ -584,13 +583,13 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
public
restartSession
():
Promise
{
return
this
.
session
?
this
.
session
.
disconnect
(
true
).
then
(()
=>
{
return
this
.
session
?
this
.
session
.
disconnect
(
true
).
then
(()
=>
new
Promise
(
c
=>
{
setTimeout
(()
=>
{
this
.
createSession
(
false
).
then
(()
=>
c
(
true
));
},
300
);
})
;
}
)
:
this
.
createSession
(
false
);
})
)
:
this
.
createSession
(
false
);
}
public
getActiveSession
():
debug
.
IRawDebugSession
{
...
...
@@ -601,11 +600,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
try
{
this
.
debugStringEditorInputs
=
lifecycle
.
disposeAll
(
this
.
debugStringEditorInputs
);
}
catch
(
e
)
{
//
A
n internal module might be open so the dispose can throw -> ignore and continue with stop session.
//
a
n internal module might be open so the dispose can throw -> ignore and continue with stop session.
}
if
(
this
.
session
)
{
var
bpsExist
=
this
.
model
.
getBreakpoints
().
length
>
0
;
const
bpsExist
=
this
.
model
.
getBreakpoints
().
length
>
0
;
this
.
telemetryService
.
publicLog
(
'
debugSessionStop
'
,
{
type
:
this
.
session
.
getType
(),
success
:
this
.
session
.
emittedStopped
||
!
bpsExist
,
sessionLengthInSeconds
:
this
.
session
.
getLengthInSeconds
(),
breakpointCount
:
this
.
model
.
getBreakpoints
().
length
});
}
this
.
session
=
null
;
...
...
@@ -616,7 +615,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
this
.
setFocusedStackFrameAndEvaluate
(
null
);
this
.
setStateAndEmit
(
debug
.
State
.
Inactive
);
//
S
et breakpoints back to unverified since the session ended.
//
s
et breakpoints back to unverified since the session ended.
const
data
:
{[
id
:
string
]:
{
line
:
number
,
verified
:
boolean
}
}
=
{
};
this
.
model
.
getBreakpoints
().
forEach
(
bp
=>
data
[
bp
.
getId
()]
=
{
line
:
bp
.
lineNumber
,
verified
:
false
});
this
.
model
.
updateBreakpoints
(
data
);
...
...
@@ -634,7 +633,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
public
openOrRevealEditor
(
source
:
Source
,
lineNumber
:
number
,
preserveFocus
:
boolean
,
sideBySide
:
boolean
):
Promise
{
const
visibleEditors
=
this
.
editorService
.
getVisibleEditors
();
for
(
var
i
=
0
;
i
<
visibleEditors
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
visibleEditors
.
length
;
i
++
)
{
const
fileInput
=
wbeditorcommon
.
asFileEditorInput
(
visibleEditors
[
i
].
input
);
if
(
fileInput
&&
fileInput
.
getResource
().
toString
()
===
source
.
uri
.
toString
())
{
const
control
=
<
editorbrowser
.
ICodeEditor
>
visibleEditors
[
i
].
getControl
();
...
...
@@ -649,7 +648,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
if
(
source
.
inMemory
)
{
//
I
nternal module
//
i
nternal module
if
(
source
.
reference
!==
0
&&
this
.
session
)
{
return
this
.
session
.
source
({
sourceReference
:
source
.
reference
}).
then
(
response
=>
{
const
editorInput
=
this
.
getDebugStringEditorInput
(
source
,
response
.
body
.
content
,
mime
.
guessMimeTypes
(
source
.
name
)[
0
]);
...
...
@@ -694,7 +693,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
public
revealRepl
(
inBackground
:
boolean
=
false
):
Promise
{
let
editors
=
this
.
editorService
.
getVisibleEditors
();
//
F
irst check if repl is already opened
//
f
irst check if repl is already opened
for
(
let
i
=
0
;
i
<
editors
.
length
;
i
++
)
{
let
editor
=
editors
[
i
];
if
(
editor
.
input
instanceof
debuginputs
.
ReplEditorInput
)
{
...
...
@@ -706,7 +705,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
}
//
T
hen find a position but try to not replace an existing file editor in any of the positions
//
t
hen find a position but try to not replace an existing file editor in any of the positions
let
position
=
Position
.
LEFT
;
let
lastIndex
=
editors
.
length
-
1
;
if
(
editors
.
length
===
3
)
{
...
...
@@ -751,10 +750,10 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}
private
getDebugStringEditorInput
(
source
:
Source
,
value
:
string
,
mtype
:
string
):
debuginputs
.
DebugStringEditorInput
{
var
filtered
=
this
.
debugStringEditorInputs
.
filter
(
input
=>
input
.
getResource
().
toString
()
===
source
.
uri
.
toString
());
const
filtered
=
this
.
debugStringEditorInputs
.
filter
(
input
=>
input
.
getResource
().
toString
()
===
source
.
uri
.
toString
());
if
(
filtered
.
length
===
0
)
{
var
result
=
this
.
instantiationService
.
createInstance
(
debuginputs
.
DebugStringEditorInput
,
source
.
name
,
source
.
uri
,
'
internal module
'
,
value
,
mtype
,
void
0
);
const
result
=
this
.
instantiationService
.
createInstance
(
debuginputs
.
DebugStringEditorInput
,
source
.
name
,
source
.
uri
,
'
internal module
'
,
value
,
mtype
,
void
0
);
this
.
debugStringEditorInputs
.
push
(
result
);
return
result
;
}
else
{
...
...
@@ -792,7 +791,7 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
return
Promise
.
as
(
null
);
}
var
enabledExBreakpoints
=
this
.
model
.
getExceptionBreakpoints
().
filter
(
exb
=>
exb
.
enabled
);
const
enabledExBreakpoints
=
this
.
model
.
getExceptionBreakpoints
().
filter
(
exb
=>
exb
.
enabled
);
return
this
.
session
.
setExceptionBreakpoints
({
filters
:
enabledExBreakpoints
.
map
(
exb
=>
exb
.
name
)
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录