Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
d4ff203d
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
d4ff203d
编写于
7月 18, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify closeExtensionHostWindow via broadcast
上级
7d42622d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
22 addition
and
48 deletion
+22
-48
src/vs/code/node/windowsFinder.ts
src/vs/code/node/windowsFinder.ts
+0
-20
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+0
-2
src/vs/platform/windows/common/windowsIpc.ts
src/vs/platform/windows/common/windowsIpc.ts
+0
-6
src/vs/platform/windows/electron-main/windowsService.ts
src/vs/platform/windows/electron-main/windowsService.ts
+0
-11
src/vs/workbench/electron-browser/extensionHost.ts
src/vs/workbench/electron-browser/extensionHost.ts
+17
-2
src/vs/workbench/parts/debug/electron-browser/debugService.ts
...vs/workbench/parts/debug/electron-browser/debugService.ts
+5
-2
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+0
-5
未找到文件。
src/vs/code/node/windowsFinder.ts
浏览文件 @
d4ff203d
...
...
@@ -144,25 +144,5 @@ export function findWindowOnWorkspace<W extends ISimpleWindow>(windows: W[], wor
}
}
return
null
;
}
export
function
findExtensionDevelopmentWindow
<
W
extends
ISimpleWindow
>
(
windows
:
W
[],
extensionDevelopmentPath
?:
string
):
W
{
if
(
windows
.
length
)
{
const
res
=
windows
.
filter
(
w
=>
{
// match on extension development path
if
(
typeof
extensionDevelopmentPath
===
'
string
'
&&
paths
.
isEqual
(
w
.
extensionDevelopmentPath
,
extensionDevelopmentPath
,
!
platform
.
isLinux
/* ignorecase */
))
{
return
true
;
}
return
false
;
});
if
(
res
&&
res
.
length
)
{
return
res
[
0
];
}
}
return
null
;
}
\ No newline at end of file
src/vs/platform/windows/common/windows.ts
浏览文件 @
d4ff203d
...
...
@@ -58,8 +58,6 @@ export interface IWindowsService {
getWindows
():
TPromise
<
{
id
:
number
;
workspace
?:
IWorkspaceIdentifier
;
folderPath
?:
string
;
title
:
string
;
filename
?:
string
;
}[]
>
;
getWindowCount
():
TPromise
<
number
>
;
log
(
severity
:
string
,
...
messages
:
string
[]):
TPromise
<
void
>
;
// TODO@joao: what?
closeExtensionHostWindow
(
extensionDevelopmentPaths
:
string
[]):
TPromise
<
void
>
;
showItemInFolder
(
path
:
string
):
TPromise
<
void
>
;
// This needs to be handled from browser process to prevent
...
...
src/vs/platform/windows/common/windowsIpc.ts
浏览文件 @
d4ff203d
...
...
@@ -46,7 +46,6 @@ export interface IWindowsChannel extends IChannel {
call
(
command
:
'
whenSharedProcessReady
'
):
TPromise
<
void
>
;
call
(
command
:
'
toggleSharedProcess
'
):
TPromise
<
void
>
;
call
(
command
:
'
log
'
,
arg
:
[
string
,
string
[]]):
TPromise
<
void
>
;
call
(
command
:
'
closeExtensionHostWindow
'
,
arg
:
string
[]):
TPromise
<
void
>
;
call
(
command
:
'
showItemInFolder
'
,
arg
:
string
):
TPromise
<
void
>
;
call
(
command
:
'
openExternal
'
,
arg
:
string
):
TPromise
<
boolean
>
;
call
(
command
:
'
startCrashReporter
'
,
arg
:
Electron
.
CrashReporterStartOptions
):
TPromise
<
void
>
;
...
...
@@ -98,7 +97,6 @@ export class WindowsChannel implements IWindowsChannel {
case
'
toggleSharedProcess
'
:
return
this
.
service
.
toggleSharedProcess
();
case
'
quit
'
:
return
this
.
service
.
quit
();
case
'
log
'
:
return
this
.
service
.
log
(
arg
[
0
],
arg
[
1
]);
case
'
closeExtensionHostWindow
'
:
return
this
.
service
.
closeExtensionHostWindow
(
arg
);
case
'
showItemInFolder
'
:
return
this
.
service
.
showItemInFolder
(
arg
);
case
'
openExternal
'
:
return
this
.
service
.
openExternal
(
arg
);
case
'
startCrashReporter
'
:
return
this
.
service
.
startCrashReporter
(
arg
);
...
...
@@ -243,10 +241,6 @@ export class WindowsChannelClient implements IWindowsService {
return
this
.
channel
.
call
(
'
log
'
,
[
severity
,
messages
]);
}
closeExtensionHostWindow
(
extensionDevelopmentPaths
:
string
[]):
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
closeExtensionHostWindow
'
,
extensionDevelopmentPaths
);
}
showItemInFolder
(
path
:
string
):
TPromise
<
void
>
{
return
this
.
channel
.
call
(
'
showItemInFolder
'
,
path
);
}
...
...
src/vs/platform/windows/electron-main/windowsService.ts
浏览文件 @
d4ff203d
...
...
@@ -19,7 +19,6 @@ import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import
{
ILifecycleService
}
from
"
vs/platform/lifecycle/electron-main/lifecycleMain
"
;
import
{
IWindowsMainService
,
ISharedProcess
}
from
"
vs/platform/windows/electron-main/windows
"
;
import
{
IHistoryMainService
,
IRecentlyOpened
}
from
"
vs/platform/history/common/history
"
;
import
{
findExtensionDevelopmentWindow
}
from
"
vs/code/node/windowsFinder
"
;
import
{
IWorkspaceIdentifier
}
from
"
vs/platform/workspaces/common/workspaces
"
;
export
class
WindowsService
implements
IWindowsService
,
IDisposable
{
...
...
@@ -282,16 +281,6 @@ export class WindowsService implements IWindowsService, IDisposable {
return
TPromise
.
as
(
null
);
}
closeExtensionHostWindow
(
extensionDevelopmentPaths
:
string
[]):
TPromise
<
void
>
{
extensionDevelopmentPaths
.
map
(
extensionDevelopmentPath
=>
findExtensionDevelopmentWindow
(
this
.
windowsMainService
.
getWindows
(),
extensionDevelopmentPath
)).
forEach
(
extensionDevelopmentWindow
=>
{
if
(
extensionDevelopmentWindow
)
{
extensionDevelopmentWindow
.
win
.
close
();
}
});
return
TPromise
.
as
(
null
);
}
showItemInFolder
(
path
:
string
):
TPromise
<
void
>
{
shell
.
showItemInFolder
(
path
);
return
TPromise
.
as
(
null
);
...
...
src/vs/workbench/electron-browser/extensionHost.ts
浏览文件 @
d4ff203d
...
...
@@ -12,7 +12,7 @@ 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
{
isWindows
,
isLinux
}
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
'
;
...
...
@@ -34,11 +34,13 @@ import { IInitData, IWorkspaceData } from 'vs/workbench/api/node/extHost.protoco
import
{
MainProcessExtensionService
}
from
'
vs/workbench/api/electron-browser/mainThreadExtensionService
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
ICrashReporterService
}
from
'
vs/workbench/services/crashReporter/common/crashReporterService
'
;
import
{
IBroadcastService
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
import
{
IBroadcastService
,
IBroadcast
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
import
{
isEqual
}
from
"
vs/base/common/paths
"
;
export
const
EXTENSION_LOG_BROADCAST_CHANNEL
=
'
vscode:extensionLog
'
;
export
const
EXTENSION_ATTACH_BROADCAST_CHANNEL
=
'
vscode:extensionAttach
'
;
export
const
EXTENSION_TERMINATE_BROADCAST_CHANNEL
=
'
vscode:extensionTerminate
'
;
export
const
EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL
=
'
vscode:extensionCloseExtensionHost
'
;
export
interface
ILogEntry
{
type
:
string
;
...
...
@@ -108,6 +110,19 @@ export class ExtensionHostProcessWorker {
lifecycleService
.
onWillShutdown
(
this
.
_onWillShutdown
,
this
);
lifecycleService
.
onShutdown
(
reason
=>
this
.
terminate
());
broadcastService
.
onBroadcast
(
b
=>
this
.
onBroadcast
(
b
));
}
private
onBroadcast
(
broadcast
:
IBroadcast
):
void
{
// Close Ext Host Window Request
if
(
broadcast
.
channel
===
EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL
&&
this
.
isExtensionDevelopmentHost
)
{
const
extensionPaths
=
broadcast
.
payload
as
string
[];
if
(
Array
.
isArray
(
extensionPaths
)
&&
extensionPaths
.
some
(
path
=>
isEqual
(
this
.
environmentService
.
extensionDevelopmentPath
,
path
,
!
isLinux
)))
{
this
.
windowService
.
closeWindow
();
}
}
}
public
start
(
extensionService
:
MainProcessExtensionService
):
void
{
...
...
src/vs/workbench/parts/debug/electron-browser/debugService.ts
浏览文件 @
d4ff203d
...
...
@@ -48,7 +48,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ILogEntry
,
EXTENSION_LOG_BROADCAST_CHANNEL
,
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
EXTENSION_TERMINATE_BROADCAST_CHANNEL
}
from
'
vs/workbench/electron-browser/extensionHost
'
;
import
{
ILogEntry
,
EXTENSION_LOG_BROADCAST_CHANNEL
,
EXTENSION_ATTACH_BROADCAST_CHANNEL
,
EXTENSION_TERMINATE_BROADCAST_CHANNEL
,
EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL
}
from
'
vs/workbench/electron-browser/extensionHost
'
;
import
{
IBroadcastService
,
IBroadcast
}
from
"
vs/platform/broadcast/electron-browser/broadcastService
"
;
const
DEBUG_BREAKPOINTS_KEY
=
'
debug.breakpoint
'
;
...
...
@@ -418,7 +418,10 @@ export class DebugService implements debug.IDebugService {
const
process
=
this
.
viewModel
.
focusedProcess
;
if
(
process
&&
session
&&
process
.
getId
()
===
session
.
getId
()
&&
strings
.
equalsIgnoreCase
(
process
.
configuration
.
type
,
'
extensionhost
'
)
&&
this
.
sessionStates
.
get
(
session
.
getId
())
===
debug
.
State
.
Running
&&
process
&&
this
.
contextService
.
hasWorkspace
()
&&
process
.
configuration
.
noDebug
)
{
this
.
windowsService
.
closeExtensionHostWindow
(
this
.
contextService
.
getWorkspace
().
roots
.
map
(
r
=>
r
.
fsPath
));
this
.
broadcastService
.
broadcast
({
channel
:
EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL
,
payload
:
this
.
contextService
.
getWorkspace
().
roots
.
map
(
r
=>
r
.
fsPath
)
});
}
if
(
session
&&
session
.
getId
()
===
event
.
body
.
sessionId
)
{
this
.
onSessionEnd
(
session
);
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
d4ff203d
...
...
@@ -1096,11 +1096,6 @@ export class TestWindowsService implements IWindowsService {
return
TPromise
.
as
(
void
0
);
}
// TODO@joao: what?
closeExtensionHostWindow
(
extensionDevelopmentPaths
:
string
[]):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
showItemInFolder
(
path
:
string
):
TPromise
<
void
>
{
return
TPromise
.
as
(
void
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录