T1: catalog test knows theme settings, notification keys follow the convention

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-06 18:57:56 +01:00
parent 086bc8a925
commit d81c943905
4 changed files with 18 additions and 5 deletions

View file

@ -150,7 +150,7 @@ fn broken_file(state: &mut State, path: &Path, reason: &str) {
params.insert("reason".into(), Value::from(reason));
state.notify(
NotificationLevel::Warning,
Some("theme.notification.skipped"),
Some("notification.theme.skipped"),
Some(format!("Skipped the theme file {file}: {reason}")),
Some(params),
);

View file

@ -223,7 +223,7 @@ export const useThemesStore = defineStore("themes", () => {
const name = (result.value as { name?: unknown } | null)?.name;
notifications.notify({
level: "info",
messageKey: "theme.import.done",
messageKey: "notification.theme.imported",
params: { name: typeof name === "string" ? name : picked.value },
});
}

View file

@ -276,6 +276,8 @@
"notification.settings.unavailable": "Settings cannot be loaded ({error}). The defaults are used and changes are not saved.",
"notification.stack.label": "Notifications",
"notification.stack.more": "+{count} more",
"notification.theme.imported": "Imported the theme {name}.",
"notification.theme.skipped": "Skipped the theme file {file}: {reason}",
"notification.toolchain.downloadDone": "Phpactor {version} is ready, downloaded and verified in {seconds} s.",
"notification.toolchain.downloadFailed": "Phpactor {version} could not be downloaded: {reason}",
"notification.toolchain.downloadStarted": "Downloading Phpactor {version} from GitHub for PHP language features…",
@ -446,7 +448,6 @@
"terminal.tab.numbered": "Local ({n})",
"terminal.tabs.label": "Terminals",
"terminal.toolWindow.title": "Terminal",
"theme.import.done": "Imported the theme {name}.",
"theme.import.title": "Import Theme",
"theme.lutraDark": "Lutra Dark",
"theme.lutraLight": "Lutra Light",
@ -454,7 +455,6 @@
"theme.lutraPlumNight": "Plum Night",
"theme.lutraReed": "Reed",
"theme.lutraRiver": "River",
"theme.notification.skipped": "Skipped the theme file {file}: {reason}",
"theme.picker.current": "current",
"theme.picker.dark": "Dark",
"theme.picker.followsSystem": "Follows the light or dark preference of your operating system",

View file

@ -85,10 +85,18 @@ function camel(value: string): string {
* - Rust `*_key: "…"` fields: theme labels and the settings' `labelKey`
* and `descriptionKey`;
* - per settings definition, its section name (`settings.section.<s>`) and
* each enum value (`settings.<key>.value.<value>`).
* each enum value (`settings.<key>.value.<value>`); a `Kind::Theme`
* setting has every built-in theme id of `theme.rs` and `system` as
* values (C9 T1).
*/
const RUNTIME_KEYS = (() => {
const keys = new Set<string>();
const themeIds = [
...[...shippedRust(join(REPO, "crates", "engine", "src", "theme.rs")).matchAll(/\bid:\s*"([a-z0-9-]+)"/g)].map(
(m) => m[1] ?? "",
),
"system",
];
const add = (text: string, pattern: RegExp): void => {
for (const m of text.matchAll(pattern)) {
keys.add(m[1] ?? "");
@ -112,6 +120,11 @@ const RUNTIME_KEYS = (() => {
for (const value of values.matchAll(/"([^"]+)"/g)) {
keys.add(`settings.${key ?? ""}.value.${camel(value[1] ?? "")}`);
}
if (/Kind::Theme\b/.test(body)) {
for (const id of themeIds) {
keys.add(`settings.${key ?? ""}.value.${camel(id)}`);
}
}
}
}
keys.delete("");