Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
dc234da0
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,发现更多精彩内容 >>
提交
dc234da0
编写于
4月 10, 2019
作者:
A
Andre Weinand
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
terminate debug sessions properly
上级
aa094730
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
87 addition
and
52 deletion
+87
-52
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+3
-0
src/vs/workbench/contrib/debug/electron-browser/debugService.ts
.../workbench/contrib/debug/electron-browser/debugService.ts
+11
-10
src/vs/workbench/contrib/debug/electron-browser/debugSession.ts
.../workbench/contrib/debug/electron-browser/debugSession.ts
+10
-0
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
+6
-0
src/vs/workbench/services/extensions/common/extensionHostDebug.ts
...orkbench/services/extensions/common/extensionHostDebug.ts
+22
-6
src/vs/workbench/services/extensions/electron-browser/extensionHostDebugService.ts
.../extensions/electron-browser/extensionHostDebugService.ts
+35
-36
未找到文件。
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
dc234da0
...
...
@@ -150,6 +150,9 @@ export interface IDebugSession extends ITreeElement {
readonly
state
:
State
;
readonly
root
:
IWorkspaceFolder
;
readonly
parentSession
:
IDebugSession
|
undefined
;
readonly
subId
:
string
|
undefined
;
setSubId
(
subId
:
string
|
undefined
):
void
;
getLabel
():
string
;
...
...
src/vs/workbench/contrib/debug/electron-browser/debugService.ts
浏览文件 @
dc234da0
...
...
@@ -135,27 +135,28 @@ export class DebugService implements IDebugService {
this
.
toDispose
.
push
(
this
.
storageService
.
onWillSaveState
(
this
.
saveState
,
this
));
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
data
=>
{
const
session
=
this
.
model
.
getSession
(
data
.
i
d
,
true
);
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
event
.
sessionI
d
,
true
);
if
(
session
)
{
// EH was started in debug mode -> attach to it
session
.
configuration
.
request
=
'
attach
'
;
session
.
configuration
.
port
=
data
.
port
;
session
.
configuration
.
port
=
event
.
port
;
session
.
setSubId
(
event
.
subId
);
this
.
launchOrAttachToSession
(
session
).
then
(
undefined
,
errors
.
onUnexpectedError
);
}
}));
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onTerminateSession
(
sessionId
=>
{
const
session
=
this
.
model
.
getSession
(
sessionId
);
if
(
session
)
{
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onTerminateSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
event
.
sessionId
);
if
(
session
&&
session
.
subId
===
event
.
subId
)
{
session
.
disconnect
().
then
(
undefined
,
errors
.
onUnexpectedError
);
}
}));
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onLogToSession
(
data
=>
{
const
session
=
this
.
model
.
getSession
(
data
.
i
d
,
true
);
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onLogToSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
event
.
sessionI
d
,
true
);
if
(
session
)
{
// extension logged output -> show it in REPL
const
sev
=
data
.
log
.
severity
===
'
warn
'
?
severity
.
Warning
:
data
.
log
.
severity
===
'
error
'
?
severity
.
Error
:
severity
.
Info
;
const
{
args
,
stack
}
=
parse
(
data
.
log
);
const
sev
=
event
.
log
.
severity
===
'
warn
'
?
severity
.
Warning
:
event
.
log
.
severity
===
'
error
'
?
severity
.
Error
:
severity
.
Info
;
const
{
args
,
stack
}
=
parse
(
event
.
log
);
const
frame
=
!!
stack
?
getFirstFrame
(
stack
)
:
undefined
;
session
.
logToRepl
(
sev
,
args
,
frame
);
}
...
...
src/vs/workbench/contrib/debug/electron-browser/debugSession.ts
浏览文件 @
dc234da0
...
...
@@ -35,7 +35,9 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
export
class
DebugSession
implements
IDebugSession
{
private
id
:
string
;
private
_subId
:
string
|
undefined
;
private
raw
:
RawDebugSession
|
undefined
;
private
initialized
=
false
;
...
...
@@ -76,6 +78,14 @@ export class DebugSession implements IDebugSession {
return
this
.
id
;
}
setSubId
(
subId
:
string
|
undefined
)
{
this
.
_subId
=
subId
;
}
get
subId
():
string
|
undefined
{
return
this
.
_subId
;
}
get
configuration
():
IConfig
{
return
this
.
_configuration
.
resolved
;
}
...
...
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
浏览文件 @
dc234da0
...
...
@@ -124,6 +124,12 @@ export class MockDebugService implements IDebugService {
export
class
MockSession
implements
IDebugSession
{
subId
:
string
|
undefined
;
setSubId
(
subId
:
string
|
undefined
):
void
{
throw
new
Error
(
'
Method not implemented.
'
);
}
get
parentSession
():
IDebugSession
|
undefined
{
return
undefined
;
}
...
...
src/vs/workbench/services/extensions/common/extensionHostDebug.ts
浏览文件 @
dc234da0
...
...
@@ -10,6 +10,22 @@ import { IRemoteConsoleLog } from 'vs/base/common/console';
export
const
IExtensionHostDebugService
=
createDecorator
<
IExtensionHostDebugService
>
(
'
extensionHostDebugService
'
);
export
interface
IAttachSessionEvent
{
sessionId
:
string
;
subId
?:
string
;
port
:
number
;
}
export
interface
ILogToSessionEvent
{
sessionId
:
string
;
log
:
IRemoteConsoleLog
;
}
export
interface
ITerminateSessionEvent
{
sessionId
:
string
;
subId
?:
string
;
}
export
interface
IExtensionHostDebugService
{
_serviceBrand
:
any
;
...
...
@@ -19,12 +35,12 @@ export interface IExtensionHostDebugService {
close
(
resource
:
URI
):
void
;
onClose
:
Event
<
URI
>
;
attachSession
(
id
:
string
,
port
:
number
):
void
;
onAttachSession
:
Event
<
{
id
:
string
,
port
:
number
}
>
;
attachSession
(
sessionId
:
string
,
port
:
number
,
subId
?:
string
):
void
;
onAttachSession
:
Event
<
IAttachSessionEvent
>
;
logToSession
(
i
d
:
string
,
log
:
IRemoteConsoleLog
):
void
;
onLogToSession
:
Event
<
{
id
:
string
,
log
:
IRemoteConsoleLog
}
>
;
logToSession
(
sessionI
d
:
string
,
log
:
IRemoteConsoleLog
):
void
;
onLogToSession
:
Event
<
ILogToSessionEvent
>
;
terminateSession
(
id
:
string
):
void
;
onTerminateSession
:
Event
<
string
>
;
terminateSession
(
sessionId
:
string
,
subId
?
:
string
):
void
;
onTerminateSession
:
Event
<
ITerminateSessionEvent
>
;
}
\ No newline at end of file
src/vs/workbench/services/extensions/electron-browser/extensionHostDebugService.ts
浏览文件 @
dc234da0
...
...
@@ -6,7 +6,7 @@
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IExtensionHostDebugService
}
from
'
vs/workbench/services/extensions/common/extensionHostDebug
'
;
import
{
IExtensionHostDebugService
,
IAttachSessionEvent
,
ITerminateSessionEvent
,
ILogToSessionEvent
}
from
'
vs/workbench/services/extensions/common/extensionHostDebug
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IRemoteConsoleLog
}
from
'
vs/base/common/console
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
...
...
@@ -16,10 +16,8 @@ interface IReloadBroadcast {
resource
:
string
;
}
interface
IAttachSessionBroadcast
{
interface
IAttachSessionBroadcast
extends
IAttachSessionEvent
{
type
:
'
vscode:extensionAttach
'
;
id
:
string
;
port
:
number
;
}
interface
ICloseBroadcast
{
...
...
@@ -27,15 +25,12 @@ interface ICloseBroadcast {
resource
:
string
;
}
interface
ILogToSessionBroadcast
{
interface
ILogToSessionBroadcast
extends
ILogToSessionEvent
{
type
:
'
vscode:extensionLog
'
;
id
:
string
;
log
:
IRemoteConsoleLog
;
}
interface
ITerminateSessionBroadcast
{
interface
ITerminateSessionBroadcast
extends
ITerminateSessionEvent
{
type
:
'
vscode:extensionTerminate
'
;
id
:
string
;
}
const
CHANNEL
=
'
vscode:extensionHostDebug
'
;
...
...
@@ -46,9 +41,9 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
private
windowId
:
number
;
private
readonly
_onReload
=
new
Emitter
<
URI
>
();
private
readonly
_onClose
=
new
Emitter
<
URI
>
();
private
readonly
_onAttachSession
=
new
Emitter
<
{
id
:
string
,
port
:
number
}
>
();
private
readonly
_onLogToSession
=
new
Emitter
<
{
id
:
string
,
log
:
IRemoteConsoleLog
}
>
();
private
readonly
_onTerminateSession
=
new
Emitter
<
string
>
();
private
readonly
_onAttachSession
=
new
Emitter
<
IAttachSessionEvent
>
();
private
readonly
_onLogToSession
=
new
Emitter
<
ILogToSessionEvent
>
();
private
readonly
_onTerminateSession
=
new
Emitter
<
ITerminateSessionEvent
>
();
constructor
(
@
IWindowService
readonly
windowService
:
IWindowService
,
...
...
@@ -56,20 +51,22 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
this
.
windowId
=
windowService
.
windowId
;
ipc
.
on
(
CHANNEL
,
(
_
:
unknown
,
broadcast
:
IReloadBroadcast
|
ICloseBroadcast
|
IAttachSessionBroadcast
|
ILogToSessionBroadcast
|
ITerminateSessionBroadcast
)
=>
{
if
(
broadcast
.
type
===
'
vscode:extensionReload
'
)
{
this
.
_onReload
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
}
if
(
broadcast
.
type
===
'
vscode:extensionCloseExtensionHost
'
)
{
this
.
_onClose
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
}
if
(
broadcast
.
type
===
'
vscode:extensionAttach
'
)
{
this
.
_onAttachSession
.
fire
({
id
:
broadcast
.
id
,
port
:
broadcast
.
port
});
}
if
(
broadcast
.
type
===
'
vscode:extensionLog
'
)
{
this
.
_onLogToSession
.
fire
({
id
:
broadcast
.
id
,
log
:
broadcast
.
log
});
}
if
(
broadcast
.
type
===
'
vscode:extensionTerminate
'
)
{
this
.
_onTerminateSession
.
fire
(
broadcast
.
id
);
switch
(
broadcast
.
type
)
{
case
'
vscode:extensionReload
'
:
this
.
_onReload
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
break
;
case
'
vscode:extensionCloseExtensionHost
'
:
this
.
_onClose
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
break
;
case
'
vscode:extensionAttach
'
:
this
.
_onAttachSession
.
fire
(
broadcast
);
break
;
case
'
vscode:extensionLog
'
:
this
.
_onLogToSession
.
fire
(
broadcast
);
break
;
case
'
vscode:extensionTerminate
'
:
this
.
_onTerminateSession
.
fire
(
broadcast
);
break
;
}
});
}
...
...
@@ -96,38 +93,40 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
return
this
.
_onClose
.
event
;
}
attachSession
(
id
:
string
,
port
:
number
):
void
{
attachSession
(
sessionId
:
string
,
port
:
number
,
subId
?:
string
):
void
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
IAttachSessionBroadcast
>
{
type
:
'
vscode:extensionAttach
'
,
id
,
port
sessionId
,
port
,
subId
});
}
get
onAttachSession
():
Event
<
{
id
:
string
,
port
:
number
}
>
{
get
onAttachSession
():
Event
<
IAttachSessionEvent
>
{
return
this
.
_onAttachSession
.
event
;
}
logToSession
(
i
d
:
string
,
log
:
IRemoteConsoleLog
):
void
{
logToSession
(
sessionI
d
:
string
,
log
:
IRemoteConsoleLog
):
void
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
ILogToSessionBroadcast
>
{
type
:
'
vscode:extensionLog
'
,
i
d
,
sessionI
d
,
log
});
}
get
onLogToSession
():
Event
<
{
id
:
string
,
log
:
IRemoteConsoleLog
}
>
{
get
onLogToSession
():
Event
<
ILogToSessionEvent
>
{
return
this
.
_onLogToSession
.
event
;
}
terminateSession
(
id
:
string
):
void
{
terminateSession
(
sessionId
:
string
,
subId
?
:
string
):
void
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
ITerminateSessionBroadcast
>
{
type
:
'
vscode:extensionTerminate
'
,
id
sessionId
,
subId
});
}
get
onTerminateSession
():
Event
<
string
>
{
get
onTerminateSession
():
Event
<
ITerminateSessionEvent
>
{
return
this
.
_onTerminateSession
.
event
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录