Skip to content

Conversation

@dotcarmen
Copy link
Contributor

@dotcarmen dotcarmen commented Jan 23, 2026

closes #1596

consider goto on Io from std.Io. goto definition currently goes to the beginning of the file, but it's typically more helpful to go to Io in its internal declaration const Io = @This().

contrary to the issue description, this PR also goes-to such definitions for non-file container definitions. Note that goto-declaration still goes to the outer declaration, while goto-definition now goes to the @This() declaration if it exists.

@dotcarmen dotcarmen changed the title feat(goto): goto definition prefers @This() feat(goto): goto definition prefers builtin This() Jan 23, 2026
@dotcarmen dotcarmen force-pushed the dotcarmen/goto-this branch from f36c6e5 to 2f295e5 Compare January 23, 2026 00:41
@xdBronch
Copy link
Contributor

im not sure i like this happening for all structs, i have a local change that is similar but instead stores the const x = @This(); node on DocumentStore.Handles which can be used for whatever, f.e. stringification or collecting doc comments without needing to recalculate it for everything.

@dotcarmen dotcarmen force-pushed the dotcarmen/goto-this branch from 2f295e5 to b5b5705 Compare January 23, 2026 14:59
Comment on lines +358 to +359
\\const <decl>S</decl> = struct {
\\ const <def>Self</def> = @This();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xdBronch see here - note that the declaration is still const S, but the definition is const Self. I'm still open to making the definition const S, but curious to know if this is suitable

(also just realized my PR description isn't the most precise about this, fixing now...)

@Techatrix Techatrix merged commit a5ddfc4 into zigtools:master Jan 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go to definition on file struct should look for @This().

3 participants