Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
f8968357
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,发现更多精彩内容 >>
提交
f8968357
编写于
9月 28, 2017
作者:
R
Ramya Achutha Rao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Shuffle extension recommendations a little
上级
c82799d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
18 deletion
+45
-18
src/vs/platform/extensionManagement/common/extensionManagement.ts
...latform/extensionManagement/common/extensionManagement.ts
+1
-1
src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts
...parts/extensions/electron-browser/extensionTipsService.ts
+22
-5
src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts
...ench/parts/extensions/electron-browser/extensionsViews.ts
+22
-12
未找到文件。
src/vs/platform/extensionManagement/common/extensionManagement.ts
浏览文件 @
f8968357
...
...
@@ -299,7 +299,7 @@ export const IExtensionTipsService = createDecorator<IExtensionTipsService>('ext
export
interface
IExtensionTipsService
{
_serviceBrand
:
any
;
getRecommendations
():
string
[];
getRecommendations
(
installedExtensions
:
string
[],
searchText
:
string
):
string
[];
getWorkspaceRecommendations
():
TPromise
<
string
[]
>
;
getKeymapRecommendations
():
string
[];
getKeywordsForExtension
(
extension
:
string
):
string
[];
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionTipsService.ts
浏览文件 @
f8968357
...
...
@@ -104,15 +104,32 @@ export class ExtensionTipsService implements IExtensionTipsService {
return
[];
}
getRecommendations
():
string
[]
{
getRecommendations
(
installedExtensions
:
string
[],
searchText
:
string
):
string
[]
{
const
allRecomendations
=
this
.
_getAllRecommendationsInProduct
();
const
fileBased
=
Object
.
keys
(
this
.
_fileBasedRecommendations
)
.
filter
(
recommendation
=>
allRecomendations
.
indexOf
(
recommendation
)
!==
-
1
)
.
sort
((
a
,
b
)
=>
{
.
filter
(
recommendation
=>
{
return
allRecomendations
.
indexOf
(
recommendation
)
>
-
1
&&
installedExtensions
.
indexOf
(
recommendation
)
===
-
1
&&
recommendation
.
toLowerCase
().
indexOf
(
searchText
)
>
-
1
;
}).
sort
((
a
,
b
)
=>
{
return
this
.
_fileBasedRecommendations
[
a
]
>
this
.
_fileBasedRecommendations
[
b
]
?
-
1
:
1
;
});
const
exeBased
=
distinct
(
this
.
_exeBasedRecommendations
);
const
exeBased
=
this
.
_exeBasedRecommendations
.
filter
((
recommendation
,
index
)
=>
{
return
this
.
_exeBasedRecommendations
.
indexOf
(
recommendation
)
===
index
&&
installedExtensions
.
indexOf
(
recommendation
)
===
-
1
&&
fileBased
.
indexOf
(
recommendation
)
===
-
1
&&
recommendation
.
toLowerCase
().
indexOf
(
searchText
)
>
-
1
;
});
// Sort recommendations such that few of the exeBased ones show up earliar
const
x
=
Math
.
min
(
6
,
fileBased
.
length
);
const
y
=
Math
.
min
(
4
,
exeBased
.
length
);
const
sortedRecommendations
=
fileBased
.
slice
(
0
,
x
);
sortedRecommendations
.
push
(...
exeBased
.
slice
(
0
,
y
));
sortedRecommendations
.
push
(...
fileBased
.
slice
(
x
));
sortedRecommendations
.
push
(...
exeBased
.
slice
(
y
));
/* __GDPR__
"extensionRecommendations:unfiltered" : {
...
...
@@ -122,7 +139,7 @@ export class ExtensionTipsService implements IExtensionTipsService {
*/
this
.
telemetryService
.
publicLog
(
'
extensionRecommendations:unfiltered
'
,
{
fileBased
,
exeBased
});
return
distinct
([...
fileBased
,
...
exeBased
])
;
return
sortedRecommendations
;
}
getKeymapRecommendations
():
string
[]
{
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsViews.ts
浏览文件 @
f8968357
...
...
@@ -9,7 +9,6 @@ import { localize } from 'vs/nls';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
chain
}
from
'
vs/base/common/event
'
;
import
{
isPromiseCanceledError
,
create
as
createError
}
from
'
vs/base/common/errors
'
;
import
Severity
from
'
vs/base/common/severity
'
;
...
...
@@ -277,11 +276,24 @@ export class ExtensionsListView extends ViewsViewletPanel {
return
this
.
extensionsWorkbenchService
.
queryLocal
()
.
then
(
result
=>
result
.
filter
(
e
=>
e
.
type
===
LocalExtensionType
.
User
))
.
then
(
local
=>
{
return
TPromise
.
join
([
TPromise
.
as
(
this
.
tipsService
.
getRecommendations
()),
this
.
tipsService
.
getWorkspaceRecommendations
()])
const
installedExtensions
=
local
.
map
(
x
=>
`
${
x
.
publisher
}
.
${
x
.
name
}
`
);
return
TPromise
.
join
([
TPromise
.
as
(
this
.
tipsService
.
getRecommendations
(
installedExtensions
,
value
)),
this
.
tipsService
.
getWorkspaceRecommendations
()])
.
then
(([
recommendations
,
workspaceRecommendations
])
=>
{
const
names
=
distinct
([...
recommendations
,
...
workspaceRecommendations
])
.
filter
(
name
=>
local
.
every
(
ext
=>
`
${
ext
.
publisher
}
.
${
ext
.
name
}
`
!==
name
))
.
filter
(
name
=>
name
.
toLowerCase
().
indexOf
(
value
)
>
-
1
);
workspaceRecommendations
=
workspaceRecommendations
.
filter
(
name
=>
{
return
recommendations
.
indexOf
(
name
)
===
-
1
&&
installedExtensions
.
indexOf
(
name
)
===
-
1
&&
name
.
toLowerCase
().
indexOf
(
value
)
>
-
1
;
});
// Sort recommendations such that few of the workspace ones show up earliar
const
x
=
Math
.
min
(
4
,
recommendations
.
length
);
const
y
=
Math
.
min
(
4
,
workspaceRecommendations
.
length
);
const
names
=
recommendations
.
slice
(
0
,
x
);
names
.
push
(...
workspaceRecommendations
.
slice
(
0
,
y
));
names
.
push
(...
recommendations
.
slice
(
x
));
names
.
push
(...
workspaceRecommendations
.
slice
(
y
));
this
.
telemetryService
.
publicLog
(
'
extensionAllRecommendations:open
'
,
{
count
:
names
.
length
});
if
(
!
names
.
length
)
{
...
...
@@ -303,9 +315,7 @@ export class ExtensionsListView extends ViewsViewletPanel {
return
this
.
extensionsWorkbenchService
.
queryLocal
()
.
then
(
result
=>
result
.
filter
(
e
=>
e
.
type
===
LocalExtensionType
.
User
))
.
then
(
local
=>
{
const
names
=
this
.
tipsService
.
getRecommendations
()
.
filter
(
name
=>
local
.
every
(
ext
=>
`
${
ext
.
publisher
}
.
${
ext
.
name
}
`
!==
name
))
.
filter
(
name
=>
name
.
toLowerCase
().
indexOf
(
value
)
>
-
1
);
const
names
=
this
.
tipsService
.
getRecommendations
(
local
.
map
(
x
=>
`
${
x
.
publisher
}
.
${
x
.
name
}
`
),
value
);
/* __GDPR__
"extensionRecommendations:open" : {
...
...
@@ -332,10 +342,10 @@ export class ExtensionsListView extends ViewsViewletPanel {
.
then
(
recommendations
=>
{
const
names
=
recommendations
.
filter
(
name
=>
name
.
toLowerCase
().
indexOf
(
value
)
>
-
1
);
/* __GDPR__
"extensionWorkspaceRecommendations:open" : {
"count" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
"extensionWorkspaceRecommendations:open" : {
"count" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
}
*/
this
.
telemetryService
.
publicLog
(
'
extensionWorkspaceRecommendations:open
'
,
{
count
:
names
.
length
});
if
(
!
names
.
length
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录