zls icon indicating copy to clipboard operation
zls copied to clipboard

Go To Declaration fails with aliasing

Open William65536 opened this issue 1 year ago • 2 comments

Zig Version

0.14.0-dev.1511+54b668f8a

ZLS Version

0.14.0-dev.147+dd78968

Client / Code Editor / Extensions

VS Code

Steps to Reproduce and Observed Behavior

If you use Go To Declaration on baz ZLS jumps you to foo.

const foo = 0;
const bar = foo;
const baz = bar; // Go To Declaration on baz jumps to `foo`

Expected Behavior

Go To Declaration should respect aliasing and take you to bar instead of foo. This works correctly if you Go To Declaration on bar instead:

const foo = 0;
const bar = foo;
const baz = bar; // Go To Declaration on bar correctly jumps to `const bar = ...`

Relevant log output

No response

William65536 avatar Oct 17 '24 21:10 William65536

are you sure youre using goto declaration and not goto definition? this is working as expected for me

xdBronch avatar Oct 17 '24 21:10 xdBronch

Yes. The behavior is the same for go to definition and go to declaration with the baz case. Perhaps this has been fixed in a more recent version.

William65536 avatar Oct 17 '24 22:10 William65536