Skip to content

Feature Request: Add completions for re-exported functions #423

@SpexGuy

Description

@SpexGuy

A common pattern in bindings to C code goes like this:

const Handle = opaque {
    pub const setValue = lib_Handle_setValue;
    pub fn setArrayValues(self: *Handle, values: []u32) void {
        lib_Handle_setArrayValues(self, values.ptr, values.len);
    }
    
    extern fn lib_Handle_setValue(self: *Handle, val: u32) void;
    extern fn lib_Handle_setArrayValues(self: *Handle, values: ?[*]u32, len: usize) void;
};

Here two C functions have been bound to the Handle type for more convenient use. setArrayValues is a proper wrapper, in order to use a slice parameter. But setValue does not need any signature modification, so it has been exported directly under a new name. Unfortunately, ZLS cannot recognize this pattern. Autocomplete on a handle pointer will suggest setArrayValues but not setValue. It would be very convenient if ZLS could recognize these sorts of pass-through member functions and add them to the autocomplete list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions