You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
r"""[\w_][\w0-9._]*\[([\w0-9._(), '"]*)""" ______________________^^^^^^^^^^^^^^^^ this is the cause of the bug
It's using that regex to capture the current key of the dictionary for which it is showing text completion of keys in the interactive terminal, and the key portion of the dictionary in that regex is too restrictive. The text completion works better with the following regex: r"""[\w_][\w0-9._]*\[(.*)""" ______________________^^ something like this is how to fix the bug
Does this seem like a good adjustment to make?
Also, with this change there is still an issue; now, if you do the following in a bython interactive session, you cannot tab-complete the key for my_dict:
>>> my_dict = {'a\\a': 'Value'}
>>> my_dict['a\
I'll keep working on this to find out why the tab completion isn't working (I'm guessing it's another regex issue).
That seems like the right place to be adjusting to me. (.*) seems too general because it won't stop matching even when you've close the quotes or the square bracket of an index, something like "anything but a single or double quote" would be closer.
@thomasballinger Got the bug fixed and submitted pull request #920. Please let me know if there is an issue with the pull request; this is my first time contributing to an open source project!
Activity
thomasballinger commentedon Sep 26, 2021
Thanks for reporting! @arian-deimling you mentioned wanting to work on something earlier, do you want to give this a shot?
arian-deimling commentedon Sep 26, 2021
Sure
arian-deimling commentedon Sep 27, 2021
Hey, I found the issue, it's this line right here
bpython/bpython/line.py
Line 37 in b66a29f
r"""[\w_][\w0-9._]*\[([\w0-9._(), '"]*)"""______________________^^^^^^^^^^^^^^^^ this is the cause of the bugIt's using that regex to capture the current key of the dictionary for which it is showing text completion of keys in the interactive terminal, and the key portion of the dictionary in that regex is too restrictive. The text completion works better with the following regex:
r"""[\w_][\w0-9._]*\[(.*)"""______________________^^ something like this is how to fix the bugDoes this seem like a good adjustment to make?
Also, with this change there is still an issue; now, if you do the following in a bython interactive session, you cannot tab-complete the key for
my_dict:I'll keep working on this to find out why the tab completion isn't working (I'm guessing it's another regex issue).
thomasballinger commentedon Sep 27, 2021
That seems like the right place to be adjusting to me.
(.*)seems too general because it won't stop matching even when you've close the quotes or the square bracket of an index, something like "anything but a single or double quote" would be closer.arian-deimling commentedon Sep 27, 2021
@thomasballinger Got the bug fixed and submitted pull request #920. Please let me know if there is an issue with the pull request; this is my first time contributing to an open source project!