Skip to content

Add autocompletion for instanciation #2869

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

Open
JustAnotherVeryNormalDeveloper opened this issue Jan 7, 2025 · 0 comments
Open

Add autocompletion for instanciation #2869

JustAnotherVeryNormalDeveloper opened this issue Jan 7, 2025 · 0 comments

Comments

@JustAnotherVeryNormalDeveloper
Copy link

JustAnotherVeryNormalDeveloper commented Jan 7, 2025

On Visual Studio Code, there is no useful hint on the parameters and the type for the instanciation of the object.

Example:

from mongoengine import Document, StringField

class User(Document):  
    name = StringField(required=True)
    surname = StringField(required=False)

user = User(

HINT: (...) -> User

To have useful hint, I am doing that on my project:
Example:

from typing import Optional
from mongoengine import Document, StringField

class User(Document):  
    name = StringField(required=True)
    surname = StringField(required=False)

    def __init__(self, name: str, surname: Optional[str], *args, **kwargs):  
        super().__init__(name=name, surname=surname, *args, **kwargs) 

user = User(

HINT: (name: str, surname: str | None, ...) -> User

This is really practical but I have to do a lot of duplication of code, is there a way to propose the attributes "automatically" ? can I help you do that ?

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

No branches or pull requests

1 participant