GNU bug report logs -
#68559
[PATCH] Improve Python shell completion
Previous Next
Reported by: Liu Hui <liuhui1610 <at> gmail.com>
Date: Thu, 18 Jan 2024 04:50:01 UTC
Severity: wishlist
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 68559 <at> debbugs.gnu.org (full text, mbox):
Liu Hui wrote:
> kobarity <kobarity <at> gmail.com> 于2024年1月25日周四 23:38写道:
> > 1. Module names cannot be completed in Python buffer.
> Can you elaborate? The completion of module names never worked for me
> except using IPython with non-native completion mechanism.
>
> Because module names cannot be completed using vanilla python
> interpreter in the terminal, they are also not completed even with the
> patch, unless jedi is available.
Hmm, I must have done something wrong. I cannot reproduce the problem
of module name completion even with the previous patch.
As for the current python-mode, I was able to complete the module
names because I enabled Jedi in PYTHONSTARTUP. Sorry for the confusion.
I'm experiencing strange behavior regarding completion of import
statement in a block in Python buffer. If I try to type the following
lines and then try to complete it, it will fail.
#+begin_src python
try:
im
#+end_src
However, when I try to complete at the beginning of the second line:
#+begin_src python
try:
#+end_src
"import" keyword also appears as a candidate. If I cancel the
candidates and type "im" and try to complete it, it will succeed.
This behavior does not occur in Python Shell buffer.
Another thing I noticed is the multi-line import statement. If the
import statement is one-line, each items (IGNORECASE and MULTILINE in
the example below) can be completed.
#+begin_src python
from re import IGNORECASE, MULTILINE
#+end_src
However, they cannot be completed if the import statement spans
multi-line.
#+begin_src python
from re import (
IGN
#+end_src
This happens in both Python buffer and Python Shell buffer. Perhaps
this is a limitation of Jedi completer?
> > 2. Completion is not working in comments.
> >
> > I'm not sure if the completion should work in comments, but some
> > people might want it because the current python-mode allows it in both
> > Python buffer and Python Shell buffer.
>
> Thanks for pointing it out. The attached patch should now restore
> previous basic completion behavior in comments.
Thanks, I confirmed that basic completion (without keyword argument
completion) can be performed within comments.
This bug report was last modified 1 year and 66 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.