From 6feecc8d3c576e3a4aead36b3cf5ba5dbf801712 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 19 Dec 2024 10:22:27 -0800 Subject: [PATCH] feat: Warn if a variable category is loaded without variable blocks. --- core/variables.ts | 5 +++++ core/variables_dynamic.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/core/variables.ts b/core/variables.ts index 75f0c3cf88..5d60b475b1 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -92,6 +92,11 @@ export function allDeveloperVariables(workspace: Workspace): string[] { * @returns Array of XML elements. */ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { + if (!Blocks['variables_set'] && !Blocks['variables_get']) { + console.warn( + 'There are no variable blocks, but there is a variable category.', + ); + } let xmlList = new Array(); const button = document.createElement('button'); button.setAttribute('text', '%{BKY_NEW_VARIABLE}'); diff --git a/core/variables_dynamic.ts b/core/variables_dynamic.ts index 8dc691d3a1..6722f8b49f 100644 --- a/core/variables_dynamic.ts +++ b/core/variables_dynamic.ts @@ -76,6 +76,11 @@ export const onCreateVariableButtonClick_Colour = colourButtonClickHandler; * @returns Array of XML elements. */ export function flyoutCategory(workspace: WorkspaceSvg): Element[] { + if (!Blocks['variables_set_dynamic'] && !Blocks['variables_get_dynamic']) { + console.warn( + 'There are no dynamic variable blocks, but there is a dynamic variable category.', + ); + } let xmlList = new Array(); let button = document.createElement('button'); button.setAttribute('text', Msg['NEW_STRING_VARIABLE']);