Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ed7ba30c
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,发现更多精彩内容 >>
提交
ed7ba30c
编写于
8月 26, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extensions.autoUpdate
fixes #11021
上级
d2ba113b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
6 deletion
+40
-6
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
...ts/extensions/electron-browser/extensions.contribution.ts
+16
-0
src/vs/workbench/parts/extensions/electron-browser/extensions.ts
...workbench/parts/extensions/electron-browser/extensions.ts
+4
-0
src/vs/workbench/parts/extensions/electron-browser/extensionsWorkbenchService.ts
...extensions/electron-browser/extensionsWorkbenchService.ts
+20
-6
未找到文件。
src/vs/workbench/parts/extensions/electron-browser/extensions.contribution.ts
浏览文件 @
ed7ba30c
...
...
@@ -26,6 +26,7 @@ import { ExtensionsInput } from './extensionsInput';
import
{
ViewletRegistry
,
Extensions
as
ViewletExtensions
,
ViewletDescriptor
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
ExtensionEditor
}
from
'
./extensionEditor
'
;
import
{
IQuickOpenRegistry
,
Extensions
,
QuickOpenHandlerDescriptor
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
// Singletons
registerSingleton
(
IExtensionGalleryService
,
ExtensionGalleryService
);
...
...
@@ -107,3 +108,18 @@ actionRegistry.registerWorkbenchAction(popularActionDescriptor, `Extensions: ${
const
installedActionDescriptor
=
new
SyncActionDescriptor
(
ShowInstalledExtensionsAction
,
ShowInstalledExtensionsAction
.
ID
,
ShowInstalledExtensionsAction
.
LABEL
);
actionRegistry
.
registerWorkbenchAction
(
installedActionDescriptor
,
`Extensions:
${
ShowInstalledExtensionsAction
.
LABEL
}
`
,
ExtensionsLabel
);
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
)
.
registerConfiguration
({
id
:
'
extensions
'
,
order
:
30
,
title
:
localize
(
'
extensionsConfigurationTitle
'
,
"
Extensions
"
),
type
:
'
object
'
,
properties
:
{
'
extensions.autoUpdate
'
:
{
type
:
'
boolean
'
,
description
:
localize
(
'
extensionsAutoUpdate
'
,
"
Automatically update extensions
"
),
default
:
false
}
}
});
src/vs/workbench/parts/extensions/electron-browser/extensions.ts
浏览文件 @
ed7ba30c
...
...
@@ -57,4 +57,8 @@ export interface IExtensionsWorkbenchService {
canInstall
(
extension
:
IExtension
):
boolean
;
install
(
extension
:
IExtension
):
TPromise
<
void
>
;
uninstall
(
extension
:
IExtension
):
TPromise
<
void
>
;
}
export
interface
IExtensionsConfiguration
{
autoUpdate
:
boolean
;
}
\ No newline at end of file
src/vs/workbench/parts/extensions/electron-browser/extensionsWorkbenchService.ts
浏览文件 @
ed7ba30c
...
...
@@ -16,12 +16,15 @@ import { IPager, mapPager, singlePagePager } from 'vs/base/common/paging';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IExtensionManagementService
,
IExtensionGalleryService
,
ILocalExtension
,
IGalleryExtension
,
IQueryOptions
,
IExtensionManifest
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
getGalleryExtensionTelemetryData
,
getLocalExtensionTelemetryData
}
from
'
vs/platform/extensionManagement/common/extensionTelemetry
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
*
as
semver
from
'
semver
'
;
import
*
as
path
from
'
path
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
readFile
}
from
'
vs/base/node/pfs
'
;
import
{
asText
}
from
'
vs/base/node/request
'
;
import
{
IExtension
,
ExtensionState
,
IExtensionsWorkbenchService
}
from
'
./extensions
'
;
import
{
IExtension
,
ExtensionState
,
IExtensionsWorkbenchService
,
IExtensionsConfiguration
}
from
'
./extensions
'
;
import
{
UpdateAllAction
}
from
'
./extensionsActions
'
;
interface
IExtensionStateProvider
{
(
extension
:
Extension
):
ExtensionState
;
...
...
@@ -215,8 +218,10 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
get
onChange
():
Event
<
void
>
{
return
this
.
_onChange
.
event
;
}
constructor
(
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IExtensionManagementService
private
extensionService
:
IExtensionManagementService
,
@
IExtensionGalleryService
private
galleryService
:
IExtensionGalleryService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
)
{
this
.
stateProvider
=
ext
=>
this
.
getExtensionState
(
ext
);
...
...
@@ -228,7 +233,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
this
.
syncDelayer
=
new
ThrottledDelayer
<
void
>
(
ExtensionsWorkbenchService
.
SyncPeriod
);
this
.
queryLocal
().
done
(()
=>
this
.
s
yncWithGallery
(
true
));
this
.
queryLocal
().
done
(()
=>
this
.
eventuallyS
yncWithGallery
(
true
));
}
get
local
():
IExtension
[]
{
...
...
@@ -280,14 +285,14 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
null
,
gallery
);
}
private
s
yncWithGallery
(
immediate
=
false
):
void
{
const
loop
=
()
=>
this
.
doSyncWithGallery
().
then
(()
=>
this
.
s
yncWithGallery
());
private
eventuallyS
yncWithGallery
(
immediate
=
false
):
void
{
const
loop
=
()
=>
this
.
syncWithGallery
().
then
(()
=>
this
.
eventuallyS
yncWithGallery
());
const
delay
=
immediate
?
0
:
ExtensionsWorkbenchService
.
SyncPeriod
;
this
.
syncDelayer
.
trigger
(
loop
,
delay
);
}
private
doS
yncWithGallery
():
TPromise
<
void
>
{
private
s
yncWithGallery
():
TPromise
<
void
>
{
const
ids
=
this
.
installed
.
filter
(
e
=>
!!
(
e
.
local
&&
e
.
local
.
metadata
))
.
map
(
e
=>
e
.
local
.
metadata
.
id
);
...
...
@@ -296,7 +301,16 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return
TPromise
.
as
(
null
);
}
return
this
.
queryGallery
({
ids
,
pageSize
:
ids
.
length
})
as
TPromise
<
any
>
;
return
this
.
queryGallery
({
ids
,
pageSize
:
ids
.
length
}).
then
(()
=>
{
const
config
=
this
.
configurationService
.
getConfiguration
<
IExtensionsConfiguration
>
(
'
extensions
'
);
if
(
!
config
.
autoUpdate
)
{
return
;
}
const
action
=
this
.
instantiationService
.
createInstance
(
UpdateAllAction
);
return
action
.
enabled
&&
action
.
run
();
});
}
canInstall
(
extension
:
IExtension
):
boolean
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录