[issue25419] Readline completion of module names in import statements

2016-05-25 Thread Martin Panter
Martin Panter added the comment: I moved all the calls targetting the readline module into a ReadlineCompleter subclass. However the logic for parsing “import” statements still exists in the base Completer class in private methods. An overview of the two classes: class Completer: def compl

[issue25419] Readline completion of module names in import statements

2015-10-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added few cursory comments on Rietveld. "sys" and "os.path" cases are not critical and we can ignore them if it complicates the code. But preserving Completer independence from readline looks more important to me. We can just add methods get_line_buffer(), g

[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Martin Panter
Martin Panter added the comment: Josh: Thanks for pointing out I Python. I haven’t used it much myself, but it does seem to do a similar thing to my proposal. Looks like the relevant code may be around module_completion() at

[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is there a reason ipython's import completer couldn't be borrowed in its entirety? At work, I use a lightly adapted version of the code from ipython to do completion when I'm using the plain interactive interpreter (for whatever reason), and it works just fine

[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm reviewing the patch, but it will take a time. Wouldn't be simpler to use regular expressions instead of tokenizer? For now Completer doesn't depends on the readline module, nor other global state. It can be used for completing in other environment, for e

[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Martin Panter
New submission from Martin Panter: As mentioned in Issue 25209, here is a patch to complete module and attribute names in import statements. This is a rewrite of some personal code I have had kicking around for a few years, but I have added extra features (parsing “import x as alias”, supporti