Make Table Formulas a built-in feature
The formula engine, the rendered results, and the formula help now come from src/lib/formulas/. The editor and the renderer call this module directly. The tableFormulas contribution type is removed. - Add the tableFormulas general setting (default on) and a switch in Settings > General. When it is off, formulas show as source text. - Do not load an installed runestone.table-formulas package. Settings > Plug-ins marks it as included with RuneStone and tells the user that it can be removed. The user's files stay in place. - Translate the formula help and the error descriptions into French, Japanese, and Simplified Chinese. - Port the plugin unit tests. Test the setting and use a test-only contribution for the generic plugin lifecycle tests. - Smoke tests load only Terminal. The formula and lifecycle tests use the built-in feature and its setting. - Remove scripts/buildPlugins.mjs, the build:plugins script, and the plugin-packages requirement of the smoke runner. - Remove RuneStone_Table_Formulas from the menu audit scope. It had no menu surfaces. - Update the README, the user guides, and the developer references.
This commit is contained in:
@@ -7,9 +7,9 @@ test("missing or damaged preferences keep safe defaults", () => {
|
||||
assert.deepEqual(parseSettings(raw), DEFAULT_SETTINGS);
|
||||
}
|
||||
for (const autosaveSeconds of [0, -1, 301, 1.5, "10", null]) {
|
||||
assert.deepEqual(parseSettings(JSON.stringify({ autosaveEnabled: false, autosaveSeconds, showInternalFolder: false })), { autosaveEnabled: false, autosaveSeconds: 5, showInternalFolder: false });
|
||||
assert.deepEqual(parseSettings(JSON.stringify({ autosaveEnabled: false, autosaveSeconds, showInternalFolder: false })), { autosaveEnabled: false, autosaveSeconds: 5, showInternalFolder: false, tableFormulas: true });
|
||||
}
|
||||
assert.deepEqual(parseSettings('{"autosaveEnabled":"false","autosaveSeconds":10}'), { autosaveEnabled: true, autosaveSeconds: 10, showInternalFolder: false });
|
||||
assert.deepEqual(parseSettings('{"autosaveEnabled":"false","autosaveSeconds":10}'), { autosaveEnabled: true, autosaveSeconds: 10, showInternalFolder: false, tableFormulas: true });
|
||||
});
|
||||
|
||||
function withStorage(storage: Pick<Storage, "getItem" | "setItem">, body: () => void) {
|
||||
@@ -22,7 +22,7 @@ test("preferences persist and load at both interval limits", () => {
|
||||
const store = new Map<string, string>();
|
||||
withStorage({ getItem: (key: string) => store.get(key) ?? null, setItem: (key: string, value: string) => { store.set(key, value); } }, () => {
|
||||
for (const autosaveSeconds of [1, 23, 300]) {
|
||||
const settings = { autosaveEnabled: false, autosaveSeconds, showInternalFolder: false };
|
||||
const settings = { autosaveEnabled: false, autosaveSeconds, showInternalFolder: false, tableFormulas: autosaveSeconds !== 23 };
|
||||
void saveSettings(settings);
|
||||
assert.deepEqual(parseSettings(store.get(SETTINGS_KEY)!), settings);
|
||||
assert.deepEqual(readSettings(), settings);
|
||||
@@ -34,7 +34,7 @@ test("invalid changes never reach storage and storage failures reach the caller"
|
||||
let writes = 0;
|
||||
withStorage({ getItem: () => null, setItem: () => { writes++; } }, () => {
|
||||
for (const autosaveSeconds of [NaN, Infinity, 0, 301, 2.5]) {
|
||||
assert.throws(() => saveSettings({ autosaveEnabled: true, autosaveSeconds, showInternalFolder: false }));
|
||||
assert.throws(() => saveSettings({ autosaveEnabled: true, autosaveSeconds, showInternalFolder: false, tableFormulas: true }));
|
||||
}
|
||||
});
|
||||
assert.equal(writes, 0);
|
||||
@@ -45,5 +45,7 @@ test("invalid changes never reach storage and storage failures reach the caller"
|
||||
|
||||
test("stored values of any type normalize to safe settings", () => {
|
||||
for (const value of [undefined, null, 42, "text", [], { autosaveSeconds: 0 }]) assert.deepEqual(normalizeSettings(value), DEFAULT_SETTINGS);
|
||||
assert.deepEqual(normalizeSettings({ autosaveEnabled: false, autosaveSeconds: 9, showInternalFolder: true }), { autosaveEnabled: false, autosaveSeconds: 9, showInternalFolder: true });
|
||||
assert.deepEqual(normalizeSettings({ autosaveEnabled: false, autosaveSeconds: 9, showInternalFolder: true }), { autosaveEnabled: false, autosaveSeconds: 9, showInternalFolder: true, tableFormulas: true });
|
||||
assert.equal(normalizeSettings({ tableFormulas: false }).tableFormulas, false);
|
||||
for (const tableFormulas of [null, 0, "false", {}]) assert.equal(normalizeSettings({ tableFormulas }).tableFormulas, true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user