-
Notifications
You must be signed in to change notification settings - Fork 130
Auto-completion of __init__(self, ) should not automatically include a "return" statement #1082
Comments
Regarding "Second, some libraries recommend initializing super by python-language-server/src/LanguageServer/Impl/Completion/FunctionDefinitionCompletion.cs Lines 81 to 93 in 6a2bcac
This should be special cased for |
I'm not sure that using Python version is sufficient to decide which boilerplate should be used. Users may be using a Python3 environment, but writing Python2-compatible code. There are also cases where there is no need to call But that is not the main point anyway. The real hard error is the |
@jakebailey I'm facing this issue as well. VS Code version: 1.37.0 (user setup) |
@PowerSnail commented on Mon May 06 2019
Environment data
Expected behaviour
Auto-completion for
__init__
method should not generatereturn super().__init__()
.__init__
should always return None. And, explicit return in__init__
is probably not appropriate anyway.Maybe it should just generate an empty method with a
pass
, and let the user fill in the the necessary initialization. First, many classes don't inherit anything (other thanobject
) andsuper().__init__()
should not be there. Second, some libraries recommend initializing super bysuper(MyClass, self).__init__()
. Users have to rewrite this anyway.Actual behaviour
Auto-completion generates something like this when click "tab" when typing
__init__
:Steps to reproduce:
def __ini
<tab>
Thanks.
@Jonas1312 commented on Wed May 08 2019
Same issue here
The text was updated successfully, but these errors were encountered: