feat:添加在线插件搜索显示的策略,支持网络地址和product.json配置。
1.product.json中添加extensionsControlManifest字段,使用本地数据. 2.extensionsControlManifest下面配置: malicious:此插件不再被维护且已弃用。无可替代的插件。 search:搜索优先显示列表。 deprecated:此插件已被弃用。提示可替代的插件。 migrateToPreRelease:迁移到预发布版。 3.插件搜索显示列表中弃用的插件不能够安装。 4.插件搜索关键字时,优先显示kylinIdeTeam开发的插件。
This commit is contained in:
parent
849aa5cead
commit
0df555cac4
|
@ -54,6 +54,31 @@ export type ExtensionVirtualWorkspaceSupport = {
|
|||
readonly override?: boolean;
|
||||
};
|
||||
|
||||
|
||||
export interface ISearchPrefferedResults {
|
||||
readonly query?: string;
|
||||
readonly preferredResults?: string[];
|
||||
}
|
||||
|
||||
export interface IExtensionsControlManifest {
|
||||
malicious: string[];
|
||||
migrateToPreRelease?: IStringDictionary<{
|
||||
id: string;
|
||||
displayName: string;
|
||||
migrateStorage?: boolean;
|
||||
engine?: string;
|
||||
}>;
|
||||
deprecated?: IStringDictionary<boolean | {
|
||||
disallowInstall?: boolean;
|
||||
extension?: {
|
||||
id: string;
|
||||
displayName: string;
|
||||
};
|
||||
settings?: string[];
|
||||
}>;
|
||||
search?: ISearchPrefferedResults[];
|
||||
}
|
||||
|
||||
export interface IProductConfiguration {
|
||||
readonly IDEVersion: string;
|
||||
readonly version: string;
|
||||
|
@ -191,6 +216,7 @@ export interface IProductConfiguration {
|
|||
readonly commonlyUsedSettings?: string[];
|
||||
readonly aiGeneratedWorkspaceTrust?: IAiGeneratedWorkspaceTrust;
|
||||
readonly gitHubEntitlement?: IGitHubEntitlement;
|
||||
readonly extensionsControlManifest: IExtensionsControlManifest;
|
||||
}
|
||||
|
||||
export interface ITunnelApplicationConfig {
|
||||
|
|
|
@ -1215,21 +1215,8 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
|
|||
return engine;
|
||||
}
|
||||
|
||||
async getExtensionsControlManifest(): Promise<IExtensionsControlManifest> {
|
||||
if (!this.isEnabled()) {
|
||||
throw new Error('No extension gallery service configured.');
|
||||
}
|
||||
async getExtensionsControlManifest1(result: IRawExtensionsControlManifest | null): Promise<IExtensionsControlManifest> {
|
||||
|
||||
if (!this.extensionsControlUrl) {
|
||||
return { malicious: [], deprecated: {}, search: [] };
|
||||
}
|
||||
|
||||
const context = await this.requestService.request({ type: 'GET', url: this.extensionsControlUrl }, CancellationToken.None);
|
||||
if (context.res.statusCode !== 200) {
|
||||
throw new Error('Could not get extensions report.');
|
||||
}
|
||||
|
||||
const result = await asJson<IRawExtensionsControlManifest>(context);
|
||||
const malicious: IExtensionIdentifier[] = [];
|
||||
const deprecated: IStringDictionary<IDeprecationInfo> = {};
|
||||
const search: ISearchPrefferedResults[] = [];
|
||||
|
@ -1268,6 +1255,24 @@ abstract class AbstractExtensionGalleryService implements IExtensionGalleryServi
|
|||
|
||||
return { malicious, deprecated, search };
|
||||
}
|
||||
async getExtensionsControlManifest(): Promise<IExtensionsControlManifest> {
|
||||
if (!this.isEnabled()) {
|
||||
throw new Error('No extension gallery service configured.');
|
||||
}
|
||||
|
||||
if (!this.extensionsControlUrl) {
|
||||
let result: IRawExtensionsControlManifest = this.productService.extensionsControlManifest;
|
||||
return this.getExtensionsControlManifest1(result);
|
||||
}
|
||||
|
||||
const context = await this.requestService.request({ type: 'GET', url: this.extensionsControlUrl }, CancellationToken.None);
|
||||
if (context.res.statusCode !== 200) {
|
||||
throw new Error('Could not get extensions report.');
|
||||
}
|
||||
|
||||
const result = await asJson<IRawExtensionsControlManifest>(context);
|
||||
return this.getExtensionsControlManifest1(result);
|
||||
}
|
||||
}
|
||||
|
||||
export class ExtensionGalleryService extends AbstractExtensionGalleryService {
|
||||
|
|
|
@ -302,6 +302,11 @@ export interface ISearchPrefferedResults {
|
|||
readonly preferredResults?: string[];
|
||||
}
|
||||
|
||||
export interface ISearchPrefferedResults {
|
||||
readonly query?: string;
|
||||
readonly preferredResults?: string[];
|
||||
}
|
||||
|
||||
export interface IExtensionsControlManifest {
|
||||
readonly malicious: IExtensionIdentifier[];
|
||||
readonly deprecated: IStringDictionary<IDeprecationInfo>;
|
||||
|
|
Loading…
Reference in New Issue