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

Created on 2016-07-25 00:03 by terry.reedy, last changed 2017-06-19 18:07 by terry.reedy.

Messages (7)
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) 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
History
Date User Action Args
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 builting extensions into regular modules, IDLE: Reduce number and time for user process imports
messages: + msg271187
2016-07-25 00:03:08terry.reedycreate