pthom / imgui_bundle

Dear ImGui Bundle: an extensive set of Ready-to-use widgets and libraries, based on ImGui. Start your first app in 5 lines of code, or less. Whether you prefer Python or C++, this pack has your back!
https://pthom.github.io/imgui_bundle/
MIT License
592 stars 63 forks source link

Using the `@overload` decorator with overloaded functions #139

Closed corbane closed 8 months ago

corbane commented 8 months ago

Hello,

At the beginning of the year, I had not noticed this problem, but today when opening an imgui_bundle project in VSCode (configured with Python by default: Pylance), I get errors with overloaded functions:

image

Reading PEP 484 from python 3.5: https://peps.python.org/pep-0484/#function-method-overloading I reformatted some .pyi files with the @overload decorator:

image

The solution was given to me by this link which concerns PyCharm and Typeshed. It therefore seems that this error is not specific to Pylance but an error in respecting PEP 484.

Is it possible in future versions to add the @overload operators? merci

pthom commented 8 months ago

Hello,

Since I had some time today, I worked on this. I needed to adapt the autogenerator. It went smoothly, so I updated the stubs in this commit

You will need to build from source: see https://pthom.github.io/imgui_bundle/#_build_and_install_instructions

corbane commented 8 months ago

Ha! Great!

Where is the autogenerator located in the repository? found: https://github.com/pthom/srcmlcpp/commit/01ebe2a8e93883710f9f73710855c2a7dd013c78

pthom commented 8 months ago

Yes, the generator is indeed there. It is a big piece of software, which I did not take to document yet