feat: add descriptions to plugin host enable toggles

This commit is contained in:
LukeGus committed 2026-09-27 14:14:51 -05:00
1 parent c7fd900732
commit 7b1e0294aa
18 files changed
+53 -6

No files matched your search

+1
View File
@@ -175,6 +175,7 @@ export function declaredFields(
key: host.enableKey,
type: "boolean",
labelKey: host.enableLabelKey,
descriptionKey: host.enableDescriptionKey,
default: host.enableDefault ?? false,
},
]
@@ -301,6 +301,21 @@ describe("contributes.settings", () => {
expect(errors.join(" ")).toContain("enableLabelKey");
});
it("accepts an enableDescriptionKey and rejects an empty one", () => {
const host = { enableKey: "enableThing", enableLabelKey: "k", fields: [] };
expect(
validateManifest(
withSettings({ host: { ...host, enableDescriptionKey: "d" } }),
),
).toEqual([]);
expect(
validateManifest(
withSettings({ host: { ...host, enableDescriptionKey: "" } }),
).join(" "),
).toContain("enableDescriptionKey");
});
it("rejects a key that would not be index-safe", () => {
const errors = validateManifest(
withSettings({
+6 -1
View File
@@ -183,13 +183,18 @@ describe("declaredFields", () => {
host: {
enableKey: "enableThing",
enableLabelKey: "k",
enableDescriptionKey: "d",
fields: [{ key: "port", type: "number", labelKey: "k" }],
},
});
const fields = declaredFields(withHost, "host");
expect(fields.map((f) => f.key)).toEqual(["enableThing", "port"]);
expect(fields[0]).toMatchObject({ type: "boolean", default: false });
expect(fields[0]).toMatchObject({
type: "boolean",
default: false,
descriptionKey: "d",
});
});
it("finds a field by key", () => {
+1
View File
@@ -41,6 +41,7 @@ export interface PluginSettingsField {
export interface PluginHostSettingsContribution {
enableKey?: string;
enableLabelKey?: string;
enableDescriptionKey?: string;
enableDefault?: boolean;
editorGroup?: "top" | "ssh";
editorOrder?: number;
+1
View File
@@ -192,6 +192,7 @@ function HostPluginSection({
key: enableKey,
type: "boolean",
labelKey: host.enableLabelKey,
descriptionKey: host.enableDescriptionKey,
}}
values={shown}
setValue={setValue}