[Extension Reloading]: Update custom commands, add enable/disable command (#12547)

This commit is contained in:
Jacob MacDonald
2025-11-05 11:36:07 -08:00
committed by GitHub
parent ca6cfaaf4e
commit fa93b56243
24 changed files with 664 additions and 187 deletions

View File

@@ -4,8 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { LoadedSettings } from '../config/settings.js';
import { SettingScope } from '../config/settings.js';
import type {
LoadableSettingScope,
LoadedSettings,
} from '../config/settings.js';
import { isLoadableSettingScope, SettingScope } from '../config/settings.js';
import { settingExistsInScope } from './settingsUtils.js';
/**
@@ -20,7 +23,10 @@ export const SCOPE_LABELS = {
/**
* Helper function to get scope items for radio button selects
*/
export function getScopeItems() {
export function getScopeItems(): Array<{
label: string;
value: LoadableSettingScope;
}> {
return [
{ label: SCOPE_LABELS[SettingScope.User], value: SettingScope.User },
{
@@ -36,12 +42,12 @@ export function getScopeItems() {
*/
export function getScopeMessageForSetting(
settingKey: string,
selectedScope: SettingScope,
selectedScope: LoadableSettingScope,
settings: LoadedSettings,
): string {
const otherScopes = Object.values(SettingScope).filter(
(scope) => scope !== selectedScope,
);
const otherScopes = Object.values(SettingScope)
.filter(isLoadableSettingScope)
.filter((scope) => scope !== selectedScope);
const modifiedInOtherScopes = otherScopes.filter((scope) => {
const scopeSettings = settings.forScope(scope).settings;

View File

@@ -6,8 +6,8 @@
import type {
Settings,
SettingScope,
LoadedSettings,
LoadableSettingScope,
} from '../config/settings.js';
import type {
SettingDefinition,
@@ -391,7 +391,7 @@ export function saveModifiedSettings(
modifiedSettings: Set<string>,
pendingSettings: Settings,
loadedSettings: LoadedSettings,
scope: SettingScope,
scope: LoadableSettingScope,
): void {
modifiedSettings.forEach((settingKey) => {
const path = settingKey.split('.');