Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f13c7359
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,发现更多精彩内容 >>
提交
f13c7359
编写于
8月 06, 2020
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #104064
上级
1b60d5b2
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
85 addition
and
19 deletion
+85
-19
src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.ts
.../contrib/extensions/browser/configBasedRecommendations.ts
+9
-3
src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.ts
...nch/contrib/extensions/browser/exeBasedRecommendations.ts
+25
-5
src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.ts
...rib/extensions/browser/extensionRecommendationsService.ts
+22
-2
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
...s/workbench/contrib/extensions/browser/extensionsViews.ts
+20
-9
src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.ts
...ch/contrib/extensions/browser/fileBasedRecommendations.ts
+8
-0
src/vs/workbench/services/extensionManagement/common/extensionManagement.ts
...ervices/extensionManagement/common/extensionManagement.ts
+1
-0
未找到文件。
src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.ts
浏览文件 @
f13c7359
...
...
@@ -21,8 +21,13 @@ export class ConfigBasedRecommendations extends ExtensionRecommendations {
private
importantTips
:
IConfigBasedExtensionTip
[]
=
[];
private
otherTips
:
IConfigBasedExtensionTip
[]
=
[];
private
_recommendations
:
ExtensionRecommendation
[]
=
[];
get
recommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
_recommendations
;
}
private
_otherRecommendations
:
ExtensionRecommendation
[]
=
[];
get
otherRecommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
_otherRecommendations
;
}
private
_importantRecommendations
:
ExtensionRecommendation
[]
=
[];
get
importantRecommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
_importantRecommendations
;
}
get
recommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
[...
this
.
importantRecommendations
,
...
this
.
otherRecommendations
];
}
constructor
(
isExtensionAllowedToBeRecommended
:
(
extensionId
:
string
)
=>
boolean
,
...
...
@@ -61,7 +66,8 @@ export class ConfigBasedRecommendations extends ExtensionRecommendations {
}
this
.
importantTips
=
[...
importantTips
.
values
()];
this
.
otherTips
=
[...
otherTips
.
values
()].
filter
(
tip
=>
!
importantTips
.
has
(
tip
.
extensionId
));
this
.
_recommendations
=
[...
this
.
importantTips
,
...
this
.
otherTips
].
map
(
tip
=>
this
.
toExtensionRecommendation
(
tip
));
this
.
_otherRecommendations
=
this
.
otherTips
.
map
(
tip
=>
this
.
toExtensionRecommendation
(
tip
));
this
.
_importantRecommendations
=
this
.
importantTips
.
map
(
tip
=>
this
.
toExtensionRecommendation
(
tip
));
}
private
async
promptWorkspaceRecommendations
():
Promise
<
void
>
{
...
...
src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.ts
浏览文件 @
f13c7359
...
...
@@ -25,8 +25,14 @@ type ExeExtensionRecommendationsClassification = {
export
class
ExeBasedRecommendations
extends
ExtensionRecommendations
{
readonly
_recommendations
:
ExtensionRecommendation
[]
=
[];
get
recommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
_recommendations
;
}
private
readonly
_otherRecommendations
:
ExtensionRecommendation
[]
=
[];
get
otherRecommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
_otherRecommendations
;
}
private
readonly
_importantRecommendations
:
ExtensionRecommendation
[]
=
[];
get
importantRecommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
_importantRecommendations
;
}
get
recommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
[...
this
.
importantRecommendations
,
...
this
.
otherRecommendations
];
}
private
readonly
tasExperimentService
:
ITASExperimentService
|
undefined
;
...
...
@@ -54,16 +60,30 @@ export class ExeBasedRecommendations extends ExtensionRecommendations {
protected
async
doActivate
():
Promise
<
void
>
{
const
otherExectuableBasedTips
=
await
this
.
extensionTipsService
.
getOtherExecutableBasedTips
();
otherExectuableBasedTips
.
forEach
(
tip
=>
this
.
_recommendations
.
push
(
this
.
toExtensionRecommendation
(
tip
)));
otherExectuableBasedTips
.
forEach
(
tip
=>
this
.
_otherRecommendations
.
push
(
this
.
toExtensionRecommendation
(
tip
)));
await
this
.
fetchImportantExeBasedRecommendations
();
}
private
async
fetchAndPromptImportantExeBasedRecommendations
():
Promise
<
void
>
{
private
_importantExeBasedRecommendations
:
Promise
<
IStringDictionary
<
IExecutableBasedExtensionTip
>>
|
undefined
;
private
async
fetchImportantExeBasedRecommendations
():
Promise
<
IStringDictionary
<
IExecutableBasedExtensionTip
>>
{
if
(
!
this
.
_importantExeBasedRecommendations
)
{
this
.
_importantExeBasedRecommendations
=
this
.
doFetchImportantExeBasedRecommendations
();
}
return
this
.
_importantExeBasedRecommendations
;
}
private
async
doFetchImportantExeBasedRecommendations
():
Promise
<
IStringDictionary
<
IExecutableBasedExtensionTip
>>
{
const
importantExeBasedRecommendations
:
IStringDictionary
<
IExecutableBasedExtensionTip
>
=
{};
const
importantExectuableBasedTips
=
await
this
.
extensionTipsService
.
getImportantExecutableBasedTips
();
importantExectuableBasedTips
.
forEach
(
tip
=>
{
this
.
_
r
ecommendations
.
push
(
this
.
toExtensionRecommendation
(
tip
));
this
.
_
importantR
ecommendations
.
push
(
this
.
toExtensionRecommendation
(
tip
));
importantExeBasedRecommendations
[
tip
.
extensionId
.
toLowerCase
()]
=
tip
;
});
return
importantExeBasedRecommendations
;
}
private
async
fetchAndPromptImportantExeBasedRecommendations
():
Promise
<
void
>
{
const
importantExeBasedRecommendations
=
await
this
.
fetchImportantExeBasedRecommendations
();
const
local
=
await
this
.
extensionManagementService
.
getInstalled
();
const
{
installed
,
uninstalled
}
=
this
.
groupByInstalled
(
Object
.
keys
(
importantExeBasedRecommendations
),
local
);
...
...
src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.ts
浏览文件 @
f13c7359
...
...
@@ -142,8 +142,8 @@ export class ExtensionRecommendationsService extends Disposable implements IExte
await
this
.
activateProactiveRecommendations
();
const
recommendations
=
[
...
this
.
configBasedRecommendations
.
r
ecommendations
,
...
this
.
exeBasedRecommendations
.
r
ecommendations
,
...
this
.
configBasedRecommendations
.
otherR
ecommendations
,
...
this
.
exeBasedRecommendations
.
otherR
ecommendations
,
...
this
.
dynamicWorkspaceRecommendations
.
recommendations
,
...
this
.
experimentalRecommendations
.
recommendations
];
...
...
@@ -159,6 +159,26 @@ export class ExtensionRecommendationsService extends Disposable implements IExte
});
}
async
getImportantRecommendations
():
Promise
<
IExtensionRecommendation
[]
>
{
await
this
.
activateProactiveRecommendations
();
const
recommendations
=
[
...
this
.
fileBasedRecommendations
.
importantRecommendations
,
...
this
.
configBasedRecommendations
.
importantRecommendations
,
...
this
.
exeBasedRecommendations
.
importantRecommendations
,
];
const
extensionIds
=
distinct
(
recommendations
.
map
(
e
=>
e
.
extensionId
))
.
filter
(
extensionId
=>
this
.
isExtensionAllowedToBeRecommended
(
extensionId
));
shuffle
(
extensionIds
,
this
.
sessionSeed
);
return
extensionIds
.
map
(
extensionId
=>
{
const
sources
:
ExtensionRecommendationSource
[]
=
distinct
(
recommendations
.
filter
(
r
=>
r
.
extensionId
===
extensionId
).
map
(
r
=>
r
.
source
));
return
(
<
IExtensionRecommendation
>
{
extensionId
,
sources
});
});
}
getKeymapRecommendations
():
IExtensionRecommendation
[]
{
return
this
.
toExtensionRecommendations
(
this
.
keymapRecommendations
.
recommendations
);
}
...
...
src/vs/workbench/contrib/extensions/browser/extensionsViews.ts
浏览文件 @
f13c7359
...
...
@@ -551,10 +551,11 @@ export class ExtensionsListView extends ViewPane {
const
configBasedRecommendationsPromise
=
this
.
tipsService
.
getConfigBasedRecommendations
();
const
othersPromise
=
this
.
tipsService
.
getOtherRecommendations
();
const
workspacePromise
=
this
.
tipsService
.
getWorkspaceRecommendations
();
const
importantRecommendationsPromise
=
this
.
tipsService
.
getImportantRecommendations
();
return
Promise
.
all
([
othersPromise
,
workspacePromise
,
configBasedRecommendationsPromise
])
.
then
(([
others
,
workspaceRecommendations
,
configBasedRecommendations
])
=>
{
const
names
=
this
.
getTrimmedRecommendations
(
local
,
value
,
fileBasedRecommendations
,
configBasedRecommendations
,
others
,
workspaceRecommendations
);
return
Promise
.
all
([
othersPromise
,
workspacePromise
,
configBasedRecommendationsPromise
,
importantRecommendationsPromise
])
.
then
(([
others
,
workspaceRecommendations
,
configBasedRecommendations
,
importantRecommendations
])
=>
{
const
names
=
this
.
getTrimmedRecommendations
(
local
,
value
,
importantRecommendations
,
fileBasedRecommendations
,
configBasedRecommendations
,
others
,
workspaceRecommendations
);
const
recommendationsWithReason
=
this
.
tipsService
.
getAllRecommendationsWithReason
();
/* __GDPR__
"extensionAllRecommendations:open" : {
...
...
@@ -607,14 +608,15 @@ export class ExtensionsListView extends ViewPane {
const
configBasedRecommendationsPromise
=
this
.
tipsService
.
getConfigBasedRecommendations
();
const
othersPromise
=
this
.
tipsService
.
getOtherRecommendations
();
const
workspacePromise
=
this
.
tipsService
.
getWorkspaceRecommendations
();
const
importantRecommendationsPromise
=
this
.
tipsService
.
getImportantRecommendations
();
return
Promise
.
all
([
othersPromise
,
workspacePromise
,
configBasedRecommendationsPromise
])
.
then
(([
others
,
workspaceRecommendations
,
configBasedRecommendations
])
=>
{
return
Promise
.
all
([
othersPromise
,
workspacePromise
,
configBasedRecommendationsPromise
,
importantRecommendationsPromise
])
.
then
(([
others
,
workspaceRecommendations
,
configBasedRecommendations
,
importantRecommendations
])
=>
{
configBasedRecommendations
=
configBasedRecommendations
.
filter
(
x
=>
workspaceRecommendations
.
every
(({
extensionId
})
=>
x
.
extensionId
!==
extensionId
));
fileBasedRecommendations
=
fileBasedRecommendations
.
filter
(
x
=>
workspaceRecommendations
.
every
(({
extensionId
})
=>
x
.
extensionId
!==
extensionId
));
others
=
others
.
filter
(
x
=>
workspaceRecommendations
.
every
(({
extensionId
})
=>
x
.
extensionId
!==
extensionId
));
const
names
=
this
.
getTrimmedRecommendations
(
local
,
value
,
fileBasedRecommendations
,
configBasedRecommendations
,
others
,
[]);
const
names
=
this
.
getTrimmedRecommendations
(
local
,
value
,
importantRecommendations
,
fileBasedRecommendations
,
configBasedRecommendations
,
others
,
[]);
const
recommendationsWithReason
=
this
.
tipsService
.
getAllRecommendationsWithReason
();
/* __GDPR__
...
...
@@ -647,22 +649,30 @@ export class ExtensionsListView extends ViewPane {
}
// Given all recommendations, trims and returns recommendations in the relevant order after filtering out installed extensions
private
getTrimmedRecommendations
(
installedExtensions
:
IExtension
[],
value
:
string
,
fileBasedRecommendations
:
IExtensionRecommendation
[],
configBasedRecommendations
:
IExtensionRecommendation
[],
otherRecommendations
:
IExtensionRecommendation
[],
workspaceRecommendations
:
IExtensionRecommendation
[]):
string
[]
{
private
getTrimmedRecommendations
(
installedExtensions
:
IExtension
[],
value
:
string
,
importantRecommendations
:
IExtensionRecommendation
[],
fileBasedRecommendations
:
IExtensionRecommendation
[],
configBasedRecommendations
:
IExtensionRecommendation
[],
otherRecommendations
:
IExtensionRecommendation
[],
workspaceRecommendations
:
IExtensionRecommendation
[]):
string
[]
{
const
totalCount
=
10
;
workspaceRecommendations
=
workspaceRecommendations
.
filter
(
recommendation
=>
{
return
!
this
.
isRecommendationInstalled
(
recommendation
,
installedExtensions
)
&&
recommendation
.
extensionId
.
toLowerCase
().
indexOf
(
value
)
>
-
1
;
});
importantRecommendations
=
importantRecommendations
.
filter
(
recommendation
=>
{
return
!
this
.
isRecommendationInstalled
(
recommendation
,
installedExtensions
)
&&
workspaceRecommendations
.
every
(
workspaceRecommendation
=>
workspaceRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
recommendation
.
extensionId
.
toLowerCase
().
indexOf
(
value
)
>
-
1
;
});
configBasedRecommendations
=
configBasedRecommendations
.
filter
(
recommendation
=>
{
return
!
this
.
isRecommendationInstalled
(
recommendation
,
installedExtensions
)
&&
workspaceRecommendations
.
every
(
workspaceRecommendation
=>
workspaceRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
importantRecommendations
.
every
(
importantRecommendation
=>
importantRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
recommendation
.
extensionId
.
toLowerCase
().
indexOf
(
value
)
>
-
1
;
});
fileBasedRecommendations
=
fileBasedRecommendations
.
filter
(
recommendation
=>
{
return
!
this
.
isRecommendationInstalled
(
recommendation
,
installedExtensions
)
&&
workspaceRecommendations
.
every
(
workspaceRecommendation
=>
workspaceRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
importantRecommendations
.
every
(
importantRecommendation
=>
importantRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
configBasedRecommendations
.
every
(
configBasedRecommendation
=>
configBasedRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
recommendation
.
extensionId
.
toLowerCase
().
indexOf
(
value
)
>
-
1
;
});
...
...
@@ -670,13 +680,14 @@ export class ExtensionsListView extends ViewPane {
return
!
this
.
isRecommendationInstalled
(
recommendation
,
installedExtensions
)
&&
fileBasedRecommendations
.
every
(
fileBasedRecommendation
=>
fileBasedRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
workspaceRecommendations
.
every
(
workspaceRecommendation
=>
workspaceRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
importantRecommendations
.
every
(
importantRecommendation
=>
importantRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
configBasedRecommendations
.
every
(
configBasedRecommendation
=>
configBasedRecommendation
.
extensionId
!==
recommendation
.
extensionId
)
&&
recommendation
.
extensionId
.
toLowerCase
().
indexOf
(
value
)
>
-
1
;
});
const
otherCount
=
Math
.
min
(
2
,
otherRecommendations
.
length
);
const
fileBasedCount
=
Math
.
min
(
fileBasedRecommendations
.
length
,
totalCount
-
workspaceRecommendations
.
length
-
configBasedRecommendations
.
length
-
otherCount
);
const
recommendations
=
[...
workspaceRecommendations
,
...
configBasedRecommendations
];
const
fileBasedCount
=
Math
.
min
(
fileBasedRecommendations
.
length
,
totalCount
-
workspaceRecommendations
.
length
-
importantRecommendations
.
length
-
configBasedRecommendations
.
length
-
otherCount
);
const
recommendations
=
[...
workspaceRecommendations
,
...
importantRecommendations
,
...
configBasedRecommendations
];
recommendations
.
push
(...
fileBasedRecommendations
.
splice
(
0
,
fileBasedCount
));
recommendations
.
push
(...
otherRecommendations
.
splice
(
0
,
otherCount
));
...
...
src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.ts
浏览文件 @
f13c7359
...
...
@@ -75,6 +75,14 @@ export class FileBasedRecommendations extends ExtensionRecommendations {
return
recommendations
;
}
get
importantRecommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
recommendations
.
filter
(
e
=>
this
.
importantExtensionTips
[
e
.
extensionId
]);
}
get
otherRecommendations
():
ReadonlyArray
<
ExtensionRecommendation
>
{
return
this
.
recommendations
.
filter
(
e
=>
!
this
.
importantExtensionTips
[
e
.
extensionId
]);
}
constructor
(
isExtensionAllowedToBeRecommended
:
(
extensionId
:
string
)
=>
boolean
,
@
IExtensionManagementService
private
readonly
extensionManagementService
:
IExtensionManagementService
,
...
...
src/vs/workbench/services/extensionManagement/common/extensionManagement.ts
浏览文件 @
f13c7359
...
...
@@ -128,6 +128,7 @@ export interface IExtensionRecommendationsService {
getAllRecommendationsWithReason
():
IStringDictionary
<
IExtensionRecommendationReson
>
;
getFileBasedRecommendations
():
IExtensionRecommendation
[];
getImportantRecommendations
():
Promise
<
IExtensionRecommendation
[]
>
;
getConfigBasedRecommendations
():
Promise
<
IExtensionRecommendation
[]
>
;
getOtherRecommendations
():
Promise
<
IExtensionRecommendation
[]
>
;
getWorkspaceRecommendations
():
Promise
<
IExtensionRecommendation
[]
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录