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

Intellisense should offer super()-calls when overwriting inherited methods #668

Closed
hmeine opened this issue Oct 13, 2020 · 5 comments
Closed
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@hmeine
Copy link

hmeine commented Oct 13, 2020

In a subclass, I can type "def so" and get an autocompletion popup offering "def some_method" with the complete signature from a parent class I inherit from. I would like these stubs to contain a super call (e.g., super(SubClass, self).some_method(argument1, argument2).

If the method should better be empty by design (not knowing whether a super call makes sense), it would be nice to be able to type "super" and get the full super call offered as IntelliSense completion.

@karthiknadig
Copy link
Member

Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision.

@hmeine hmeine changed the title Intellisense-completed prototypes for overwriting inherited methods should contain super()-call Intellisense should offer super()-calls when overwriting inherited methods Oct 15, 2020
@hmeine
Copy link
Author

hmeine commented Oct 15, 2020

Great. I have just changed the title a little bit, because I believe that – while it may be more difficult to implement, I don't know – the idea of offering the super() calls as separate completions within the method body would be less intrusive, more generally desirable, and more flexible (e.g., when the method already exists and the super() call should be added ex post).

@luabud luabud transferred this issue from microsoft/vscode-python Dec 2, 2020
@github-actions github-actions bot added the triage label Dec 2, 2020
@jakebailey
Copy link
Member

This will be fixed in the next Pylance release (though not the old form, as we don't support Python 2).

@jakebailey jakebailey added enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version labels Dec 2, 2020
@github-actions github-actions bot removed the triage label Dec 2, 2020
@jakebailey
Copy link
Member

This issue has been fixed in version 2020.12.0, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#2020120-2-december-2020

@Diogo-Rossi
Copy link

Diogo-Rossi commented Apr 4, 2022

This is a good feature, but can this remains as an option?
Sometimes we may don't want to add the super call (when implementing interfaces/abstract classes, for instance)

Edit

I've opened I new feature request for that #2531

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 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

5 participants