Skip to content
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

Auto-completion of overriding method does not respect keyword-only arguments #711

Closed
Azureblade3808 opened this issue Dec 10, 2020 · 5 comments
Assignees
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@Azureblade3808
Copy link

Environment data

  • Language Server version: 2020.12.1
  • OS and version: Windows 7
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.5(Anaconda)

Expected behaviour

With a parent class like:

class Parent:
    def foo(self, *, a):
        ...

And a child class like:

class Child(Parent):
    ...

After adding a overriding foo using auto-completion, code for Child should be like:

class Child(Parent):
    def foo(self, *, a):
        return super().foo(a=a)

Actual behaviour

Code for Child is:

class Child(Parent):
    def foo(self, *, a):
        return super().foo(a)
@Azureblade3808
Copy link
Author

As a side note, if the method in parent class has an argument with a default value, the auto-generated super-call always uses a keyword, which leads to another wrong situation:

class Parent:
    # "a" here is a positional-only argument and cannot be used with keyword.
    def foo(self, a=0, /):
        ...

class Child(Parent):
    def foo(self, a, /):
        return super().foo(a=a)

@viraj-shah18

This comment has been minimized.

@jakebailey

This comment has been minimized.

@jakebailey jakebailey added the needs investigation Could be an issue - needs investigation label Sep 1, 2021
@heejaechang heejaechang removed the needs investigation Could be an issue - needs investigation label Jan 6, 2022
@heejaechang heejaechang reopened this Jan 6, 2022
@heejaechang
Copy link
Contributor

should be closed when fix is released.

@heejaechang heejaechang added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Jan 6, 2022
@bschnurr
Copy link
Member

This issue has been fixed in version 2022.1.1, which we've just released. You can find the changelog here: CHANGELOG.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

7 participants