Skip to content

Macros cannot be expanded in certain situations. #17837

@coderfreii

Description

@coderfreii

rust-analyzer version: v0.3.2062

rustc version: rustc 1.80.0 (051478957 2024-07-21)

editor or extension: VSCode

relevant settings: default

repository link (if public, optional): (https://github.com/jkb0o/belly/blob/main/crates/belly_widgets/src/input/slider.rs)

code snippet to reproduce:

#[widget]
#[extends(RangeWidget)]
#[styles(
    slider .slider-grabber {
      margin: 0px;
      min-width: 16px;
      min-height: 16px;
      width: 16px;
      height: 16px;
    }
)]
fn slider(ctx: &mut WidgetContext) {
    let grabber = SliderGrabber {
        slider: ctx.entity(),
    };
    let params = ctx.params();
    ctx.render(eml! {
        <range c:slider params=params>
            <slot separator>
                <button with=grabber mode="instant" c:slider-grabber>
                </button>
            </slot>
        </range>
    })
}

When I use the command 'Expand macro recursively at caret' on a macro widget, nothing happens. After that, I commented out the content in the macro styles, and it worked.

For example:

#[widget]
#[extends(RangeWidget)]
#[styles(
    // slider .slider-grabber {
    //   margin: 0px;
    //   min-width: 16px;
    //   min-height: 16px;
    //   width: 16px;
    //   height: 16px;
    // }
)]
fn slider(ctx: &mut WidgetContext) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions