diff --git a/apps/lil-buddy/src/App.svelte b/apps/lil-buddy/src/App.svelte
index 2bf68aa..8f65f71 100644
--- a/apps/lil-buddy/src/App.svelte
+++ b/apps/lil-buddy/src/App.svelte
@@ -5,6 +5,7 @@
import LintPicker from "./linting/LintPicker.svelte";
import NewLintSuggestion from "./linting/NewLintSuggestion.svelte";
+ import KeyboardHooks from "./components/KeyboardHooks.svelte";
$: lint = $store.lints.find((lint) => lint.id === $store.focusedLint)!;
@@ -45,3 +46,4 @@
{/if}
+
diff --git a/apps/lil-buddy/src/components/KeyboardHooks.svelte b/apps/lil-buddy/src/components/KeyboardHooks.svelte
new file mode 100644
index 0000000..0a3680c
--- /dev/null
+++ b/apps/lil-buddy/src/components/KeyboardHooks.svelte
@@ -0,0 +1,36 @@
+
+
+
diff --git a/apps/lil-buddy/src/linting/FocusedTest.svelte b/apps/lil-buddy/src/linting/FocusedTest.svelte
index bb703bb..dfe6641 100644
--- a/apps/lil-buddy/src/linting/FocusedTest.svelte
+++ b/apps/lil-buddy/src/linting/FocusedTest.svelte
@@ -39,6 +39,7 @@
$: errors = lintRun.errors;
$: pairData = blameData as number[][];
$: program = lint.program;
+ let editTime: null | number = null;
{#if currentLintAppliesToCurrentPalette && testPal}
@@ -67,6 +68,10 @@
}}
pal={testPal}
updatePal={(newPal) => {
+ if (editTime === null) {
+ editTime = Date.now();
+ store.setOkayToExecute(false);
+ }
const oldTests =
focusedTest.type === "passing"
? lint.expectedPassingTests
@@ -78,6 +83,15 @@
} else {
store.setCurrentLintExpectedFailingTests(newTests);
}
+ editTime = Date.now();
+ setTimeout(() => {
+ if (!editTime) {
+ store.setOkayToExecute(true);
+ } else if (Date.now() - editTime > 1000) {
+ store.setOkayToExecute(true);
+ editTime = null;
+ }
+ }, 1000);
}}
/>
{/if}
@@ -125,7 +139,16 @@
{:else}
This lint does not apply to the current palette due to a mismatch between
- its tags and the palette's tags
+ its tags and the palette's tags. This lint requires the following tags: {lint.requiredTags
+ .map((x) => `"${x}"`)
+ .join(", ")}.
+ {#if testPal?.tags?.length}
+ The palette has the following tags: {(testPal?.tags || [])
+ .map((x) => `"${x}"`)
+ .join(", ")}
+ {:else}
+ The palette has no tags.
+ {/if}
{/if}
diff --git a/apps/lil-buddy/src/linting/LintMeta.svelte b/apps/lil-buddy/src/linting/LintMeta.svelte
index a04b941..f864ca5 100644
--- a/apps/lil-buddy/src/linting/LintMeta.svelte
+++ b/apps/lil-buddy/src/linting/LintMeta.svelte
@@ -90,7 +90,7 @@
{#each lint.requiredTags as tag}
-
+
{tag}
-
{#if failing.result.kind === "success"}
{#if !failing.result?.passes}
Correct
diff --git a/apps/lil-buddy/src/linting/VisualSummarizer.svelte b/apps/lil-buddy/src/linting/VisualSummarizer.svelte
index d648d98..42d51fd 100644
--- a/apps/lil-buddy/src/linting/VisualSummarizer.svelte
+++ b/apps/lil-buddy/src/linting/VisualSummarizer.svelte
@@ -2,19 +2,25 @@
import type { Palette } from "color-buddy-palette";
import DispatchNode from "./summary-nodes/DispatchNode.svelte";
import { GenerateAST } from "color-buddy-palette-lint";
+ import store from "../stores/store";
export let pal: Palette;
export let lint: string;
- $: ast = getAST(lint);
+ $: ast = getAST(lint, $store.okayToExecute);
let error: any;
- function getAST(lint: string) {
+ function getAST(lint: string, okayToExecute: boolean) {
+ console.log("ast");
+ if (!okayToExecute) {
+ error = "Changes in process";
+ return null;
+ }
try {
return GenerateAST(JSON.parse(lint)).value as any;
} catch (e) {
error = e;
}
}
- $: console.log("summarizer");
+ $: console.log("summarizer", $store.okayToExecute);
diff --git a/apps/lil-buddy/src/stores/store.ts b/apps/lil-buddy/src/stores/store.ts
index 95b7026..5118ae0 100644
--- a/apps/lil-buddy/src/stores/store.ts
+++ b/apps/lil-buddy/src/stores/store.ts
@@ -16,6 +16,7 @@ interface StoreData {
currentChecks: LintResult[];
loadState?: "loading" | "idle";
engine: "openai" | "anthropic";
+ okayToExecute: boolean;
}
const InitialStore: StoreData = {
@@ -36,6 +37,7 @@ const InitialStore: StoreData = {
loadState: "idle",
engine: "openai",
focusedTest: false,
+ okayToExecute: true,
};
function serializeStore(store: StoreData) {
@@ -220,6 +222,8 @@ function createStore() {
persistUpdate((old) => ({ ...old, engine })),
setFocusedTest: (test: StoreData["focusedTest"]) =>
persistUpdate((old) => ({ ...old, focusedTest: test })),
+ setOkayToExecute: (okay: StoreData["okayToExecute"]) =>
+ persistUpdate((old) => ({ ...old, okayToExecute: okay })),
};
}