Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
3669afe7
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,发现更多精彩内容 >>
提交
3669afe7
编写于
6月 25, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #48656
上级
ba6aa48b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
12 deletion
+34
-12
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
.../code/electron-browser/sharedProcess/sharedProcessMain.ts
+6
-2
src/vs/platform/extensionManagement/node/extensionManagementService.ts
...rm/extensionManagement/node/extensionManagementService.ts
+28
-10
未找到文件。
src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts
浏览文件 @
3669afe7
...
...
@@ -42,6 +42,7 @@ import { ILocalizationsService } from 'vs/platform/localizations/common/localiza
import
{
LocalizationsChannel
}
from
'
vs/platform/localizations/common/localizationsIpc
'
;
import
{
DialogChannelClient
}
from
'
vs/platform/dialogs/common/dialogIpc
'
;
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
export
interface
ISharedProcessConfiguration
{
readonly
machineId
:
string
;
...
...
@@ -61,11 +62,13 @@ const eventPrefix = 'monacoworkbench';
function
main
(
server
:
Server
,
initData
:
ISharedProcessInitData
,
configuration
:
ISharedProcessConfiguration
):
void
{
const
services
=
new
ServiceCollection
();
const
disposables
:
IDisposable
[]
=
[];
process
.
once
(
'
exit
'
,
()
=>
dispose
(
disposables
));
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
process
.
execPath
);
const
logLevelClient
=
new
LogLevelSetterChannelClient
(
server
.
getChannel
(
'
loglevel
'
,
{
route
:
()
=>
'
main
'
}));
const
logService
=
new
FollowerLogService
(
logLevelClient
,
createSpdLogService
(
'
sharedprocess
'
,
initData
.
logLevel
,
environmentService
.
logsPath
));
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
()
);
disposables
.
push
(
logService
);
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
...
...
@@ -98,7 +101,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
// It is important to dispose the AI adapter properly because
// only then they flush remaining data.
process
.
once
(
'
exit
'
,
()
=>
appenders
.
forEach
(
a
=>
a
.
dispose
())
);
disposables
.
push
(...
appenders
);
const
appender
=
combinedAppender
(...
appenders
);
server
.
registerChannel
(
'
telemetryAppender
'
,
new
TelemetryAppenderChannel
(
appender
));
...
...
@@ -138,6 +141,7 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
server
.
registerChannel
(
'
localizations
'
,
localizationsChannel
);
createSharedProcessContributions
(
instantiationService2
);
disposables
.
push
(
extensionManagementService
as
ExtensionManagementService
);
});
});
}
...
...
src/vs/platform/extensionManagement/node/extensionManagementService.ts
浏览文件 @
3669afe7
...
...
@@ -114,6 +114,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
private
lastReportTimestamp
=
0
;
private
readonly
installationStartTime
:
Map
<
string
,
number
>
=
new
Map
<
string
,
number
>
();
private
readonly
installingExtensions
:
Map
<
string
,
TPromise
<
ILocalExtension
>>
=
new
Map
<
string
,
TPromise
<
ILocalExtension
>>
();
private
readonly
uninstallingExtensions
:
Map
<
string
,
TPromise
<
void
>>
=
new
Map
<
string
,
TPromise
<
void
>>
();
private
readonly
manifestCache
:
ExtensionsManifestCache
;
private
readonly
extensionLifecycle
:
ExtensionsLifecycle
;
...
...
@@ -140,9 +141,15 @@ export class ExtensionManagementService extends Disposable implements IExtension
this
.
extensionsPath
=
environmentService
.
extensionsPath
;
this
.
uninstalledPath
=
path
.
join
(
this
.
extensionsPath
,
'
.obsolete
'
);
this
.
uninstalledFileLimiter
=
new
Limiter
(
1
);
this
.
_register
(
toDisposable
(()
=>
this
.
installingExtensions
.
clear
()));
this
.
manifestCache
=
this
.
_register
(
new
ExtensionsManifestCache
(
environmentService
,
this
));
this
.
extensionLifecycle
=
this
.
_register
(
new
ExtensionsLifecycle
(
this
.
logService
));
this
.
_register
(
toDisposable
(()
=>
{
this
.
installingExtensions
.
forEach
(
promise
=>
promise
.
cancel
());
this
.
uninstallingExtensions
.
forEach
(
promise
=>
promise
.
cancel
());
this
.
installingExtensions
.
clear
();
this
.
uninstallingExtensions
.
clear
();
}));
}
install
(
zipPath
:
string
):
TPromise
<
ILocalExtension
>
{
...
...
@@ -208,7 +215,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
}
private
installFromZipPath
(
identifier
:
IExtensionIdentifier
,
zipPath
:
string
,
metadata
:
IGalleryMetadata
,
manifest
:
IExtensionManifest
):
TPromise
<
ILocalExtension
>
{
return
this
.
getInstalled
()
return
this
.
toNonCancellablePromise
(
this
.
getInstalled
()
.
then
(
installed
=>
{
const
operation
=
this
.
getOperation
({
id
:
getIdFromLocalExtensionId
(
identifier
.
id
),
uuid
:
identifier
.
uuid
},
installed
);
return
this
.
installExtension
({
zipPath
,
id
:
identifier
.
id
,
metadata
})
...
...
@@ -230,12 +237,12 @@ export class ExtensionManagementService extends Disposable implements IExtension
local
=>
{
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
local
,
operation
});
return
local
;
},
error
=>
{
this
.
_onDidInstallExtension
.
fire
({
identifier
,
zipPath
,
operation
,
error
});
return
TPromise
.
wrapError
(
error
);
}
);
});
})
)
;
}
installFromGallery
(
extension
:
IGalleryExtension
):
TPromise
<
ILocalExtension
>
{
this
.
onInstallExtensions
([
extension
]);
return
this
.
getInstalled
(
LocalExtensionType
.
User
)
return
this
.
toNonCancellablePromise
(
this
.
getInstalled
(
LocalExtensionType
.
User
)
.
then
(
installed
=>
this
.
collectExtensionsToInstall
(
extension
)
.
then
(
extensionsToInstall
=>
{
...
...
@@ -249,7 +256,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
.
then
(()
=>
locals
.
filter
(
l
=>
areSameExtensions
({
id
:
getGalleryExtensionIdFromLocal
(
l
),
uuid
:
l
.
identifier
.
uuid
},
extension
.
identifier
))[
0
]),
errors
=>
this
.
onDidInstallExtensions
(
extensionsToInstall
,
[],
operataions
,
errors
));
},
error
=>
this
.
onDidInstallExtensions
([
extension
],
[],
[
this
.
getOperation
(
extension
.
identifier
,
installed
)],
[
error
])));
error
=>
this
.
onDidInstallExtensions
([
extension
],
[],
[
this
.
getOperation
(
extension
.
identifier
,
installed
)],
[
error
])))
)
;
}
reinstallFromGallery
(
extension
:
ILocalExtension
):
TPromise
<
ILocalExtension
>
{
...
...
@@ -487,13 +494,13 @@ export class ExtensionManagementService extends Disposable implements IExtension
}
uninstall
(
extension
:
ILocalExtension
,
force
=
false
):
TPromise
<
void
>
{
return
this
.
getInstalled
(
LocalExtensionType
.
User
)
return
this
.
toNonCancellablePromise
(
this
.
getInstalled
(
LocalExtensionType
.
User
)
.
then
(
installed
=>
{
const
promises
=
installed
.
filter
(
e
=>
e
.
manifest
.
publisher
===
extension
.
manifest
.
publisher
&&
e
.
manifest
.
name
===
extension
.
manifest
.
name
)
.
map
(
e
=>
this
.
checkForDependenciesAndUninstall
(
e
,
installed
,
force
));
return
TPromise
.
join
(
promises
).
then
(()
=>
null
,
error
=>
TPromise
.
wrapError
(
this
.
joinErrors
(
error
)));
});
})
)
;
}
updateMetadata
(
local
:
ILocalExtension
,
metadata
:
IGalleryMetadata
):
TPromise
<
ILocalExtension
>
{
...
...
@@ -667,9 +674,16 @@ export class ExtensionManagementService extends Disposable implements IExtension
}
private
uninstallExtension
(
local
:
ILocalExtension
):
TPromise
<
void
>
{
// Set all versions of the extension as uninstalled
return
this
.
scanUserExtensions
(
false
)
.
then
(
userExtensions
=>
this
.
setUninstalled
(...
userExtensions
.
filter
(
u
=>
areSameExtensions
({
id
:
getGalleryExtensionIdFromLocal
(
u
),
uuid
:
u
.
identifier
.
uuid
},
{
id
:
getGalleryExtensionIdFromLocal
(
local
),
uuid
:
local
.
identifier
.
uuid
}))));
const
id
=
getGalleryExtensionIdFromLocal
(
local
);
let
promise
=
this
.
uninstallingExtensions
.
get
(
id
);
if
(
!
promise
)
{
// Set all versions of the extension as uninstalled
promise
=
this
.
scanUserExtensions
(
false
)
.
then
(
userExtensions
=>
this
.
setUninstalled
(...
userExtensions
.
filter
(
u
=>
areSameExtensions
({
id
:
getGalleryExtensionIdFromLocal
(
u
),
uuid
:
u
.
identifier
.
uuid
},
{
id
,
uuid
:
local
.
identifier
.
uuid
}))))
.
then
(()
=>
{
this
.
uninstallingExtensions
.
delete
(
id
);
});
this
.
uninstallingExtensions
.
set
(
id
,
promise
);
}
return
promise
;
}
private
async
postUninstallExtension
(
extension
:
ILocalExtension
,
error
?:
Error
):
TPromise
<
void
>
{
...
...
@@ -863,6 +877,10 @@ export class ExtensionManagementService extends Disposable implements IExtension
});
}
private
toNonCancellablePromise
<
T
>
(
promise
:
TPromise
<
T
>
):
TPromise
<
T
>
{
return
new
TPromise
((
c
,
e
)
=>
promise
.
then
(
result
=>
c
(
result
),
error
=>
e
(
error
)),
()
=>
this
.
logService
.
debug
(
'
Request Cancelled
'
));
}
private
reportTelemetry
(
eventName
:
string
,
extensionData
:
any
,
duration
:
number
,
error
?:
Error
):
void
{
const
errorcode
=
error
?
error
instanceof
ExtensionManagementError
?
error
.
code
:
ERROR_UNKNOWN
:
void
0
;
/* __GDPR__
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录