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

Nested mcdoc spread operator failing to appear at runtime #1537

Open
Alumopper opened this issue Jul 18, 2024 · 1 comment
Open

Nested mcdoc spread operator failing to appear at runtime #1537

Alumopper opened this issue Jul 18, 2024 · 1 comment
Labels
🐛 bug Something isn't working /mcdoc
Milestone

Comments

@Alumopper
Copy link

  • Source code:

The complete code can be found at ui.mcdoc

struct UI {
    type: #[dispatcher_key="floating_ui:ui"] string,
    name?: string,
    tag?: string,
    ...floating_ui:ui[[type]]
}

struct Control {
    x?: double,
    y?: double,
    size?: [float]@2,
    rotation?: [float]@4,
    display?: enum(string){
        none = "none",
        thirdperson_lefthand = "thirdperson_lefthand",
        thirdperson_righthand = "thirdperson_righthand",
        firstperson_lefthand = "firstperson_lefthand",
        firstperson_righthand = "firstperson_righthand",
        head = "head",
        gui = "gui",
        ground = "ground",
        fixed = "fixed"
    },
    item?: Item,
    move_in?: string,
    move_out?: string,
    anim?: ControlAnimate,
    children?: [int[]@4]
}

dispatch floating_ui:ui[panel] to struct Panel {
    ...Control,
    child: [Control]
}
  • What I expected:

When I type data modify storage floating_ui:input data set value {“type”:"panel",}, there should be suggestion for members defined in struct Panel

{A9D6F85C-C2FE-4878-8D0A-49B91D1F167A}

  • What happens actually:

There are only members defined in struct UI can be auto-complete:

{04F04278-6BB6-4966-974C-EEDB1CBDB2B2}

@MulverineX MulverineX changed the title Dispatcher don't work in .mcdoc file Nested mcdoc spread operator failing to appear at runtime Jul 18, 2024
@MulverineX MulverineX added 🐛 bug Something isn't working /mcdoc labels Jul 18, 2024
@misode
Copy link
Member

misode commented Aug 1, 2024

Minimal reproduction steps::

dispatch minecraft:storage["floating_ui:input"] to struct {
    data: UI,
} 

struct UI {
    type: #[dispatcher_key="floating_ui:ui"] string,
    name?: string,
    ...floating_ui:ui[[type]],
}

dispatch floating_ui:ui[panel] to struct Panel {
    child: int,
}
  • data merge storage floating_ui:input {data:{type:"button",}} -> ✅ name and child are suggested
  • data modify storage floating_ui:input data set value {type:"panel",} -> ❌ only name is suggested

@misode misode added this to the Backlog milestone Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working /mcdoc
Projects
None yet
Development

No branches or pull requests

4 participants