Skip to content

Rust-Analyzer action inline macro doesn't produce valid code #5667

Closed as not planned
@d4h0

Description

@d4h0

Summary

Rust-Analyzer action inline macro doesn't produce valid code.

Reproduction Steps

Create a Rust project with a file with the following content:

macro_rules! test {
    () => {
        let foo = 42;
        println!("{foo}");
    };
}

fn main() {
    test!();
}

Move the cursor to test! in the main function, press Space and a to open the code action menu. Now select inline macro.

The macro will be expanded to letfoo=42;println!("{foo}");;, which isn't valid Rust.

(Rust-Analyzer version: rust-analyzer 1 (ff4d55e48 2023-01-15), however that's probably not relevant here)

Helix log

N/A, I believe (let me know if that is a false assumption)

Platform

Linux

Terminal Emulator

alacritty 0.11.0 (8dbaa0bb)

Helix Version

helix-term 22.12 (64ec025)

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