Skip to content

Commit

Permalink
feat: Warn if a variable category is loaded without variable blocks. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko authored Jan 6, 2025
1 parent eeef2ed commit 071814e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Element>();
const button = document.createElement('button');
button.setAttribute('text', '%{BKY_NEW_VARIABLE}');
Expand Down
5 changes: 5 additions & 0 deletions core/variables_dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Element>();
let button = document.createElement('button');
button.setAttribute('text', Msg['NEW_STRING_VARIABLE']);
Expand Down

0 comments on commit 071814e

Please sign in to comment.