This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE completions: format, factor, and fix
Type: behavior Stage: needs patch
Components: IDLE Versions: Python 3.10
process
Status: open Resolution:
Dependencies: 16198 17238 18766 21261 22554 27099 27534 27675 30632 30666 30667 37765 37766 38943 38944 40892 Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, terry.reedy
Priority: normal Keywords:

Created on 2016-07-25 00:03 by terry.reedy, last changed 2022-04-11 14:58 by admin.

Messages (13)
msg271186 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-07-25 00:03
IDLE completions are currently implemented in two files: autocomplete.py and autocomplete_w.py.  (Before 3.6, these were AutoComplete.py and AutoCompleteWindow.py.) The first handles 'open' events, decideds whether to open a window, and gathers possible completions.  The second open a popup and works with the sorted list of possible completions. There are several tracker issues already.

#15786 Code completion problems with mouse and <return>.
      These lead to freezes on on Mac.  Severity: bad; prioriy: high.
#16198 Tabbing in string brings up completion when it should not.
#17238 Enhance import statement completion.
#18766 Add completions for un-imported modules (by importing).
#18903 File completions are case sensitive, should not be on Windows.
#21261 Complete dictionary keys.
#22554 Popup window for names also.  

#27099 Convert autocomplete to normal feature, along with other 'extensions'.  Add delay to current tab.  Negative delay should disable auto-popups.
#27534 Move objects needed by run to run.py and import from there.

There are more that are not on the tracker.  Patches may be attached here or to new issues.

A. Use PEP8 style.  1.'return None' when there are non-None returns. 2. Docstrings for all functions.
B. Merge autocomplete_w into autocomplete.  This was anticipated in the renaming.  #27534 should be done first if possible, or soon after.
C. Refactor.  1 #27534.  2. Put list and scrollbar in Frame?  For future single-window IDLE?  This might make testing easier. 3. Anything else making tests easier.
D. Make completions work for number literals ("1 .") as well a string literals ("'a'.").
E?. Make completions work with Entry as well as Multicall wrapping text?  Need use case first.  Load Modules may need own code.

Question: Why does 'dooneevent' appear in 2.x code and not 3.x code?

Tests: The currently only for a subset of autocomplete methods.  There are none for the buggy window.

First, a patch for A.1, return None.
msg271187 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-07-25 00:08
Add dependencies.  Last two, #27099 and #27534 involve multiple files and should be removed from this autocomplete list when autocomplete part is done.
msg271190 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-07-25 00:35
New changeset 1ec47de72538 by Terry Jan Reedy in branch 'default':
Issue #27609: Explicitly return None when there are other returns.
https://hg.python.org/cpython/rev/1ec47de72538
msg271214 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-07-25 02:41
I just partly fixed #16198.  Anything more depends on a careful definition of desired behavior that turns out to be different from current behavior.
msg271923 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-08-03 19:34
Add 27675.  If open quote is ' or '', actions (character key or box selection with up or down arrow) after first are not colored.  ' and ''' do not complete, when needed, nor close.
msg296032 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-14 20:16
#30666 Add completion tests
#30667 Revise completion doc
#15786 and additional discussion of completion behavior
Tab in opened box should and usually completes, but sometimes not.  I don't have a consistent example.
msg296033 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-14 20:21
#30632 autocomplete tests
#30666 autocomplete_w tests
msg316311 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-09 06:26
In re-verifying #27675, the color bug seems to be gone.  The completion bug is still here, at least on Windows.

It would be good to sort the issues by whether they appear to affect autocomplete.py or autocomplete_w.py or both.
msg349070 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-08-05 20:37
#37765 Include keywords in ''(__main__) list.

###### Annotate completion list, at least as an option, with 'keyword' or class, possibly prefixed with 'built-in', so 'built-in function', 'function', and so on.

#37766 revise fetch_completions, add htest
msg358150 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-12-09 23:22
38943 Autocomplete box sometimes does not show on Ubuntu.
38944 Excape key should close completion box.
msg370846 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-06-06 19:25
40892 Use prefixes from rlcompleter.  Compute constant once.
msg373265 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-07-07 23:32
Normally, tab completion works for attributes (after '.' and a possible prefix) and files (after os.sep and a possible prefix).  Unique matches to prefixes are immediately selected, as for undotted module names.  After changing the completion wait time and before restarting, this is disabled and tab adds spaces instead.  This need a new issue and fix.
msg373433 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-07-09 23:51
The removed post duplicates the content of #37766.  Another bug is reported and will be fixed there.
History
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71796
2020-07-09 23:51:51terry.reedysetmessages: + msg373433
2020-07-09 22:47:10terry.reedysetmessages: - msg373259
2020-07-07 23:32:12terry.reedysetmessages: + msg373265
2020-07-07 22:29:55terry.reedysetmessages: + msg373259
2020-07-07 21:48:20terry.reedylinkissue41230 superseder
2020-06-06 19:25:44terry.reedysetdependencies: + IDLE: use rlcompleter suffixed for completions
messages: + msg370846
versions: + Python 3.10, - Python 3.6, Python 3.7, Python 3.8
2019-12-09 23:22:50terry.reedysetdependencies: + Idle autocomplete window doesn't show up, Idle completion windows should close on Escape key
messages: + msg358150
2019-08-05 20:37:01terry.reedysetdependencies: + IDLE: Include keywords in module-level autocomplete list, IDLE autocomplete: revise fetch_completions, add htest
messages: + msg349070
2018-05-09 06:26:26terry.reedysetnosy: + cheryl.sabella

messages: + msg316311
versions: + Python 3.7, Python 3.8
2017-06-19 18:07:29terry.reedysetcomponents: + IDLE
2017-06-14 20:21:06terry.reedysetdependencies: + IDLE: add unittests to test_autocomplete, IDLE: add tests for autocomplete window., IDLE: revise doc subsection 'Completions', - IDLE code completion window can hang or misbehave with mouse
messages: + msg296033
2017-06-14 20:16:03terry.reedysetnosy: - python-dev
messages: + msg296032
2016-08-03 19:34:05terry.reedysetdependencies: + IDLE file completion has 2 bugs depending on open quote used
messages: + msg271923
2016-07-25 02:41:24terry.reedysetmessages: + msg271214
2016-07-25 00:35:59python-devsetnosy: + python-dev
messages: + msg271190
2016-07-25 00:08:07terry.reedysetdependencies: + IDLE code completion window can hang or misbehave with mouse, IDLE - tabbing in a string always brings up file completion window, IDLE: Add import statement completion, IDLE: Autocomplete in editor doesn't work for un-imported modules, Teach IDLE to Autocomplete dictionary keys, Idle: optionally auto-pop-up completion window for names, IDLE: turn built-in extensions into regular modules, IDLE: Reduce number and time for user process imports
messages: + msg271187
2016-07-25 00:03:08terry.reedycreate