Subject: Re: bug#50459: 28.0.50; Python shell completion is incompatible with flex, orderless, etc.

From: Augusto Stoffel <[email-masked]>
Date: Sat, 11 Sep 2021 14:34:20 +0200

On Sat, 11 Sep 2021 at 14:09, Lars Ingebrigtsen <[email-masked]> wrote:

> Augusto Stoffel <[email-masked]> writes:
>
>> That's true: the logic here is that the completions are computed
>> eagerly, and then cached until still valid.  So if you type
>>
>>   fo<tab>o.bar.baz
>>
>> the inferior process is contacted 3 times: after the <tab>, and after
>> each dot.  Before, a lazy table was returned, but the inferior would be
>> contacted after each character anyway (if using Company or similar).
>
> Ah, I see, then that sounds like a definite improvement.  My other
> question is then how the cache is flushed...

The cache will be flushed, at the earliest, when a new call to
'python-shell-completion-at-point' is made.  And the criterium is the
following:

- If the prompt moved, then the cache is flushed.
- If the current completion prefix (the text between 'start' and 'end')
  is not identical to the original completion prefix, except for the
  addition of some word or symbol characters at the end, then the cache
  is flushed.

That's it in a nutshell.  I can give more details if you want.