Skip to content

Strange behavior with locals in arrays #810

@Yzrsah

Description

@Yzrsah

I'm just getting into Jsonnet and I love it. I've wanted something like this for so long! I'm considering using it for everything in a game project.

I'm having some trouble with arrays --

No comma:

Image

OK:

Image

The first use of local works, but the second does not -- is this a bug?

Image

Works with local outside the array:

Image

(Screenshots from use of Jsonnet-LSP)

The language reference says:

Object locals can access self and super – they are “inside the object”. As a consequence of this, object locals are not available in Field Name Expressions, because (in general) they depend on the object being already created, which requires the field names to be already known.

But I'm not sure how this applies to arrays. Please help me to understand what part of it is in the spec, or what part of this might be a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions