-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hover: Add links to referenced types when possible #1281
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, but I found some weird behavior when hovering over type declarations:
// example_file.zig
const SomeType = struct {};
const Self = @This();
If you hover on SomeType
, you will get Go to *SomeType*
If you hover on Self
, you will get Go to *example_file*
Thanks, I appreciate it 😄
I have an idea for avoiding redundant "Go to" for |
If fixing the
Maybe resolveVarDeclAlias is what you need. It will resolve aliases but not completely resolve its type.
functions in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything is in order except that you should use offsets.nodeToSlice
instead of std.zig.Ast.getNodeSource
because ZLS uses a custom lastToken function that is safe to use on ast with syntax errors.
Inspired by rust-analyzer, this PR adds "Go to <type>" in hover pop-ups: