fixed:update extensions metadata,delay notification prompt.
This commit is contained in:
parent
8a5a41462f
commit
983c10edab
|
@ -6997,7 +6997,8 @@
|
||||||
"postUpdateTooltip": "请重新启动 Kylin-Code 以完成对此插件的更新。",
|
"postUpdateTooltip": "请重新启动 Kylin-Code 以完成对此插件的更新。",
|
||||||
"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": {
|
||||||
"fileBasedRecommendation": "根据你最近打开的文件,建议使用此插件。",
|
"fileBasedRecommendation": "根据你最近打开的文件,建议使用此插件。",
|
||||||
|
|
|
@ -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,6 +60,13 @@ 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.showMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//notification
|
||||||
|
@debounce(2000)
|
||||||
|
showMessage() {
|
||||||
this.notificationService.info(localize('galleryConfigChanged', "Extensions Gallery Config Changed"));
|
this.notificationService.info(localize('galleryConfigChanged', "Extensions Gallery Config Changed"));
|
||||||
|
|
||||||
// this.notificationService.prompt(
|
// this.notificationService.prompt(
|
||||||
|
@ -83,5 +91,6 @@ export class ExtensionsGalleryConfigService implements IExtensionsGalleryConfigS
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,7 +508,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) {
|
||||||
|
@ -849,7 +850,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||||
|
|
||||||
private initializeAutoUpdate(): void {
|
private initializeAutoUpdate(): void {
|
||||||
// Register listeners for auto updates
|
// Register listeners for auto updates
|
||||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
this._register(this.configurationService.onDidChangeConfiguration(async e => {
|
||||||
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
|
if (e.affectsConfiguration(AutoUpdateConfigurationKey)) {
|
||||||
this.onDidAutoUpdateConfigurationChange();
|
this.onDidAutoUpdateConfigurationChange();
|
||||||
}
|
}
|
||||||
|
@ -858,6 +859,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._register(this.extensionEnablementService.onEnablementChanged(platformExtensions => {
|
this._register(this.extensionEnablementService.onEnablementChanged(platformExtensions => {
|
||||||
if (this.getAutoUpdateValue() === 'onlyEnabledExtensions' && platformExtensions.some(e => this.extensionEnablementService.isEnabled(e))) {
|
if (this.getAutoUpdateValue() === 'onlyEnabledExtensions' && platformExtensions.some(e => this.extensionEnablementService.isEnabled(e))) {
|
||||||
|
@ -1364,6 +1384,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||||
// Skip checking updates for a builtin extension if it is a system extension or if it does not has Marketplace identifier
|
// Skip checking updates for a builtin extension if it is a system extension or if it does not has Marketplace identifier
|
||||||
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) {
|
||||||
|
@ -1381,6 +1402,7 @@ export class ExtensionsWorkbenchService extends Disposable implements IExtension
|
||||||
});
|
});
|
||||||
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