forked from openkylin/kylin-code
update extensions metadata,delay notification prompt.
This commit is contained in:
parent
1bc97780c1
commit
ab3e1d16e5
|
@ -5892,7 +5892,8 @@
|
||||||
"not found": "无法安装插件“{0}”,因为找不到请求的版本“{1}”。",
|
"not found": "无法安装插件“{0}”,因为找不到请求的版本“{1}”。",
|
||||||
"singleDependentError": "无法单独禁用 \"{0}\" 插件。\"{1}\" 插件依赖于此插件。要禁用所有这些插件吗?",
|
"singleDependentError": "无法单独禁用 \"{0}\" 插件。\"{1}\" 插件依赖于此插件。要禁用所有这些插件吗?",
|
||||||
"twoDependentsError": "无法单独禁用 \"{0}\" 插件。\"{1}\" 和 \"{2}\" 插件依赖于此插件。要禁用所有这些插件吗?",
|
"twoDependentsError": "无法单独禁用 \"{0}\" 插件。\"{1}\" 和 \"{2}\" 插件依赖于此插件。要禁用所有这些插件吗?",
|
||||||
"uninstallingExtension": "正在卸载插件..."
|
"uninstallingExtension": "正在卸载插件...",
|
||||||
|
"changedServiceUrlError": "网络请求错误,请检查网络或者配置的插件商店地址是否正确。"
|
||||||
},
|
},
|
||||||
"vs/workbench/contrib/extensions/browser/fileBasedRecommendations": {
|
"vs/workbench/contrib/extensions/browser/fileBasedRecommendations": {
|
||||||
"dontShowAgainExtension": "不再对“.{0}”文件显示",
|
"dontShowAgainExtension": "不再对“.{0}”文件显示",
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||||
import { IExtensionsGalleryConfiguration } from 'vs/platform/extensionsGallery/common/extensionsGallery.config.contribution';
|
import { IExtensionsGalleryConfiguration } from 'vs/platform/extensionsGallery/common/extensionsGallery.config.contribution';
|
||||||
import { IExtensionsGalleryConfigService } from 'vs/platform/extensionsGallery/common/extensionsGalleryConfigService';
|
import { IExtensionsGalleryConfigService } from 'vs/platform/extensionsGallery/common/extensionsGalleryConfigService';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
import { debounce } from 'vs/base/common/decorators';
|
||||||
// import { IHostService } from 'vs/workbench/services/host/browser/host';
|
// import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||||
|
|
||||||
export class ExtensionsGalleryConfigService implements IExtensionsGalleryConfigService {
|
export class ExtensionsGalleryConfigService implements IExtensionsGalleryConfigService {
|
||||||
|
@ -59,29 +60,37 @@ export class ExtensionsGalleryConfigService implements IExtensionsGalleryConfigS
|
||||||
// this._itemUrl = extensionsGalleryConfig.itemUrl;
|
// this._itemUrl = extensionsGalleryConfig.itemUrl;
|
||||||
this._onConfigChange.fire(this._serviceUrl ? this._serviceUrl : '');
|
this._onConfigChange.fire(this._serviceUrl ? this._serviceUrl : '');
|
||||||
|
|
||||||
this.notificationService.info(localize('galleryConfigChanged', "Extensions Gallery Config Changed"));
|
this.showMessage();
|
||||||
|
|
||||||
// this.notificationService.prompt(
|
|
||||||
// Severity.Info,
|
|
||||||
// "changed testing",
|
|
||||||
// [
|
|
||||||
// {
|
|
||||||
// label: isWeb ? localize('reload', "Reload") : localize('restart', "Restart"),
|
|
||||||
// run: () => this.hostService.restart()
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
// );
|
|
||||||
|
|
||||||
// this.notificationService.notify({
|
|
||||||
// severity: Severity.Info,
|
|
||||||
// message: "satest",
|
|
||||||
// actions: {
|
|
||||||
// primary: [
|
|
||||||
// new Action('Restart', isWeb ? localize('reload', "Reload") : localize('restart', "Restart"), undefined, true, () => this.hostService.restart())
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//notification
|
||||||
|
@debounce(2000)
|
||||||
|
showMessage() {
|
||||||
|
this.notificationService.info(localize('galleryConfigChanged', "Extensions Gallery Config Changed"));
|
||||||
|
|
||||||
|
// this.notificationService.prompt(
|
||||||
|
// Severity.Info,
|
||||||
|
// "changed testing",
|
||||||
|
// [
|
||||||
|
// {
|
||||||
|
// label: isWeb ? localize('reload', "Reload") : localize('restart', "Restart"),
|
||||||
|
// run: () => this.hostService.restart()
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// );
|
||||||
|
|
||||||
|
// this.notificationService.notify({
|
||||||
|
// severity: Severity.Info,
|
||||||
|
// message: "satest",
|
||||||
|
// actions: {
|
||||||
|
// primary: [
|
||||||
|
// new Action('Restart', isWeb ? localize('reload', "Reload") : localize('restart', "Restart"), undefined, true, () => this.hostService.restart())
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -493,7 +493,8 @@ class Extensions extends Disposable {
|
||||||
const extensions = await this.mapInstalledExtensionWithCompatibleGalleryExtension(galleryExtensions);
|
const extensions = await this.mapInstalledExtensionWithCompatibleGalleryExtension(galleryExtensions);
|
||||||
for (const [extension, gallery] of extensions) {
|
for (const [extension, gallery] of extensions) {
|
||||||
// update metadata of the extension if it does not exist
|
// update metadata of the extension if it does not exist
|
||||||
if (extension.local && !extension.local.identifier.uuid) {
|
// and exist,but not same --kylinIDETeam add
|
||||||
|
if (extension.local && (!extension.local.identifier.uuid || extension.local.identifier.uuid !== extension.gallery?.identifier.uuid)) {
|
||||||
extension.local = await this.updateMetadata(extension.local, gallery);
|
extension.local = await this.updateMetadata(extension.local, gallery);
|
||||||
}
|
}
|
||||||
if (!extension.gallery || extension.gallery.version !== gallery.version || extension.gallery.properties.targetPlatform !== gallery.properties.targetPlatform) {
|
if (!extension.gallery || extension.gallery.version !== gallery.version || extension.gallery.properties.targetPlatform !== gallery.properties.targetPlatform) {
|
||||||
|
@ -734,7 +735,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||||
|
|
||||||
urlService.registerHandler(this);
|
urlService.registerHandler(this);
|
||||||
|
|
||||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
this._register(this.configurationService.onDidChangeConfiguration(async e => {
|
||||||
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
|
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
|
||||||
if (this.isAutoUpdateEnabled()) {
|
if (this.isAutoUpdateEnabled()) {
|
||||||
this.checkForUpdates();
|
this.checkForUpdates();
|
||||||
|
@ -745,6 +746,25 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||||
this.checkForUpdates();
|
this.checkForUpdates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (e.affectsConfiguration('extensionsGallery.serviceUrl')) {
|
||||||
|
try {
|
||||||
|
await this.checkForUpdates();
|
||||||
|
} catch (error) {
|
||||||
|
this.notificationService.error(nls.localize('changedServiceUrlError', 'Network request failed or Configuration extensionsGallery serviceUrl Error.Please check network or reconfiguration serviceUrl.'));
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
// this.notificationService.prompt(Severity.Warning, nls.localize('changedServiceUrlSuccess', 'checkForUpdate extensions Successfully,need restart IDE'),
|
||||||
|
// [
|
||||||
|
// {
|
||||||
|
// label: nls.localize('restartIde', 'Restart IDE'),
|
||||||
|
// run: async () => {
|
||||||
|
// this.hostService.restart();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ], {
|
||||||
|
// onCancel: () => { }
|
||||||
|
// });
|
||||||
|
}
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
this._register(extensionEnablementService.onEnablementChanged(platformExtensions => {
|
this._register(extensionEnablementService.onEnablementChanged(platformExtensions => {
|
||||||
|
@ -1110,12 +1130,14 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||||
// Skip checking updates for a builtin extension if it does not has Marketplace identifier or the current product is VS Code Desktop stable.
|
// Skip checking updates for a builtin extension if it does not has Marketplace identifier or the current product is VS Code Desktop stable.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
this.logService.debug('wpl checkForUpdates installed:' + installed.name);
|
||||||
infos.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
|
infos.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
|
||||||
}
|
}
|
||||||
if (infos.length) {
|
if (infos.length) {
|
||||||
const targetPlatform = await extensions[0].server.extensionManagementService.getTargetPlatform();
|
const targetPlatform = await extensions[0].server.extensionManagementService.getTargetPlatform();
|
||||||
const galleryExtensions = await this.galleryService.getExtensions(infos, { targetPlatform, compatible: true }, CancellationToken.None);
|
const galleryExtensions = await this.galleryService.getExtensions(infos, { targetPlatform, compatible: true }, CancellationToken.None);
|
||||||
if (galleryExtensions.length) {
|
if (galleryExtensions.length) {
|
||||||
|
this.logService.debug('wpl galleryService.getExtensions:' + galleryExtensions.length);
|
||||||
await this.syncInstalledExtensionsWithGallery(galleryExtensions);
|
await this.syncInstalledExtensionsWithGallery(galleryExtensions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue