mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Remove toggle setting more eagerly (#183584)
This commit is contained in:
parent
6aa8eb51c6
commit
53a53f8bb9
|
@ -1196,8 +1196,13 @@ export class SettingsEditor2 extends EditorPane {
|
|||
}
|
||||
|
||||
private addOrRemoveManageExtensionSetting(setting: ISetting, extension: IGalleryExtension, groups: ISettingsGroup[]): ISettingsGroup | undefined {
|
||||
const extensionId = setting.extensionId!;
|
||||
const matchingGroups = groups.filter(g => g.extensionInfo?.id.toLowerCase() === extensionId.toLowerCase());
|
||||
const matchingGroups = groups.filter(g => {
|
||||
const lowerCaseId = g.extensionInfo?.id.toLowerCase();
|
||||
return (lowerCaseId === setting.stableExtensionId!.toLowerCase() ||
|
||||
lowerCaseId === setting.prereleaseExtensionId!.toLowerCase());
|
||||
});
|
||||
|
||||
const extensionId = setting.displayExtensionId!;
|
||||
if (!matchingGroups.length) {
|
||||
const newGroup: ISettingsGroup = {
|
||||
sections: [{
|
||||
|
@ -1217,7 +1222,7 @@ export class SettingsEditor2 extends EditorPane {
|
|||
} else if (matchingGroups.length >= 2) {
|
||||
// Remove the group with the manage extension setting.
|
||||
const matchingGroupIndex = matchingGroups.findIndex(group =>
|
||||
group.sections.length === 1 && group.sections[0].settings.length === 1 && group.sections[0].settings[0].extensionId);
|
||||
group.sections.length === 1 && group.sections[0].settings.length === 1 && group.sections[0].settings[0].displayExtensionId);
|
||||
if (matchingGroupIndex !== -1) {
|
||||
groups.splice(matchingGroupIndex, 1);
|
||||
}
|
||||
|
@ -1286,7 +1291,9 @@ export class SettingsEditor2 extends EditorPane {
|
|||
title: localize('manageExtension', "Manage {0}", extensionName),
|
||||
scope: ConfigurationScope.WINDOW,
|
||||
type: 'null',
|
||||
extensionId: extensionId,
|
||||
displayExtensionId: extensionId,
|
||||
stableExtensionId: key,
|
||||
prereleaseExtensionId: typeof prerelease === 'string' ? prerelease : key,
|
||||
extensionGroupTitle: groupTitle ?? extensionName
|
||||
};
|
||||
const additionalGroup = this.addOrRemoveManageExtensionSetting(setting, extension, groups);
|
||||
|
|
|
@ -1926,7 +1926,7 @@ export class SettingsExtensionToggleRenderer extends AbstractSettingRenderer imp
|
|||
protected renderValue(dataElement: SettingsTreeSettingElement, template: ISettingExtensionToggleItemTemplate, onChange: (_: undefined) => void): void {
|
||||
template.elementDisposables.clear();
|
||||
|
||||
const extensionId = dataElement.setting.extensionId!;
|
||||
const extensionId = dataElement.setting.displayExtensionId!;
|
||||
template.elementDisposables.add(template.actionButton.onDidClick(async () => {
|
||||
this._telemetryService.publicLog2<{ extensionId: String }, ManageExtensionClickTelemetryClassification>('ManageExtensionClick', { extensionId });
|
||||
this._commandService.executeCommand('extension.open', extensionId);
|
||||
|
|
|
@ -750,7 +750,7 @@ function trimCategoryForGroup(category: string, groupId: string): string {
|
|||
function isExtensionToggleSetting(setting: ISetting, productService: IProductService): boolean {
|
||||
return ENABLE_EXTENSION_TOGGLE_SETTINGS &&
|
||||
!!productService.extensionRecommendations &&
|
||||
!!setting.extensionId;
|
||||
!!setting.displayExtensionId;
|
||||
}
|
||||
|
||||
function isExcludeSetting(setting: ISetting): boolean {
|
||||
|
|
|
@ -97,7 +97,9 @@ export interface ISetting {
|
|||
categoryLabel?: string;
|
||||
|
||||
// For ExtensionToggle settings
|
||||
extensionId?: string;
|
||||
displayExtensionId?: string;
|
||||
stableExtensionId?: string;
|
||||
prereleaseExtensionId?: string;
|
||||
title?: string;
|
||||
extensionGroupTitle?: string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue