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 {
...
@@ -150,6 +150,9 @@ export interface IDebugSession extends ITreeElement {
readonly
state
:
State
;
readonly
state
:
State
;
readonly
root
:
IWorkspaceFolder
;
readonly
root
:
IWorkspaceFolder
;
readonly
parentSession
:
IDebugSession
|
undefined
;
readonly
parentSession
:
IDebugSession
|
undefined
;
readonly
subId
:
string
|
undefined
;
setSubId
(
subId
:
string
|
undefined
):
void
;
getLabel
():
string
;
getLabel
():
string
;
...
...
src/vs/workbench/contrib/debug/electron-browser/debugService.ts
浏览文件 @
dc234da0
...
@@ -135,27 +135,28 @@ export class DebugService implements IDebugService {
...
@@ -135,27 +135,28 @@ export class DebugService implements IDebugService {
this
.
toDispose
.
push
(
this
.
storageService
.
onWillSaveState
(
this
.
saveState
,
this
));
this
.
toDispose
.
push
(
this
.
storageService
.
onWillSaveState
(
this
.
saveState
,
this
));
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
lifecycleService
.
onShutdown
(
this
.
dispose
,
this
);
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
data
=>
{
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onAttachSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
data
.
i
d
,
true
);
const
session
=
this
.
model
.
getSession
(
event
.
sessionI
d
,
true
);
if
(
session
)
{
if
(
session
)
{
// EH was started in debug mode -> attach to it
// EH was started in debug mode -> attach to it
session
.
configuration
.
request
=
'
attach
'
;
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
.
launchOrAttachToSession
(
session
).
then
(
undefined
,
errors
.
onUnexpectedError
);
}
}
}));
}));
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onTerminateSession
(
sessionId
=>
{
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onTerminateSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
sessionId
);
const
session
=
this
.
model
.
getSession
(
event
.
sessionId
);
if
(
session
)
{
if
(
session
&&
session
.
subId
===
event
.
subId
)
{
session
.
disconnect
().
then
(
undefined
,
errors
.
onUnexpectedError
);
session
.
disconnect
().
then
(
undefined
,
errors
.
onUnexpectedError
);
}
}
}));
}));
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onLogToSession
(
data
=>
{
this
.
toDispose
.
push
(
this
.
extensionHostDebugService
.
onLogToSession
(
event
=>
{
const
session
=
this
.
model
.
getSession
(
data
.
i
d
,
true
);
const
session
=
this
.
model
.
getSession
(
event
.
sessionI
d
,
true
);
if
(
session
)
{
if
(
session
)
{
// extension logged output -> show it in REPL
// extension logged output -> show it in REPL
const
sev
=
data
.
log
.
severity
===
'
warn
'
?
severity
.
Warning
:
data
.
log
.
severity
===
'
error
'
?
severity
.
Error
:
severity
.
Info
;
const
sev
=
event
.
log
.
severity
===
'
warn
'
?
severity
.
Warning
:
event
.
log
.
severity
===
'
error
'
?
severity
.
Error
:
severity
.
Info
;
const
{
args
,
stack
}
=
parse
(
data
.
log
);
const
{
args
,
stack
}
=
parse
(
event
.
log
);
const
frame
=
!!
stack
?
getFirstFrame
(
stack
)
:
undefined
;
const
frame
=
!!
stack
?
getFirstFrame
(
stack
)
:
undefined
;
session
.
logToRepl
(
sev
,
args
,
frame
);
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'
...
@@ -35,7 +35,9 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
export
class
DebugSession
implements
IDebugSession
{
export
class
DebugSession
implements
IDebugSession
{
private
id
:
string
;
private
id
:
string
;
private
_subId
:
string
|
undefined
;
private
raw
:
RawDebugSession
|
undefined
;
private
raw
:
RawDebugSession
|
undefined
;
private
initialized
=
false
;
private
initialized
=
false
;
...
@@ -76,6 +78,14 @@ export class DebugSession implements IDebugSession {
...
@@ -76,6 +78,14 @@ export class DebugSession implements IDebugSession {
return
this
.
id
;
return
this
.
id
;
}
}
setSubId
(
subId
:
string
|
undefined
)
{
this
.
_subId
=
subId
;
}
get
subId
():
string
|
undefined
{
return
this
.
_subId
;
}
get
configuration
():
IConfig
{
get
configuration
():
IConfig
{
return
this
.
_configuration
.
resolved
;
return
this
.
_configuration
.
resolved
;
}
}
...
...
src/vs/workbench/contrib/debug/test/common/mockDebug.ts
浏览文件 @
dc234da0
...
@@ -124,6 +124,12 @@ export class MockDebugService implements IDebugService {
...
@@ -124,6 +124,12 @@ export class MockDebugService implements IDebugService {
export
class
MockSession
implements
IDebugSession
{
export
class
MockSession
implements
IDebugSession
{
subId
:
string
|
undefined
;
setSubId
(
subId
:
string
|
undefined
):
void
{
throw
new
Error
(
'
Method not implemented.
'
);
}
get
parentSession
():
IDebugSession
|
undefined
{
get
parentSession
():
IDebugSession
|
undefined
{
return
undefined
;
return
undefined
;
}
}
...
...
src/vs/workbench/services/extensions/common/extensionHostDebug.ts
浏览文件 @
dc234da0
...
@@ -10,6 +10,22 @@ import { IRemoteConsoleLog } from 'vs/base/common/console';
...
@@ -10,6 +10,22 @@ import { IRemoteConsoleLog } from 'vs/base/common/console';
export
const
IExtensionHostDebugService
=
createDecorator
<
IExtensionHostDebugService
>
(
'
extensionHostDebugService
'
);
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
{
export
interface
IExtensionHostDebugService
{
_serviceBrand
:
any
;
_serviceBrand
:
any
;
...
@@ -19,12 +35,12 @@ export interface IExtensionHostDebugService {
...
@@ -19,12 +35,12 @@ export interface IExtensionHostDebugService {
close
(
resource
:
URI
):
void
;
close
(
resource
:
URI
):
void
;
onClose
:
Event
<
URI
>
;
onClose
:
Event
<
URI
>
;
attachSession
(
id
:
string
,
port
:
number
):
void
;
attachSession
(
sessionId
:
string
,
port
:
number
,
subId
?:
string
):
void
;
onAttachSession
:
Event
<
{
id
:
string
,
port
:
number
}
>
;
onAttachSession
:
Event
<
IAttachSessionEvent
>
;
logToSession
(
i
d
:
string
,
log
:
IRemoteConsoleLog
):
void
;
logToSession
(
sessionI
d
:
string
,
log
:
IRemoteConsoleLog
):
void
;
onLogToSession
:
Event
<
{
id
:
string
,
log
:
IRemoteConsoleLog
}
>
;
onLogToSession
:
Event
<
ILogToSessionEvent
>
;
terminateSession
(
id
:
string
):
void
;
terminateSession
(
sessionId
:
string
,
subId
?
:
string
):
void
;
onTerminateSession
:
Event
<
string
>
;
onTerminateSession
:
Event
<
ITerminateSessionEvent
>
;
}
}
\ No newline at end of file
src/vs/workbench/services/extensions/electron-browser/extensionHostDebugService.ts
浏览文件 @
dc234da0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
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
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IRemoteConsoleLog
}
from
'
vs/base/common/console
'
;
import
{
IRemoteConsoleLog
}
from
'
vs/base/common/console
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
...
@@ -16,10 +16,8 @@ interface IReloadBroadcast {
...
@@ -16,10 +16,8 @@ interface IReloadBroadcast {
resource
:
string
;
resource
:
string
;
}
}
interface
IAttachSessionBroadcast
{
interface
IAttachSessionBroadcast
extends
IAttachSessionEvent
{
type
:
'
vscode:extensionAttach
'
;
type
:
'
vscode:extensionAttach
'
;
id
:
string
;
port
:
number
;
}
}
interface
ICloseBroadcast
{
interface
ICloseBroadcast
{
...
@@ -27,15 +25,12 @@ interface ICloseBroadcast {
...
@@ -27,15 +25,12 @@ interface ICloseBroadcast {
resource
:
string
;
resource
:
string
;
}
}
interface
ILogToSessionBroadcast
{
interface
ILogToSessionBroadcast
extends
ILogToSessionEvent
{
type
:
'
vscode:extensionLog
'
;
type
:
'
vscode:extensionLog
'
;
id
:
string
;
log
:
IRemoteConsoleLog
;
}
}
interface
ITerminateSessionBroadcast
{
interface
ITerminateSessionBroadcast
extends
ITerminateSessionEvent
{
type
:
'
vscode:extensionTerminate
'
;
type
:
'
vscode:extensionTerminate
'
;
id
:
string
;
}
}
const
CHANNEL
=
'
vscode:extensionHostDebug
'
;
const
CHANNEL
=
'
vscode:extensionHostDebug
'
;
...
@@ -46,9 +41,9 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
...
@@ -46,9 +41,9 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
private
windowId
:
number
;
private
windowId
:
number
;
private
readonly
_onReload
=
new
Emitter
<
URI
>
();
private
readonly
_onReload
=
new
Emitter
<
URI
>
();
private
readonly
_onClose
=
new
Emitter
<
URI
>
();
private
readonly
_onClose
=
new
Emitter
<
URI
>
();
private
readonly
_onAttachSession
=
new
Emitter
<
{
id
:
string
,
port
:
number
}
>
();
private
readonly
_onAttachSession
=
new
Emitter
<
IAttachSessionEvent
>
();
private
readonly
_onLogToSession
=
new
Emitter
<
{
id
:
string
,
log
:
IRemoteConsoleLog
}
>
();
private
readonly
_onLogToSession
=
new
Emitter
<
ILogToSessionEvent
>
();
private
readonly
_onTerminateSession
=
new
Emitter
<
string
>
();
private
readonly
_onTerminateSession
=
new
Emitter
<
ITerminateSessionEvent
>
();
constructor
(
constructor
(
@
IWindowService
readonly
windowService
:
IWindowService
,
@
IWindowService
readonly
windowService
:
IWindowService
,
...
@@ -56,20 +51,22 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
...
@@ -56,20 +51,22 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
this
.
windowId
=
windowService
.
windowId
;
this
.
windowId
=
windowService
.
windowId
;
ipc
.
on
(
CHANNEL
,
(
_
:
unknown
,
broadcast
:
IReloadBroadcast
|
ICloseBroadcast
|
IAttachSessionBroadcast
|
ILogToSessionBroadcast
|
ITerminateSessionBroadcast
)
=>
{
ipc
.
on
(
CHANNEL
,
(
_
:
unknown
,
broadcast
:
IReloadBroadcast
|
ICloseBroadcast
|
IAttachSessionBroadcast
|
ILogToSessionBroadcast
|
ITerminateSessionBroadcast
)
=>
{
if
(
broadcast
.
type
===
'
vscode:extensionReload
'
)
{
switch
(
broadcast
.
type
)
{
this
.
_onReload
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
case
'
vscode:extensionReload
'
:
}
this
.
_onReload
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
if
(
broadcast
.
type
===
'
vscode:extensionCloseExtensionHost
'
)
{
break
;
this
.
_onClose
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
case
'
vscode:extensionCloseExtensionHost
'
:
}
this
.
_onClose
.
fire
(
URI
.
parse
(
broadcast
.
resource
));
if
(
broadcast
.
type
===
'
vscode:extensionAttach
'
)
{
break
;
this
.
_onAttachSession
.
fire
({
id
:
broadcast
.
id
,
port
:
broadcast
.
port
});
case
'
vscode:extensionAttach
'
:
}
this
.
_onAttachSession
.
fire
(
broadcast
);
if
(
broadcast
.
type
===
'
vscode:extensionLog
'
)
{
break
;
this
.
_onLogToSession
.
fire
({
id
:
broadcast
.
id
,
log
:
broadcast
.
log
});
case
'
vscode:extensionLog
'
:
}
this
.
_onLogToSession
.
fire
(
broadcast
);
if
(
broadcast
.
type
===
'
vscode:extensionTerminate
'
)
{
break
;
this
.
_onTerminateSession
.
fire
(
broadcast
.
id
);
case
'
vscode:extensionTerminate
'
:
this
.
_onTerminateSession
.
fire
(
broadcast
);
break
;
}
}
});
});
}
}
...
@@ -96,38 +93,40 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
...
@@ -96,38 +93,40 @@ class ExtensionHostDebugService implements IExtensionHostDebugService {
return
this
.
_onClose
.
event
;
return
this
.
_onClose
.
event
;
}
}
attachSession
(
id
:
string
,
port
:
number
):
void
{
attachSession
(
sessionId
:
string
,
port
:
number
,
subId
?:
string
):
void
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
IAttachSessionBroadcast
>
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
IAttachSessionBroadcast
>
{
type
:
'
vscode:extensionAttach
'
,
type
:
'
vscode:extensionAttach
'
,
id
,
sessionId
,
port
port
,
subId
});
});
}
}
get
onAttachSession
():
Event
<
{
id
:
string
,
port
:
number
}
>
{
get
onAttachSession
():
Event
<
IAttachSessionEvent
>
{
return
this
.
_onAttachSession
.
event
;
return
this
.
_onAttachSession
.
event
;
}
}
logToSession
(
i
d
:
string
,
log
:
IRemoteConsoleLog
):
void
{
logToSession
(
sessionI
d
:
string
,
log
:
IRemoteConsoleLog
):
void
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
ILogToSessionBroadcast
>
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
ILogToSessionBroadcast
>
{
type
:
'
vscode:extensionLog
'
,
type
:
'
vscode:extensionLog
'
,
i
d
,
sessionI
d
,
log
log
});
});
}
}
get
onLogToSession
():
Event
<
{
id
:
string
,
log
:
IRemoteConsoleLog
}
>
{
get
onLogToSession
():
Event
<
ILogToSessionEvent
>
{
return
this
.
_onLogToSession
.
event
;
return
this
.
_onLogToSession
.
event
;
}
}
terminateSession
(
id
:
string
):
void
{
terminateSession
(
sessionId
:
string
,
subId
?
:
string
):
void
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
ITerminateSessionBroadcast
>
{
ipc
.
send
(
CHANNEL
,
this
.
windowId
,
<
ITerminateSessionBroadcast
>
{
type
:
'
vscode:extensionTerminate
'
,
type
:
'
vscode:extensionTerminate
'
,
id
sessionId
,
subId
});
});
}
}
get
onTerminateSession
():
Event
<
string
>
{
get
onTerminateSession
():
Event
<
ITerminateSessionEvent
>
{
return
this
.
_onTerminateSession
.
event
;
return
this
.
_onTerminateSession
.
event
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录