Search code examples
pythonvisual-studio-codepylance

pylance autoimports aren't working as they should


I started a project in python using visual studio code but noticed something with autoimports

I have a function in a file (hellofolder/hello.py) with the following code

def hello():
    return "hello!"

However, when i try to import this function from another file(doHello.py) It doesn't appear as an import option image with the issue

But when I use quickfix to import the function quickfix image recognizing the function

even after deleting the import statement, it still becomes available without having to use quickfix again image of what I would expect usually

I don't know if this is how it's supposed to work or not, but I would like advice on how to get it to be like the third image

relevant settings

the file structure


Solution

  • According to the issue on github.

    At present, Pylance does not provide relevant functions. Only when the package is used will the prompt of automatic completion appear.

    Vscode is a lightweight editor. This is done to prevent users from customizing too many packages, resulting in too long reading time.