Subject: Re: bug#68559: [PATCH] Improve Python shell completion

From: kobarity <[email-masked]>
Date: Fri, 23 Feb 2024 23:39:05 +0900

Hi Liu,

I noticed that with Non-native completions, Jedi completion is not
enabled even if PYTHONSTARTUP is set and "REPL completion using Jedi
0.18.2" is shown in inferior Python. Is this expected behavior?  Jedi
completion is enabled regardless of PYTHONSTARTUP setting when I use
IPython with Non-native completions.

Mattias Engdegård wrote:
> > I think we can also improve Non-native completions.  Current
> > implementation sends the definition of __PYTHON_EL_get_completions()
> > every time.  However, sending it once during initialization should be
> > sufficient.  Worse, if the number of characters sent exceeds
> > `comint-max-line-length', it will be sent via file.  This is happening
> > in your environment.  Here is the log you presented.
> > 
> > Test python-completion-at-point-1 backtrace:
> >  json-parse-string("__PYTHON_EL_eval_file(\"/var/folders/qy/zstv16390
> > 
> > Thanks to the echo back, we can see __PYTHON_EL_eval_file() was used.
> 
> Right. (The need for a file is just an artefact of Comint limitations, isn't it?)

Yes, I think it is the limitation of comint.  However, if the
definition is omitted, it is unlikely to reach that limit, since all
that is required is to send the string like
'__PYTHON_EL_get_completions("subproc")'.