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

Autocomplete and hover information for decl literals #2027

Open
IntegratedQuantum opened this issue Sep 14, 2024 · 1 comment
Open

Autocomplete and hover information for decl literals #2027

IntegratedQuantum opened this issue Sep 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@IntegratedQuantum
Copy link
Contributor

This is a fairly new addition to the language (ziglang/zig#21264) and it would be nice if zls would autocomplete these, and show some more information (like function parameters and doc comments) when hovering over a decl literal.

@IntegratedQuantum IntegratedQuantum added the enhancement New feature or request label Sep 14, 2024
@llogick
Copy link
Member

llogick commented Sep 14, 2024

Some alpha state code

Maybe someone will come up with a neat way to type match declarations and definitions?

Examples given in the original ziglang proposal were

test {
    const s: ?**const S = try .getGlobal();
    _ = s;
}

const S = struct {
    x: usize,
    var g: *const S = &.{ .x = 1 };
    fn getGlobal() anyerror!?**const S {
        return &g;
    }
};

and

const S = struct {
    const init: anyerror!anyerror!????S = .{};
};

test {
    const s: ????S = try try .init;
    _ = s;
}

(doubt it's practicality, but apparently it passes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants