update extensions metadata,delay notification prompt.

This commit is contained in:
chriswang521 2023-08-17 17:50:02 +08:00
parent 1bc97780c1
commit ab3e1d16e5
3 changed files with 58 additions and 26 deletions

View File

@ -5892,7 +5892,8 @@
"not found": "无法安装插件“{0}”,因为找不到请求的版本“{1}”。",
"singleDependentError": "无法单独禁用 \"{0}\" 插件。\"{1}\" 插件依赖于此插件。要禁用所有这些插件吗?",
"twoDependentsError": "无法单独禁用 \"{0}\" 插件。\"{1}\" 和 \"{2}\" 插件依赖于此插件。要禁用所有这些插件吗?",
"uninstallingExtension": "正在卸载插件..."
"uninstallingExtension": "正在卸载插件...",
"changedServiceUrlError": "网络请求错误,请检查网络或者配置的插件商店地址是否正确。"
},
"vs/workbench/contrib/extensions/browser/fileBasedRecommendations": {
"dontShowAgainExtension": "不再对“.{0}”文件显示",

View File

@ -11,6 +11,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IExtensionsGalleryConfiguration } from 'vs/platform/extensionsGallery/common/extensionsGallery.config.contribution';
import { IExtensionsGalleryConfigService } from 'vs/platform/extensionsGallery/common/extensionsGalleryConfigService';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { debounce } from 'vs/base/common/decorators';
// import { IHostService } from 'vs/workbench/services/host/browser/host';
export class ExtensionsGalleryConfigService implements IExtensionsGalleryConfigService {
@ -59,29 +60,37 @@ export class ExtensionsGalleryConfigService implements IExtensionsGalleryConfigS
// this._itemUrl = extensionsGalleryConfig.itemUrl;
this._onConfigChange.fire(this._serviceUrl ? this._serviceUrl : '');
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())
// ]
// }
// });
// }
this.showMessage();
}
}
//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())
// ]
// }
// });
// }
}
}

View File

@ -493,7 +493,8 @@ class Extensions extends Disposable {
const extensions = await this.mapInstalledExtensionWithCompatibleGalleryExtension(galleryExtensions);
for (const [extension, gallery] of extensions) {
// 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);
}
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);
this._register(this.configurationService.onDidChangeConfiguration(e => {
this._register(this.configurationService.onDidChangeConfiguration(async e => {
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
if (this.isAutoUpdateEnabled()) {
this.checkForUpdates();
@ -745,6 +746,25 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
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._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.
continue;
}
this.logService.debug('wpl checkForUpdates installed:' + installed.name);
infos.push({ ...installed.identifier, preRelease: !!installed.local?.preRelease });
}
if (infos.length) {
const targetPlatform = await extensions[0].server.extensionManagementService.getTargetPlatform();
const galleryExtensions = await this.galleryService.getExtensions(infos, { targetPlatform, compatible: true }, CancellationToken.None);
if (galleryExtensions.length) {
this.logService.debug('wpl galleryService.getExtensions:' + galleryExtensions.length);
await this.syncInstalledExtensionsWithGallery(galleryExtensions);
}
}