Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
63caf66b
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,发现更多精彩内容 >>
提交
63caf66b
编写于
12月 11, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More lazy loading of services (for #15455)
上级
1d34bb3e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
53 deletion
+35
-53
src/vs/platform/message/common/messageIpc.ts
src/vs/platform/message/common/messageIpc.ts
+2
-3
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+24
-38
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+8
-10
src/vs/workbench/services/backup/node/backupFileService.ts
src/vs/workbench/services/backup/node/backupFileService.ts
+1
-2
未找到文件。
src/vs/platform/message/common/messageIpc.ts
浏览文件 @
63caf66b
...
...
@@ -16,12 +16,12 @@ export interface IChoiceChannel extends IChannel {
export
class
ChoiceChannel
implements
IChoiceChannel
{
constructor
(
private
s
ervice
:
IChoiceService
)
{
constructor
(
@
IChoiceService
private
choiceS
ervice
:
IChoiceService
)
{
}
call
(
command
:
string
,
args
?:
any
):
TPromise
<
any
>
{
switch
(
command
)
{
case
'
choose
'
:
return
this
.
s
ervice
.
choose
(
<
Severity
>
args
[
0
],
<
string
>
args
[
1
],
<
string
[]
>
args
[
2
],
<
boolean
>
args
[
3
]);
case
'
choose
'
:
return
this
.
choiceS
ervice
.
choose
(
<
Severity
>
args
[
0
],
<
string
>
args
[
1
],
<
string
[]
>
args
[
2
],
<
boolean
>
args
[
3
]);
}
return
TPromise
.
wrapError
(
'
invalid command
'
);
}
...
...
@@ -36,5 +36,4 @@ export class ChoiceChannelClient implements IChoiceService {
choose
(
severity
:
Severity
,
message
:
string
,
options
:
string
[],
modal
?:
boolean
):
TPromise
<
number
>
{
return
this
.
channel
.
call
(
'
choose
'
,
[
severity
,
message
,
options
,
modal
]);
}
}
\ No newline at end of file
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
63caf66b
...
...
@@ -17,6 +17,7 @@ import { dispose, IDisposable, Disposables } from 'vs/base/common/lifecycle';
import
errors
=
require
(
'
vs/base/common/errors
'
);
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
product
from
'
vs/platform/product
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
pkg
from
'
vs/platform/package
'
;
import
{
ContextViewService
}
from
'
vs/platform/contextview/browser/contextViewService
'
;
import
timer
=
require
(
'
vs/base/common/timer
'
);
...
...
@@ -294,33 +295,31 @@ export class WorkbenchShell {
private
initServiceCollection
(
container
:
HTMLElement
):
[
IInstantiationService
,
ServiceCollection
]
{
const
disposables
=
new
Disposables
();
const
mainProcessClient
=
new
ElectronIPCClient
(
String
(
`window
${
remote
.
getCurrentWindow
().
id
}
`
));
disposables
.
add
(
mainProcessClient
);
const
serviceCollection
=
new
ServiceCollection
();
serviceCollection
.
set
(
IEventService
,
this
.
eventService
);
serviceCollection
.
set
(
IWorkspaceContextService
,
this
.
contextService
);
serviceCollection
.
set
(
IConfigurationService
,
this
.
configurationService
);
serviceCollection
.
set
(
IEnvironmentService
,
this
.
environmentService
);
const
instantiationServiceImpl
=
new
InstantiationService
(
serviceCollection
,
true
);
const
instantiationService
=
instantiationServiceImpl
as
IInstantiationService
;
const
instantiationService
:
IInstantiationService
=
new
InstantiationService
(
serviceCollection
,
true
);
// TODO@joao remove this
const
windowIPCService
=
instantiationService
.
createInstance
<
IWindowIPCService
>
(
WindowIPCService
);
serviceCollection
.
set
(
IWindowIPCService
,
windowIPCService
);
const
mainProcessClient
=
new
ElectronIPCClient
(
String
(
`window
${
remote
.
getCurrentWindow
().
id
}
`
));
disposables
.
add
(
mainProcessClient
);
const
windowsChannel
=
mainProcessClient
.
getChannel
(
'
windows
'
);
const
windowsChannelClient
=
new
WindowsChannelClient
(
windowsChannel
);
serviceCollection
.
set
(
IWindowsService
,
windowsChannelClient
);
serviceCollection
.
set
(
IWindowsService
,
new
SyncDescriptor
(
WindowsChannelClient
,
windowsChannel
));
const
windowService
=
new
WindowService
(
windowIPCService
.
getWindowId
(),
windowsChannelClient
);
serviceCollection
.
set
(
IWindowService
,
windowService
);
serviceCollection
.
set
(
IWindowService
,
new
SyncDescriptor
(
WindowService
,
windowIPCService
.
getWindowId
()));
const
sharedProcess
=
connectNet
(
this
.
environmentService
.
sharedIPCHandle
,
`window:
${
windowIPCService
.
getWindowId
()}
`
);
sharedProcess
.
done
(
client
=>
{
client
.
registerChannel
(
'
choice
'
,
new
ChoiceChannel
(
this
.
messageService
));
// Choice channel
client
.
registerChannel
(
'
choice
'
,
instantiationService
.
createInstance
(
ChoiceChannel
));
client
.
onClose
(()
=>
{
this
.
messageService
.
show
(
Severity
.
Error
,
{
...
...
@@ -379,8 +378,7 @@ export class WorkbenchShell {
disposables
.
add
(
lifecycleTelemetry
(
this
.
telemetryService
,
lifecycleService
));
const
extensionManagementChannel
=
getDelayedChannel
<
IExtensionManagementChannel
>
(
sharedProcess
.
then
(
c
=>
c
.
getChannel
(
'
extensions
'
)));
const
extensionManagementChannelClient
=
new
ExtensionManagementChannelClient
(
extensionManagementChannel
);
serviceCollection
.
set
(
IExtensionManagementService
,
extensionManagementChannelClient
);
serviceCollection
.
set
(
IExtensionManagementService
,
new
SyncDescriptor
(
ExtensionManagementChannelClient
,
extensionManagementChannel
));
const
extensionEnablementService
=
instantiationService
.
createInstance
(
ExtensionEnablementService
);
serviceCollection
.
set
(
IExtensionEnablementService
,
extensionEnablementService
);
...
...
@@ -400,54 +398,42 @@ export class WorkbenchShell {
timers
.
perfAfterExtensionLoad
=
new
Date
();
});
serviceCollection
.
set
(
ICommandService
,
new
CommandService
(
instantiationService
,
this
.
extension
Service
));
serviceCollection
.
set
(
ICommandService
,
new
SyncDescriptor
(
Command
Service
));
this
.
contextViewService
=
instantiationService
.
createInstance
(
ContextViewService
,
this
.
container
);
serviceCollection
.
set
(
IContextViewService
,
this
.
contextViewService
);
const
requestService
=
instantiationService
.
createInstance
(
RequestService
);
serviceCollection
.
set
(
IRequestService
,
requestService
);
serviceCollection
.
set
(
IRequestService
,
new
SyncDescriptor
(
RequestService
));
const
markerService
=
instantiationService
.
createInstance
(
MarkerService
);
serviceCollection
.
set
(
IMarkerService
,
markerService
);
serviceCollection
.
set
(
IMarkerService
,
new
SyncDescriptor
(
MarkerService
));
const
modeService
=
instantiationService
.
createInstance
(
MainThreadModeServiceImpl
);
serviceCollection
.
set
(
IModeService
,
modeService
);
serviceCollection
.
set
(
IModeService
,
new
SyncDescriptor
(
MainThreadModeServiceImpl
));
const
modelService
=
instantiationService
.
createInstance
(
ModelServiceImpl
);
serviceCollection
.
set
(
IModelService
,
modelService
);
serviceCollection
.
set
(
IModelService
,
new
SyncDescriptor
(
ModelServiceImpl
));
const
editorWorkerService
=
instantiationService
.
createInstance
(
EditorWorkerServiceImpl
);
serviceCollection
.
set
(
IEditorWorkerService
,
editorWorkerService
);
serviceCollection
.
set
(
IEditorWorkerService
,
new
SyncDescriptor
(
EditorWorkerServiceImpl
));
const
untitledEditorService
=
instantiationService
.
createInstance
(
UntitledEditorService
);
serviceCollection
.
set
(
IUntitledEditorService
,
untitledEditorService
);
serviceCollection
.
set
(
IUntitledEditorService
,
new
SyncDescriptor
(
UntitledEditorService
));
this
.
themeService
=
instantiationService
.
createInstance
(
ThemeService
);
serviceCollection
.
set
(
IThemeService
,
this
.
themeService
);
const
searchService
=
instantiationService
.
createInstance
(
SearchService
);
serviceCollection
.
set
(
ISearchService
,
searchService
);
serviceCollection
.
set
(
ISearchService
,
new
SyncDescriptor
(
SearchService
));
const
codeEditorService
=
instantiationServiceImpl
.
createInstance
(
CodeEditorServiceImpl
);
serviceCollection
.
set
(
ICodeEditorService
,
codeEditorService
);
serviceCollection
.
set
(
ICodeEditorService
,
new
SyncDescriptor
(
CodeEditorServiceImpl
));
const
integrityService
=
instantiationService
.
createInstance
(
IntegrityServiceImpl
);
serviceCollection
.
set
(
IIntegrityService
,
integrityService
);
serviceCollection
.
set
(
IIntegrityService
,
new
SyncDescriptor
(
IntegrityServiceImpl
));
const
updateChannel
=
mainProcessClient
.
getChannel
(
'
update
'
);
const
updateChannelClient
=
new
UpdateChannelClient
(
updateChannel
);
serviceCollection
.
set
(
IUpdateService
,
updateChannelClient
);
serviceCollection
.
set
(
IUpdateService
,
new
SyncDescriptor
(
UpdateChannelClient
,
updateChannel
));
const
urlChannel
=
mainProcessClient
.
getChannel
(
'
url
'
);
const
urlChannelClient
=
new
URLChannelClient
(
urlChannel
,
windowIPCService
.
getWindowId
());
serviceCollection
.
set
(
IURLService
,
urlChannelClient
);
serviceCollection
.
set
(
IURLService
,
new
SyncDescriptor
(
URLChannelClient
,
urlChannel
,
windowIPCService
.
getWindowId
()));
const
backupChannel
=
mainProcessClient
.
getChannel
(
'
backup
'
);
const
backupChannelClient
=
new
BackupChannelClient
(
backupChannel
);
serviceCollection
.
set
(
IBackupService
,
backupChannelClient
);
serviceCollection
.
set
(
IBackupService
,
new
SyncDescriptor
(
BackupChannelClient
,
backupChannel
));
return
[
instantiationService
Impl
,
serviceCollection
];
return
[
instantiationService
,
serviceCollection
];
}
public
open
():
void
{
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
63caf66b
...
...
@@ -422,7 +422,7 @@ export class Workbench implements IPartService {
serviceCollection
.
set
(
IKeybindingService
,
this
.
keybindingService
);
// Context Menu
serviceCollection
.
set
(
IContextMenuService
,
this
.
instantiationService
.
createInstance
(
ContextMenuService
));
serviceCollection
.
set
(
IContextMenuService
,
new
SyncDescriptor
(
ContextMenuService
));
// Menus/Actions
serviceCollection
.
set
(
IMenuService
,
new
SyncDescriptor
(
MenuService
));
...
...
@@ -463,35 +463,33 @@ export class Workbench implements IPartService {
serviceCollection
.
set
(
IEditorGroupService
,
this
.
editorPart
);
// File Service
const
fileService
=
this
.
instantiationService
.
createInstance
(
FileService
);
serviceCollection
.
set
(
IFileService
,
fileService
);
serviceCollection
.
set
(
IFileService
,
new
SyncDescriptor
(
FileService
));
// History
serviceCollection
.
set
(
IHistoryService
,
this
.
instantiationService
.
createInstance
(
HistoryService
));
serviceCollection
.
set
(
IHistoryService
,
new
SyncDescriptor
(
HistoryService
));
// Backup File Service
const
workspace
=
this
.
contextService
.
getWorkspace
();
serviceCollection
.
set
(
IBackupFileService
,
this
.
instantiationService
.
createInstance
(
BackupFileService
,
this
.
windowService
.
getCurrentWindowId
()));
// Backup Service
serviceCollection
.
set
(
IBackupModelService
,
this
.
instantiationService
.
createInstance
(
BackupModelService
));
serviceCollection
.
set
(
IBackupModelService
,
new
SyncDescriptor
(
BackupModelService
));
// Text File Service
serviceCollection
.
set
(
ITextFileService
,
this
.
instantiationService
.
createInstance
(
TextFileService
));
serviceCollection
.
set
(
ITextFileService
,
new
SyncDescriptor
(
TextFileService
));
// SCM Service
serviceCollection
.
set
(
ISCMService
,
this
.
instantiationService
.
createInstance
(
SCMService
));
serviceCollection
.
set
(
ISCMService
,
new
SyncDescriptor
(
SCMService
));
// Text Model Resolver Service
serviceCollection
.
set
(
ITextModelResolverService
,
this
.
instantiationService
.
createInstance
(
TextModelResolverService
));
serviceCollection
.
set
(
ITextModelResolverService
,
new
SyncDescriptor
(
TextModelResolverService
));
// Configuration Editing
this
.
configurationEditingService
=
this
.
instantiationService
.
createInstance
(
ConfigurationEditingService
);
serviceCollection
.
set
(
IConfigurationEditingService
,
this
.
configurationEditingService
);
// Configuration Resolver
const
configurationResolverService
=
this
.
instantiationService
.
createInstance
(
ConfigurationResolverService
,
workspace
?
workspace
.
resource
:
null
,
process
.
env
);
serviceCollection
.
set
(
IConfigurationResolverService
,
configurationResolverService
);
serviceCollection
.
set
(
IConfigurationResolverService
,
new
SyncDescriptor
(
ConfigurationResolverService
,
workspace
?
workspace
.
resource
:
null
,
process
.
env
));
// Quick open service (quick open controller)
this
.
quickOpen
=
this
.
instantiationService
.
createInstance
(
QuickOpenController
);
...
...
src/vs/workbench/services/backup/node/backupFileService.ts
浏览文件 @
63caf66b
...
...
@@ -100,8 +100,7 @@ export class BackupFileService implements IBackupFileService {
}
private
get
backupEnabled
():
boolean
{
// Hot exit is disabled when doing extension development
return
!
this
.
environmentService
.
isExtensionDevelopment
;
return
!
this
.
environmentService
.
isExtensionDevelopment
;
// Hot exit is disabled when doing extension development
}
private
init
(
windowId
:
number
):
TPromise
<
IBackupFilesModel
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录