Skip to content

Commit

Permalink
return globals even if parse tree is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
joswig committed Nov 1, 2024
1 parent 9c4c498 commit 5f31b17
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/components/sequencing/form/SelectedCommand.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@
$: variablesInScope = getVariablesInScope(tree, commandNode?.from);
function getVariablesInScope(tree: Tree | null, cursorPosition?: number): string[] {
const globalNames = ($sequenceAdaptation.globals ?? []).map(v => v.name);
if (tree && cursorPosition !== undefined) {
const docText = editorSequenceView.state.doc.toString();
return [
...($sequenceAdaptation.globals ?? []).map(v => v.name),
...commandInfoMapper.getVariables(docText, tree, cursorPosition),
];
return [...globalNames, ...commandInfoMapper.getVariables(docText, tree, cursorPosition)];
}
return [];
return globalNames;
}
function getTimeTagInfo(commandNode: SyntaxNode | null): TimeTagInfo {
Expand Down

0 comments on commit 5f31b17

Please sign in to comment.