Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Warn if a variable category is loaded without variable blocks. #8704

Open
wants to merge 1 commit into
base: rc/v12.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading