Skip to content

Commit

Permalink
fix: include potential variables in variable dropdowns in the flyout (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko committed Sep 16, 2024
1 parent 732bd7f commit 476d454
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions core/field_variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,15 +572,23 @@ export class FieldVariable extends FieldDropdown {
}
const name = this.getText();
let variableModelList: IVariableModel<IVariableState>[] = [];
if (this.sourceBlock_ && !this.sourceBlock_.isDeadOrDying()) {
const sourceBlock = this.getSourceBlock();
if (sourceBlock && !sourceBlock.isDeadOrDying()) {
const workspace = sourceBlock.workspace;
const variableTypes = this.getVariableTypes();
// Get a copy of the list, so that adding rename and new variable options
// doesn't modify the workspace's list.
for (let i = 0; i < variableTypes.length; i++) {
const variableType = variableTypes[i];
const variables =
this.sourceBlock_.workspace.getVariablesOfType(variableType);
const variables = workspace.getVariablesOfType(variableType);
variableModelList = variableModelList.concat(variables);
if (workspace.isFlyout) {
variableModelList = variableModelList.concat(
workspace
.getPotentialVariableMap()
?.getVariablesOfType(variableType) ?? [],
);
}
}
}
variableModelList.sort(Variables.compareByName);
Expand Down

0 comments on commit 476d454

Please sign in to comment.