Skip to content
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

Some hover improvements #1303

Merged
merged 8 commits into from
Jul 9, 2023
Merged

Some hover improvements #1303

merged 8 commits into from
Jul 9, 2023

Conversation

FnControlOption
Copy link
Contributor

@FnControlOption FnControlOption commented Jul 8, 2023

Show "Go to Foo | Bar" instead of "Go to Foo | Go to Bar"

Screenshot
Before Screenshot

Omit container body

Closes #1301

Screenshot

Enable hover and Go to References for loop label declaration

Screenshot Screenshot

Resolve types of primitive values, enum literals, and error values

Screenshot 2023-07-08
const std = @import("std");
pub fn main() void {
    const tru = true;
    std.log.info("{}", .{@TypeOf(tru)}); // bool
    const fals = false;
    std.log.info("{}", .{@TypeOf(fals)}); // bool
    const nul = null;
    std.log.info("{}", .{@TypeOf(nul)}); // @TypeOf(null)
    const undef = undefined;
    std.log.info("{}", .{@TypeOf(undef)}); // @TypeOf(undefined)
    const enum_lit = .foo;
    std.log.info("{}", .{@TypeOf(enum_lit)}); // @TypeOf(.enum_literal)
    const err = error.Foo;
    std.log.info("{}", .{@TypeOf(err)}); // error{Foo}
}

Enable hover for merged error sets

Screenshot Screenshot

@FnControlOption FnControlOption marked this pull request as draft July 8, 2023 18:10
@FnControlOption FnControlOption marked this pull request as ready for review July 8, 2023 18:49
@leecannon
Copy link
Member

leecannon commented Jul 8, 2023

@FnControlOption Looks good, just a few things about omitting container bodies.

  • Errorsets still have their entire declaration shown.
  • It would be nice if the explicitly provided backing integer was included, the below shows const PSE = packed struct but const PSE = packed struct(u32) would be better.
const PSE = packed struct(u32) {
    f: u32,
};

pub fn main() !void {
    var pse: PSE = undefined;
    _ = pse;
}

@leecannon
Copy link
Member

leecannon commented Jul 9, 2023

@FnControlOption I just made a mistake, I forced pushed to your branch thinking I had a different one checked out. So the commits you added after my comment are gone, I hope you have them locally.

Sorry about this, I feel like an idiot :(

@FnControlOption
Copy link
Contributor Author

No worries at all! I fortunately still have the commits locally, so I'll go ahead and push them again ❤️

@leecannon leecannon merged commit c3cd9a7 into zigtools:master Jul 9, 2023
@FnControlOption FnControlOption deleted the hover branch July 9, 2023 14:22
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.

Hovering over a type shows the entire declaration
2 participants