feat(settings): settings import/export and WebView2 clipboard history
This commit is contained in:
1 parent
d44798f70f
commit
7961e688f2
19 files changed
+2316
-216
No files matched your search
@@ -208,6 +208,21 @@ export function normalizeSqlFormatterSettings(value: unknown): SqlFormatterSetti
|
||||
return sqlFormatterOptionSettings(optionSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete nested-schema check for an already-shaped settings object: every
|
||||
* formatter option must be present with a valid value, and no unknown option
|
||||
* may appear. Unlike the normalizer this never fills defaults, so callers can
|
||||
* reject partially malformed payloads instead of silently substituting them.
|
||||
*/
|
||||
export function isCompleteSqlFormatterSettings(value: unknown): value is SqlFormatterSettings {
|
||||
if (!isObject(value)) return false;
|
||||
for (const key of SQL_FORMATTER_OPTION_KEYS) {
|
||||
if (!(key in value)) return false;
|
||||
if (!SQL_FORMATTER_OPTION_VALIDATORS[key]((value as Record<string, unknown>)[key])) return false;
|
||||
}
|
||||
return Object.keys(value).every((key) => SQL_FORMATTER_OPTION_KEYS.has(key as keyof SqlFormatterOptionSettings));
|
||||
}
|
||||
|
||||
export function sqlFormatterConfigFile(settings: unknown): SqlFormatterConfigFile {
|
||||
const normalized = normalizeSqlFormatterSettings(settings);
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user