Skip to content

Add option to not show all overloads in hint #711

Closed

Description

@EIA485

it would be nice if there was a configuration option to consolidate overload function definitions in hints. Especially when they have the same number of arguments and underlying argument type

Image

selecting any of these hitnts results in the same thing being appended to my lua file.

Image

from there i still want all my overloads for argument suggestion (i like this behavior)

Image

global functions already behave this way

Image

here is the def for the example above

Image

basically im adding exact cases to a generic where i dont want all classes that inherent a base as suggestions

Activity

  1. added
    wontfix
    on Aug 14, 2025
  2. EIA485 commented on Aug 14, 2025

    @EIA485
    Author

    Hey 👋
    out of curiosity why is this a wontfix issue?
    this feature as an option would be quite useful in many cases. is it just not possible with the code's current infrastructure?

    here is another example of a case where it would be nice to not show all the overloads in the top level hint since its quite overwhelming

    Image Image

    i feel honored to be the only wont fix of 500 issues

  3. CppCXY commented on Aug 14, 2025

    @CppCXY
    Member

    Because I think overloading is a bit overused.
    you can try

    ---@generic T
    ---@param name std.ConstTpl<T>
    ---@return std.RawGet<Add, T>
    local function get(name)
    
    end
    local d = get("AA")
  4. taminomara commented on Aug 14, 2025

    @taminomara
    Contributor

    I don't think you need overloads in Root:Acquire at all. `T` should infer the correct class for you:

    Image

    Also, if you put all of your classes in a specific namespace, you can avoid huge bound on T as well:

    Image
  5. taminomara commented on Aug 14, 2025

    @taminomara
    Contributor

    @CppCXY seems like a bug?

    Image
    --- @enum PropertyIndex
    local PropertyIndex = {
        IgnoreNetwork = 0,
        StructureLocked = 1,
        -- ...
    }
    --- @enum PropertyNames
    local PropertyNames = {
        [0] = "IgnoreNetwork",
        [1] = "StructureLocked",
    }
    
    --- @generic T: PropertyIndex
    --- @param idx std.ConstTpl<T>
    --- @return std.Rawget<PropertyNames, T>
    function getPropertyName(idx) end
    
    local name = getPropertyName(0)
  6. CppCXY commented on Aug 14, 2025

    @CppCXY
    Member
    ---@enum(key) PropertyIndex
  7. EIA485 commented on Aug 14, 2025

    @EIA485
    Author

    I don't think you need overloads in Root:Acquire at all. `T` should infer the correct class for you:
    Image

    Also, if you put all of your classes in a specific namespace, you can avoid huge bound on T as well:
    Image

    generally: yes
    in this specific cases im doing some weird shenanigans to avoid certain classes and change their name under some conditions.
    that function def is generated code.
    i was just showing that as an example.

    to me - an option to make overload hints behave as they do on global functions seems like a useful wide-usecase option

  8. taminomara commented on Aug 14, 2025

    @taminomara
    Contributor

    ---@enum(key) PropertyIndex

    Sorry, I'm still not getting it... Can you elaborate please?

  9. xuhuanzy commented on Aug 14, 2025

    @xuhuanzy
    Member

    ---@enum(key) PropertyIndex

    Sorry, I'm still not getting it... Can you elaborate please?

    --- @enum PropertyNames actually retrieves its value, whereas ---@enum(key) PropertyIndex actually retrieves its key.

  10. EIA485 commented on Aug 14, 2025

    @EIA485
    Author

    is that documented somewhere? Ive been struggling to infer what annotations are possible

  11. taminomara commented on Aug 14, 2025

    @taminomara
    Contributor

    ---@enum(key) PropertyIndex

    Sorry, I'm still not getting it... Can you elaborate please?

    --- @enum PropertyNames actually retrieves its value, whereas ---@enum(key) PropertyIndex actually retrieves its key.

    Yeah, but how does this help in this particular case?

  12. taminomara commented on Aug 14, 2025

    @taminomara
    Contributor

    is that documented somewhere? Ive been struggling to infer what annotations are possible

    I don't think so, documentation needs a big overhaul.

  13. CppCXY commented on Aug 14, 2025

    @CppCXY
    Member

    --- @enum PropertyNames actually retrieves its value, whereas ---@enum(key) PropertyIndex actually retrieves its key.

    Yeah, but how does this help in this particular case?

    Only compatible with luals.

  14. EIA485 commented on Aug 14, 2025

    @EIA485
    Author

    I don't think so, documentation needs a big overhaul.

    ah ok. glad im not just missing something. QQ is tricky outside of china

  15. self-assigned this
    on Jun 20, 2026
  16. added and removed
    wontfix
    on Jun 20, 2026
  17. xuhuanzy commented on Jun 20, 2026

    @xuhuanzy
    Member

    Support an improvement to display literals when overloaded parameters are literals.

  18. added a commit that references this issue on Jun 22, 2026
    d561d08
  19. xuhuanzy commented on Jun 22, 2026

    @xuhuanzy
    Member

    Now he will be like this.

    Image
  20. added a commit that references this issue on Jun 22, 2026
    72f247c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions