Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
f9164af5
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,发现更多精彩内容 >>
提交
f9164af5
编写于
7月 15, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use product service
上级
aca71362
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
20 deletion
+18
-20
src/vs/workbench/contrib/extensions/node/extensionsWorkbenchService.ts
...nch/contrib/extensions/node/extensionsWorkbenchService.ts
+18
-20
未找到文件。
src/vs/workbench/contrib/extensions/node/extensionsWorkbenchService.ts
浏览文件 @
f9164af5
...
...
@@ -25,7 +25,6 @@ import { IExtension, ExtensionState, IExtensionsWorkbenchService, AutoUpdateConf
import
{
IEditorService
,
SIDE_GROUP
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IURLService
,
IURLHandler
}
from
'
vs/platform/url/common/url
'
;
import
{
ExtensionsInput
}
from
'
vs/workbench/contrib/extensions/common/extensionsInput
'
;
import
product
from
'
vs/platform/product/node/product
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IProgressService
,
ProgressLocation
}
from
'
vs/platform/progress/common/progress
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
...
...
@@ -35,6 +34,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IExtensionManifest
,
ExtensionType
,
IExtension
as
IPlatformExtension
,
isLanguagePackExtension
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IProductService
}
from
'
vs/platform/product/common/product
'
;
interface
IExtensionStateProvider
<
T
>
{
(
extension
:
Extension
):
T
;
...
...
@@ -45,14 +45,15 @@ class Extension implements IExtension {
public
enablementState
:
EnablementState
=
EnablementState
.
Enabled
;
constructor
(
private
galleryService
:
IExtensionGalleryService
,
private
stateProvider
:
IExtensionStateProvider
<
ExtensionState
>
,
public
readonly
server
:
IExtensionManagementServer
|
undefined
,
public
local
:
ILocalExtension
|
undefined
,
public
gallery
:
IGalleryExtension
|
undefined
,
private
telemetryService
:
ITelemetryService
,
private
logService
:
ILogService
,
private
fileService
:
IFileService
@
IExtensionGalleryService
private
readonly
galleryService
:
IExtensionGalleryService
,
@
ITelemetryService
private
readonly
telemetryService
:
ITelemetryService
,
@
ILogService
private
readonly
logService
:
ILogService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IProductService
private
readonly
productService
:
IProductService
)
{
}
get
type
():
ExtensionType
|
undefined
{
...
...
@@ -111,11 +112,11 @@ class Extension implements IExtension {
}
get
url
():
string
|
undefined
{
if
(
!
product
.
extensionsGallery
||
!
this
.
gallery
)
{
if
(
!
this
.
productService
.
extensionsGallery
||
!
this
.
gallery
)
{
return
undefined
;
}
return
`
${
product
.
extensionsGallery
.
itemUrl
}
?itemName=
${
this
.
publisher
}
.
${
this
.
name
}
`
;
return
`
${
this
.
productService
.
extensionsGallery
.
itemUrl
}
?itemName=
${
this
.
publisher
}
.
${
this
.
name
}
`
;
}
get
iconUrl
():
string
{
...
...
@@ -316,10 +317,8 @@ class Extensions extends Disposable {
private
readonly
server
:
IExtensionManagementServer
,
private
readonly
stateProvider
:
IExtensionStateProvider
<
ExtensionState
>
,
@
IExtensionGalleryService
private
readonly
galleryService
:
IExtensionGalleryService
,
@
ITelemetryService
private
readonly
telemetryService
:
ITelemetryService
,
@
ILogService
private
readonly
logService
:
ILogService
,
@
IFileService
private
readonly
fileService
:
IFileService
,
@
IExtensionEnablementService
private
readonly
extensionEnablementService
:
IExtensionEnablementService
@
IExtensionEnablementService
private
readonly
extensionEnablementService
:
IExtensionEnablementService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
)
{
super
();
this
.
_register
(
server
.
extensionManagementService
.
onInstallExtension
(
e
=>
this
.
onInstallExtension
(
e
)));
...
...
@@ -341,7 +340,7 @@ class Extensions extends Disposable {
const
installed
=
await
this
.
server
.
extensionManagementService
.
getInstalled
();
const
byId
=
index
(
this
.
installed
,
e
=>
e
.
local
?
e
.
local
.
identifier
.
id
:
e
.
identifier
.
id
);
this
.
installed
=
installed
.
map
(
local
=>
{
const
extension
=
byId
[
local
.
identifier
.
id
]
||
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
this
.
server
,
local
,
undefined
,
this
.
telemetryService
,
this
.
logService
,
this
.
fileService
);
const
extension
=
byId
[
local
.
identifier
.
id
]
||
this
.
instantiationService
.
createInstance
(
Extension
,
this
.
stateProvider
,
this
.
server
,
local
,
undefined
);
extension
.
local
=
local
;
extension
.
enablementState
=
this
.
extensionEnablementService
.
getEnablementState
(
local
);
return
extension
;
...
...
@@ -394,7 +393,7 @@ class Extensions extends Disposable {
const
{
gallery
}
=
event
;
if
(
gallery
)
{
const
extension
=
this
.
installed
.
filter
(
e
=>
areSameExtensions
(
e
.
identifier
,
gallery
.
identifier
))[
0
]
||
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
this
.
server
,
undefined
,
gallery
,
this
.
telemetryService
,
this
.
logService
,
this
.
fileService
);
||
this
.
instantiationService
.
createInstance
(
Extension
,
this
.
stateProvider
,
this
.
server
,
undefined
,
gallery
);
this
.
installing
.
push
(
extension
);
this
.
_onChange
.
fire
(
extension
);
}
...
...
@@ -405,7 +404,7 @@ class Extensions extends Disposable {
const
installingExtension
=
gallery
?
this
.
installing
.
filter
(
e
=>
areSameExtensions
(
e
.
identifier
,
gallery
.
identifier
))[
0
]
:
null
;
this
.
installing
=
installingExtension
?
this
.
installing
.
filter
(
e
=>
e
!==
installingExtension
)
:
this
.
installing
;
let
extension
:
Extension
|
undefined
=
installingExtension
?
installingExtension
:
zipPath
?
new
Extension
(
this
.
galleryService
,
this
.
stateProvider
,
this
.
server
,
local
,
undefined
,
this
.
telemetryService
,
this
.
logService
,
this
.
fileService
)
:
undefined
;
let
extension
:
Extension
|
undefined
=
installingExtension
?
installingExtension
:
zipPath
?
this
.
instantiationService
.
createInstance
(
Extension
,
this
.
stateProvider
,
this
.
server
,
local
,
undefined
)
:
undefined
;
if
(
extension
)
{
if
(
local
)
{
const
installed
=
this
.
installed
.
filter
(
e
=>
areSameExtensions
(
e
.
identifier
,
extension
!
.
identifier
))[
0
];
...
...
@@ -495,12 +494,11 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
@
IURLService
urlService
:
IURLService
,
@
IExtensionEnablementService
private
readonly
extensionEnablementService
:
IExtensionEnablementService
,
@
IWindowService
private
readonly
windowService
:
IWindowService
,
@
ILogService
private
readonly
logService
:
ILogService
,
@
IProgressService
private
readonly
progressService
:
IProgressService
,
@
IExtensionManagementServerService
private
readonly
extensionManagementServerService
:
IExtensionManagementServerService
,
@
IStorageService
private
readonly
storageService
:
IStorageService
,
@
I
FileService
private
readonly
fileService
:
IFil
eService
,
@
I
ModeService
private
readonly
modeService
:
IMode
Service
@
I
ModeService
private
readonly
modeService
:
IMod
eService
,
@
I
ProductService
private
readonly
productService
:
IProduct
Service
)
{
super
();
this
.
localExtensions
=
this
.
_register
(
instantiationService
.
createInstance
(
Extensions
,
extensionManagementServerService
.
localExtensionManagementServer
,
ext
=>
this
.
getExtensionState
(
ext
)));
...
...
@@ -605,7 +603,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
text
=
text
.
replace
(
extensionRegex
,
(
m
,
ext
)
=>
{
// Get curated keywords
const
lookup
=
product
.
extensionKeywords
||
{};
const
lookup
=
this
.
productService
.
extensionKeywords
||
{};
const
keywords
=
lookup
[
ext
]
||
[];
// Get mode name
...
...
@@ -648,7 +646,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
if
(
installed
)
{
return
installed
;
}
const
extension
=
new
Extension
(
this
.
galleryService
,
ext
=>
this
.
getExtensionState
(
ext
),
undefined
,
undefined
,
gallery
,
this
.
telemetryService
,
this
.
logService
,
this
.
fileService
);
const
extension
=
this
.
instantiationService
.
createInstance
(
Extension
,
ext
=>
this
.
getExtensionState
(
ext
),
undefined
,
undefined
,
gallery
);
if
(
maliciousExtensionSet
.
has
(
extension
.
identifier
.
id
))
{
extension
.
isMalicious
=
true
;
}
...
...
@@ -998,7 +996,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
get
allowedBadgeProviders
():
string
[]
{
if
(
!
this
.
_extensionAllowedBadgeProviders
)
{
this
.
_extensionAllowedBadgeProviders
=
(
product
.
extensionAllowedBadgeProviders
||
[]).
map
(
s
=>
s
.
toLowerCase
());
this
.
_extensionAllowedBadgeProviders
=
(
this
.
productService
.
extensionAllowedBadgeProviders
||
[]).
map
(
s
=>
s
.
toLowerCase
());
}
return
this
.
_extensionAllowedBadgeProviders
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录