Skip to content

lsp renaming doesn't apply to asm blocks parameters #3222

Description

@NoamRothschild

Zig Version

0.16.0

ZLS Version

0.16.0

Client / Code Editor / Extensions

NVIM v0.12.3

Steps to Reproduce and Observed Behavior

open this snippet in your editor with zls enabled

pub fn main() void {
    var bar = 5;
    const refr = bar + 4;
    _ = refr;
    asm volatile (
        \\ mov $5, %rax
        : [ret] "={rax}" (bar),
    );
}

then use lsp rename on bar (I use rn in nvim to activate lsp rename)

note that you can select any reference to bar, including the one inside the asm block. they all cause the same result.

the lsp renames all references of bar to the new name, ASIDE from the one inside the asm block.
actual output:

pub fn main() void {
    var dummy = 5;
    const refr = dummy + 4;
    _ = refr;
    asm volatile (
        \\ mov $5, %rax
        : [ret] "={rax}" (bar), // <-- this doesn't change!
    );
}

Expected Behavior

the code turns into

pub fn main() void {
    var dummy = 5;
    const refr = dummy + 4;
    _ = refr;
    asm volatile (
        \\ mov $5, %rax
        : [ret] "={rax}" (dummy), // <-- this should change!
    );
}

Attach ZLS log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions