Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7563843d
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,发现更多精彩内容 >>
提交
7563843d
编写于
6月 15, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show Developer Tools action in case of ext host crash
上级
06966cae
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
23 addition
and
10 deletion
+23
-10
src/vs/workbench/electron-browser/extensionHost.ts
src/vs/workbench/electron-browser/extensionHost.ts
+23
-10
未找到文件。
src/vs/workbench/electron-browser/extensionHost.ts
浏览文件 @
7563843d
...
...
@@ -11,11 +11,12 @@ import { stringify } from 'vs/base/common/marshalling';
import
*
as
objects
from
'
vs/base/common/objects
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
findFreePort
}
from
'
vs/base/node/ports
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
ILifecycleService
,
ShutdownEvent
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowsService
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWindowIPCService
}
from
'
vs/workbench/services/window/electron-browser/windowService
'
;
...
...
@@ -89,7 +90,8 @@ export class ExtensionHostProcessWorker {
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowIPCService
private
windowService
:
IWindowIPCService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IWindowIPCService
private
windowIpcService
:
IWindowIPCService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
...
...
@@ -120,7 +122,7 @@ export class ExtensionHostProcessWorker {
AMD_ENTRYPOINT
:
'
vs/workbench/node/extensionHostProcess
'
,
PIPE_LOGGING
:
'
true
'
,
VERBOSE_LOGGING
:
true
,
VSCODE_WINDOW_ID
:
String
(
this
.
windowService
.
getWindowId
()),
VSCODE_WINDOW_ID
:
String
(
this
.
window
Ipc
Service
.
getWindowId
()),
VSCODE_IPC_HOOK_EXTHOST
:
hook
,
ELECTRON_NO_ASAR
:
'
1
'
}),
...
...
@@ -143,8 +145,8 @@ export class ExtensionHostProcessWorker {
// Run Extension Host as fork of current process
this
.
extensionHostProcess
=
fork
(
URI
.
parse
(
require
.
toUrl
(
'
bootstrap
'
)).
fsPath
,
[
'
--type=extensionHost
'
],
opts
);
// Catch all output coming from the extension host process
type
Output
=
{
data
:
string
,
format
:
string
[]
};
this
.
extensionHostProcess
.
stdout
.
setEncoding
(
'
utf8
'
);
this
.
extensionHostProcess
.
stderr
.
setEncoding
(
'
utf8
'
);
const
onStdout
=
fromEventEmitter
<
string
>
(
this
.
extensionHostProcess
.
stdout
,
'
data
'
);
...
...
@@ -154,12 +156,14 @@ export class ExtensionHostProcessWorker {
mapEvent
(
onStderr
,
o
=>
({
data
:
`%c
${
o
}
`
,
format
:
[
'
color: red
'
]
}))
);
// Debounce all output, so we can render it in the Chrome console as a group
const
onDebouncedOutput
=
debounceEvent
<
Output
>
(
onOutput
,
(
r
,
o
)
=>
{
return
r
?
{
data
:
r
.
data
+
o
.
data
,
format
:
[...
r
.
format
,
...
o
.
format
]
}
:
{
data
:
o
.
data
,
format
:
o
.
format
};
},
3
00
);
},
1
00
);
// Print out extension host output
onDebouncedOutput
(
data
=>
{
console
.
group
(
'
Extension Host
'
);
console
.
log
(
data
.
data
,
...
data
.
format
);
...
...
@@ -181,7 +185,7 @@ export class ExtensionHostProcessWorker {
// Notify debugger that we are ready to attach to the process if we run a development extension
if
(
this
.
isExtensionDevelopmentHost
&&
port
)
{
this
.
windowService
.
broadcast
({
this
.
window
Ipc
Service
.
broadcast
({
channel
:
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
payload
:
{
port
}
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
...
...
@@ -323,7 +327,7 @@ export class ExtensionHostProcessWorker {
// Broadcast to other windows if we are in development mode
else
if
(
!
this
.
environmentService
.
isBuilt
||
this
.
isExtensionDevelopmentHost
)
{
this
.
windowService
.
broadcast
({
this
.
window
Ipc
Service
.
broadcast
({
channel
:
EXTENSION_LOG_BROADCAST_CHANNEL
,
payload
:
logEntry
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
...
...
@@ -348,16 +352,25 @@ export class ExtensionHostProcessWorker {
// Unexpected termination
if
(
!
this
.
isExtensionDevelopmentHost
)
{
const
openDevTools
=
new
Action
(
'
openDevTools
'
,
nls
.
localize
(
'
devTools
'
,
"
Developer Tools
"
),
''
,
true
,
async
():
TPromise
<
boolean
>
=>
{
await
this
.
windowService
.
openDevTools
();
return
false
;
});
this
.
messageService
.
show
(
Severity
.
Error
,
{
message
:
nls
.
localize
(
'
extensionHostProcess.crash
'
,
"
Extension host terminated unexpectedly. Please reload the window to recover.
"
),
actions
:
[
this
.
instantiationService
.
createInstance
(
ReloadWindowAction
,
ReloadWindowAction
.
ID
,
ReloadWindowAction
.
LABEL
)]
actions
:
[
openDevTools
,
this
.
instantiationService
.
createInstance
(
ReloadWindowAction
,
ReloadWindowAction
.
ID
,
ReloadWindowAction
.
LABEL
)
]
});
console
.
error
(
'
Extension host terminated unexpectedly. Code:
'
,
code
,
'
Signal:
'
,
signal
);
}
// Expected development extension termination: When the extension host goes down we also shutdown the window
else
if
(
!
this
.
isExtensionDevelopmentTestFromCli
)
{
this
.
windowService
.
getWindow
().
close
();
this
.
window
Ipc
Service
.
getWindow
().
close
();
}
// When CLI testing make sure to exit with proper exit code
...
...
@@ -381,7 +394,7 @@ export class ExtensionHostProcessWorker {
// If the extension development host was started without debugger attached we need
// to communicate this back to the main side to terminate the debug session
if
(
this
.
isExtensionDevelopmentHost
&&
!
this
.
isExtensionDevelopmentTestFromCli
&&
!
this
.
isExtensionDevelopmentDebug
)
{
this
.
windowService
.
broadcast
({
this
.
window
Ipc
Service
.
broadcast
({
channel
:
EXTENSION_TERMINATE_BROADCAST_CHANNEL
,
payload
:
true
},
this
.
environmentService
.
extensionDevelopmentPath
/* target */
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录