Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
49b4645a
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,发现更多精彩内容 >>
提交
49b4645a
编写于
9月 20, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ext tips service: use choice service
上级
698db92c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
30 deletion
+44
-30
src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts
...parts/extensions/electron-browser/extensionTipsService.ts
+44
-30
未找到文件。
src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts
浏览文件 @
49b4645a
...
...
@@ -3,23 +3,22 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
URI
from
'
vs/base/common/uri
'
;
import
{
localize
}
from
'
vs/nls
'
;
import
{
forEach
}
from
'
vs/base/common/collections
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TPromise
as
Promise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
match
}
from
'
vs/base/common/glob
'
;
import
{
IExtensionManagementService
,
IExtensionGalleryService
,
IExtensionTipsService
,
LocalExtensionType
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
IExtensionsConfiguration
,
ConfigurationKey
}
from
'
./extensions
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
product
from
'
vs/platform/product
'
;
import
{
IMessageService
,
CloseAction
}
from
'
vs/platform/message/common/message
'
;
import
{
IChoiceService
}
from
'
vs/platform/message/common/message
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ShowRecommendedExtensionsAction
,
ShowWorkspaceRecommendedExtensionsAction
}
from
'
./extensionsActions
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
export
class
ExtensionTipsService
implements
IExtensionTipsService
{
...
...
@@ -35,7 +34,7 @@ export class ExtensionTipsService implements IExtensionTipsService {
@
IExtensionGalleryService
private
_galleryService
:
IExtensionGalleryService
,
@
IModelService
private
_modelService
:
IModelService
,
@
IStorageService
private
storageService
:
IStorageService
,
@
I
MessageService
private
messageService
:
IMessag
eService
,
@
I
ChoiceService
private
choiceService
:
IChoic
eService
,
@
IExtensionManagementService
private
extensionsService
:
IExtensionManagementService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
...
...
@@ -83,15 +82,21 @@ export class ExtensionTipsService implements IExtensionTipsService {
}
});
this
.
_
disposables
.
push
(
this
.
_modelService
.
onModelAdded
(
model
=>
this
.
_suggest
(
model
.
uri
))
);
this
.
_modelService
.
getModels
().
forEach
(
model
=>
this
.
_suggest
(
model
.
uri
));
this
.
_
modelService
.
onModelAdded
(
this
.
_suggest
,
this
,
this
.
_disposables
);
this
.
_modelService
.
getModels
().
forEach
(
model
=>
this
.
_suggest
(
model
));
}
private
_suggest
(
uri
:
URI
):
Promise
<
any
>
{
private
_suggest
(
model
:
IModel
):
void
{
const
uri
=
model
.
uri
;
if
(
!
uri
)
{
return
;
}
if
(
uri
.
scheme
===
Schemas
.
inMemory
||
uri
.
scheme
===
Schemas
.
internal
||
uri
.
scheme
===
Schemas
.
vscode
)
{
return
;
}
// re-schedule this bit of the operation to be off
// the critical path - in case glob-match is slow
setImmediate
(()
=>
{
...
...
@@ -123,20 +128,25 @@ export class ExtensionTipsService implements IExtensionTipsService {
}
const
message
=
localize
(
'
reallyRecommended
'
,
"
It is recommended to install the '{0}' extension.
"
,
id
);
const
neverAgainAction
=
new
Action
(
'
neverShowAgain
'
,
localize
(
'
neverShowAgain
'
,
"
Don't show again
"
),
null
,
true
,
()
=>
{
this
.
importantRecommendationsIgnoreList
.
push
(
id
);
this
.
storageService
.
store
(
'
extensionsAssistant/importantRecommendationsIgnore
'
,
JSON
.
stringify
(
this
.
importantRecommendationsIgnoreList
),
StorageScope
.
GLOBAL
);
return
Promise
.
as
(
true
);
});
const
recommendationsAction
=
this
.
instantiationService
.
createInstance
(
ShowRecommendedExtensionsAction
,
ShowRecommendedExtensionsAction
.
ID
,
localize
(
'
showRecommendations
'
,
"
Show Recommendations
"
));
this
.
messageService
.
show
(
Severity
.
Info
,
{
message
,
actions
:
[
recommendationsAction
,
neverAgainAction
,
CloseAction
]
const
options
=
[
recommendationsAction
.
label
,
localize
(
'
neverShowAgain
'
,
"
Don't show again
"
),
localize
(
'
close
'
,
"
Close
"
)
];
this
.
choiceService
.
choose
(
Severity
.
Info
,
message
,
options
).
done
(
choice
=>
{
switch
(
choice
)
{
case
0
:
return
recommendationsAction
.
run
();
case
1
:
this
.
importantRecommendationsIgnoreList
.
push
(
id
);
return
this
.
storageService
.
store
(
'
extensionsAssistant/importantRecommendationsIgnore
'
,
JSON
.
stringify
(
this
.
importantRecommendationsIgnoreList
),
StorageScope
.
GLOBAL
);
}
});
});
});
...
...
@@ -165,15 +175,19 @@ export class ExtensionTipsService implements IExtensionTipsService {
}
const
message
=
localize
(
'
workspaceRecommended
'
,
"
This workspace has extension recommendations.
"
);
const
neverAgainAction
=
new
Action
(
'
neverShowAgain
'
,
localize
(
'
neverShowAgain
'
,
"
Don't show again
"
),
null
,
true
,
()
=>
{
this
.
storageService
.
store
(
storageKey
,
true
,
StorageScope
.
WORKSPACE
);
return
Promise
.
as
(
true
);
});
const
recommendationsAction
=
this
.
instantiationService
.
createInstance
(
ShowWorkspaceRecommendedExtensionsAction
,
ShowWorkspaceRecommendedExtensionsAction
.
ID
,
localize
(
'
showRecommendations
'
,
"
Show Recommendations
"
));
this
.
messageService
.
show
(
Severity
.
Info
,
{
message
,
actions
:
[
recommendationsAction
,
neverAgainAction
,
CloseAction
]
const
action
=
this
.
instantiationService
.
createInstance
(
ShowWorkspaceRecommendedExtensionsAction
,
ShowWorkspaceRecommendedExtensionsAction
.
ID
,
localize
(
'
showRecommendations
'
,
"
Show Recommendations
"
));
const
options
=
[
action
.
label
,
localize
(
'
neverShowAgain
'
,
"
Don't show again
"
),
localize
(
'
close
'
,
"
Close
"
)
];
this
.
choiceService
.
choose
(
Severity
.
Info
,
message
,
options
).
done
(
choice
=>
{
switch
(
choice
)
{
case
0
:
return
action
.
run
();
case
1
:
return
this
.
storageService
.
store
(
storageKey
,
true
,
StorageScope
.
WORKSPACE
);
}
});
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录