Three Dots (Ellipsis) appears using python code completion in vscode in __init__ of a subclass

Viewed 44

I'm working on a bigger Python project and I tried to implement type hinting along with default values for the constructor of a base class. Everything worked fined but when I try to use the auto completion of Vscode to define the constructor of a derived class some default values are replaced with "..." (presumably Python's Ellipsis). However when I try to recreate the same thing on a much smaller scale (see below) it doesn't occur and takes the right default value from the parent class.

The default value includes an astropy unit. I don't know if that's important but the small example can handle it.

file1.py

import astropy.units as u

class A:
  def __init__(a:int=1, b:u.Quantity[u.yr]=0*u.yr)->None:
    pass

How it should look like:

file2.py

import astropy.units as u

from .file2.py import A
class B(A):
  def __init__(a:int=1, b:u.Quantity[u.yr]=0*u.yr)->None:
    pass

What Vscode auto-completion does in the bigger project:

file2.py

import astropy.units as u

from .file2.py import A
class B(A):
  def __init__(a:int=1, b:u.Quantity[u.yr]=...)->None:
    pass

Is this maybe intended when the argument list gets too long (which might be the case for me)? And what can I do to get it to work?

1 Answers

According to the issue on github.

This will be fixed in an upcoming version of pylance.

Tips:

This has been fixed in version 2022.9.31.

enter image description here

Related