Hello,
I came across a bug with the auto completion in functions in the python shell.
if we define a function with default values such as:
def add(firstValue=0,secondValue=1):
return firstValue+secondValue
so we can use it with no defined inputs as: add() (it is a dummy example to reproduce the issue)
- if we go up (so come back to previous line to re do the call, but modifying something.) in my case i came across when doing this and wanting to call the function with same parameters but change a default flag. so we get
add()but modifiable - we go inside the
()of the add, and typefirso, the line would look like this:add(fir|)the|is to indicate where the pointer of the wrinting is at that moment - we hit tab to autocomplete to
firstValue, (classic behavior of python) instead of gettingadd(firstValue)as one should get (and as one gets if it begings from a blankadd() one getsadd(firfirstValue
A. so there is a bug in the autocompletion.
B. i also notice that if we fill up the first input of the function, put a comma and try to auto fill the second input it does not auto fill. should i make a feature request for this?
edit: for the case of A. the bug comes directly from trying to use the auto fill not when going back to previous line, but simply if one wants to fill up a function that has already the parentesis closed. so if one defines the add function as i give in the example, and type add() put the cursor inside the () and writes fir and hit tab, it will become add(firfirstValue
EDIT:
okey more investigation on this, it looks like the behavior is:
-
if i am auto completing and have text after it, it will add the autocompletion BUT it will erase partially or totally what is after. so something like(the
|is to indicate current position where one hit tab):myObject.get|XXXXand gets suggestedgetPartif one hits enter what is wrote, it will simply disappear and the text will becomemyObject.getPartwith the missingXXXX -
also a particular case, if there is a parenthesis before the tab hit,so for example
myObject.get|(flag, in this case it will also remove the things after (not fully sure HOW it is removing the after as sometimes i am getting a section of the after still there, sometimes it is fully gone.) the insertion but also leave the things before! so one getsmyObject.getgetPart