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

Hover not working on try in circle brackets #1752

Open
StringNick opened this issue Feb 7, 2024 · 1 comment
Open

Hover not working on try in circle brackets #1752

StringNick opened this issue Feb 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@StringNick
Copy link

StringNick commented Feb 7, 2024

Zig Version

0.12.0-dev.2543+9eda6ccef

Zig Language Server Version

0.12.0-dev.371+47373c1

Client / Code Editor / Extensions

vscode

Steps to Reproduce and Observed Behavior

(try somefunc()) <- do not understand type, so hover not working (i suppose)
working hover:

image

not working hover:

image

Expected Behavior

expect to work hover as on first screenshot

Relevant log output

const std = @import("std");

const SomeTypeB = struct {
    b: u8 = 0,

    pub fn get_b(self: SomeTypeB) u8 {
        return self.b;
    }
};

const SomeType = struct {
    a: SomeTypeB = undefined,

    pub fn get_a(self: SomeType) !SomeTypeB {
        return self.a;
    }
};

pub fn main() !void {
    const a = SomeType{
        .a = SomeTypeB{ .b = 1 },
    };

    const b = try a.get_a();
    // b get_b func hover is working
    const b_val = b.get_b();

    // get_b func hover is not working, but code is right
    const b_val_2 = (try a.get_a()).get_b();

    try std.testing.expect(b_val == b_val_2);
}
@StringNick StringNick added the bug Something isn't working label Feb 7, 2024
@StringNick StringNick changed the title Hover not working in try circle brackets Hover not working on try in circle brackets Feb 7, 2024
@Techatrix
Copy link
Member

There is a completion test that is the same as this issue:

// try testCompletion(
// \\const S = struct { alpha: u32 };
// \\fn foo() error{Foo}!S {}
// \\fn bar() error{Foo}!void {
// \\ (try foo()).<cursor>
// \\}
// , &.{
// .{ .label = "alpha", .kind = .Field, .detail = "u32" },
// });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants