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

Show [[count]] var for arrays #136

Open
TwitchBronBron opened this issue Feb 21, 2023 · 0 comments
Open

Show [[count]] var for arrays #136

TwitchBronBron opened this issue Feb 21, 2023 · 0 comments

Comments

@TwitchBronBron
Copy link
Member

In the debug protocol, we know the length of the array ahead of time, so we should show the [[count]] variable. Code like this would work:

v.namedVariables = 1;

//add a virtual [[count]] prop if the array children are present
if (result.children && result.children?.length === result?.elementCount && result?.elementCount === 3) {
    v.childVariables.push(
        this.getVariableFromResult({
            name: '[[count]]',
            value: result?.elementCount.toString(),
            type: 'integer',
            highLevelType: HighLevelType.primative,
            evaluateName: `${result.evaluateName}.count()`,
            presentationHint: 'virtual',
            keyType: undefined,
            children: undefined,
            elementCount: 0
        }, frameId)
    );
}

The issue right now, is for arrays, we end up with both indexed and named variables, so our variable lookup pipelines don't currently support splitting them out between the two. So that'll need done too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant