Skip to content

Field auto-completion for function parameter structs #3196

@DanielvNiek

Description

@DanielvNiek

var user: User = .{.name=”Daniel”} autocompletes ‘.name’
var user: User = .init(.{.name=”Daniel”} does not autocomplete ‘.name’, but does show linting afterwards.

Would be great if the second autocomplete also worked. Full code to test with:

const std = @import("std");

pub fn main(_: std.process.Init) !void {
    const user1: User = .{ .name = "Daniel" }; // autocomplete and linting works
    const user2: User = .init(.{ .name = "Daniel" }); // autocomplete does not work, but linting does
    _ = user1;
    _ = user2;
}

const User = struct {
    name: []const u8,
    fn init(args: struct { name: []const u8 }) User {
        return .{
            .name = args.name,
        };
    }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions