`textDocument/rename` does not consider anonymous struct literals in return expressions
Zig Version
0.11.0
Zig Language Server Version
0.11.0
Client / Code Editor / Extensions
nvim v0.10.0-dev-6405fa4 with nvim-lsp, default capabilities
Steps to Reproduce and Observed Behavior
Take this snippet:
fn f() struct{a:i32} {
return .{.a = 1};
}
fn main() void {
var x = f();
x.a = 2;
}
Reproduce: Invoke a rename on the a in the struct that is returned from f(); rename it to b.
The line x.a = 2; changes to x.b = 2;, as expected, but return .{.a = 1}; does not change.
Expected Behavior
In the example above, I would expect return .{.a = 1}; to change to return .{.b = 1};.
Trying to track all possible anonymous struct literals, that have been saved and later used as the return value of the function might prove difficult, but I would imagine the simple case of return .{...};, that also covers most use cases, should be relatively easy. I'm happy to try to implement it myself and submit a PR, if you agree this is an issue (I would suppose it would have to be implemented here: https://github.com/zigtools/zls/blob/3471da593bc9d979c73b35c516e902c06781310b/src/features/references.zig#L444-L464 ?).
Relevant log output
No response
this works properly now