From 15b9ba01342884283e704cedbe85424e9f031512 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 5 Aug 2019 16:23:06 -0400 Subject: [PATCH 01/10] bpo-37765: Add keywords to IDLE's main completion list --- Lib/idlelib/autocomplete.py | 2 ++ Lib/idlelib/idle_test/test_autocomplete.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index c623d45a1534230..1834756ed0dd2c9 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -4,6 +4,7 @@ pop up a list of candidates. """ import __main__ +import keyword import os import string import sys @@ -175,6 +176,7 @@ def fetch_completions(self, what, mode): namespace = {**__main__.__builtins__.__dict__, **__main__.__dict__} bigl = eval("dir()", namespace) + bigl.extend(keyword.kwlist) bigl.sort() if "__all__" in bigl: smalll = sorted(eval("__all__", namespace)) diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py index 2c478cd5c2a1466..4790306dc022ba1 100644 --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -240,8 +240,9 @@ def test_fetch_completions(self): with patch.dict('__main__.__dict__', {'__all__': ['a', 'b']}): s, b = acp.fetch_completions('', ac.ATTRS) self.assertEqual(s, ['a', 'b']) - self.assertIn('__name__', b) # From __main__.__dict__ - self.assertIn('sum', b) # From __main__.__builtins__.__dict__ + self.assertIn('__name__', b) # From __main__.__dict__. + self.assertIn('sum', b) # From __main__.__builtins__.__dict__. + self.assertIn('and', b) # From keyword.kwlist. # Test attributes with name entity. mock = Mock() From 76053bf1cba7b93856761029708d5173b34e356d Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 7 Jul 2020 18:48:35 -0400 Subject: [PATCH 02/10] News item. --- Lib/idlelib/NEWS.txt | 2 ++ Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst | 1 + 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 7ae29af0b30ce3f..92f233b8b43154c 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,8 @@ Released on 2020-10-05? ====================================== +bpo-37765: Add longer keywords (len >= 5) to tab completion list. + bpo-41152: The encoding of ``stdin``, ``stdout`` and ``stderr`` in IDLE is now always UTF-8. diff --git a/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst b/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst new file mode 100644 index 000000000000000..37a6200ebe5ab1d --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst @@ -0,0 +1 @@ +Add longer keywords (len >= 5) to tab completion list. From 8d53070cbb6aac5ee7424a1797efee00a25f29e3 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 7 Jul 2020 18:51:17 -0400 Subject: [PATCH 03/10] Filter keywords by length and previous inclusion. --- Lib/idlelib/autocomplete.py | 6 ++++-- Lib/idlelib/idle_test/test_autocomplete.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index 1834756ed0dd2c9..a9de2a55cdedde4 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -172,11 +172,13 @@ def fetch_completions(self, what, mode): (what, mode), {}) else: if mode == ATTRS: - if what == "": + if what == "": # Main module names. namespace = {**__main__.__builtins__.__dict__, **__main__.__dict__} bigl = eval("dir()", namespace) - bigl.extend(keyword.kwlist) + key5 = (s for s in keyword.kwlist + if len(s) >= 5 and s != 'False') + bigl.extend(key5) bigl.sort() if "__all__" in bigl: smalll = sorted(eval("__all__", namespace)) diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py index f7866b777214043..22136332026c043 100644 --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -242,7 +242,10 @@ def test_fetch_completions(self): self.assertEqual(s, ['a', 'b']) self.assertIn('__name__', b) # From __main__.__dict__. self.assertIn('sum', b) # From __main__.__builtins__.__dict__. - self.assertIn('and', b) # From keyword.kwlist. + self.assertNotIn('pass', b) # Exclude keywords <= 4. + self.assertIn('async', b) # Include keywords >= 5. + pos = b.index('False') # Test False not included twice. + self.assertNotEqual(b[pos+1], 'False') # Test attributes with name entity. mock = Mock() From 561a52a7901785f9238ee565703a48686b233db7 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 7 Jul 2020 23:28:22 -0400 Subject: [PATCH 04/10] Revise completions doc. --- Doc/library/idle.rst | 79 ++++++++++++++++++++----------------------- Lib/idlelib/help.html | 76 ++++++++++++++++++++--------------------- 2 files changed, 75 insertions(+), 80 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index b1192e7bb465523..0ecf57f7f84d5a4 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -147,7 +147,7 @@ Go to Line Clear any selection and update the line and column status. Show Completions - Open a scrollable list allowing selection of keywords and attributes. See + Open a scrollable list allowing selection of existing names. See :ref:`Completions ` in the Editing and navigation section below. Expand Word @@ -469,52 +469,47 @@ are restricted to four spaces due to Tcl/Tk limitations. See also the indent/dedent region commands on the :ref:`Format menu `. - .. _completions: Completions ^^^^^^^^^^^ -Completions are supplied for functions, classes, and attributes of classes, -both built-in and user-defined. Completions are also provided for -filenames. - -The AutoCompleteWindow (ACW) will open after a predefined delay (default is -two seconds) after a '.' or (in a string) an os.sep is typed. If after one -of those characters (plus zero or more other characters) a tab is typed -the ACW will open immediately if a possible continuation is found. - -If there is only one possible completion for the characters entered, a -:kbd:`Tab` will supply that completion without opening the ACW. - -'Show Completions' will force open a completions window, by default the -:kbd:`C-space` will open a completions window. In an empty -string, this will contain the files in the current directory. On a -blank line, it will contain the built-in and user-defined functions and -classes in the current namespaces, plus any modules imported. If some -characters have been entered, the ACW will attempt to be more specific. - -If a string of characters is typed, the ACW selection will jump to the -entry most closely matching those characters. Entering a :kbd:`tab` will -cause the longest non-ambiguous match to be entered in the Editor window or -Shell. Two :kbd:`tab` in a row will supply the current ACW selection, as -will return or a double click. Cursor keys, Page Up/Down, mouse selection, -and the scroll wheel all operate on the ACW. - -"Hidden" attributes can be accessed by typing the beginning of hidden -name after a '.', e.g. '_'. This allows access to modules with -``__all__`` set, or to class-private attributes. - -Completions and the 'Expand Word' facility can save a lot of typing! - -Completions are currently limited to those in the namespaces. Names in -an Editor window which are not via ``__main__`` and :data:`sys.modules` will -not be found. Run the module once with your imports to correct this situation. -Note that IDLE itself places quite a few modules in sys.modules, so -much can be found by default, e.g. the re module. - -If you don't like the ACW popping up unbidden, simply make the delay -longer or disable the extension. +When available, completions are supplied for filenames and for +attributes of modules, classes, and functions. This is usually done +by displaying a completion box listing existing names. The name +being completed and the item highlighted in the box can be changed by +adding and deleting characters, with Up, Down, Page Up, Page Down, Home +and End keys, and by a single click within the box. Keys , +, and double and clicks outside the box close the box. +A double click within the box selects and closes. + +An attribute completion box will automatically open, if any completions +are available, if one types '.' and waits for a predefined +delay. The delay defaults to 2 seconds and can be set in the settings +dialog. If one types os.sep or os.altsep in a string and waits, +a completion box opens with filenames in the current directory. +Typing a separator after a directory name changes the list to that +directory. To prevent auto popups, set the delay to a large number of +milliseconds, such as 100000000. + +One can try to directly open a completion box with Show Completions on +the Edit menu. The default hot key is :kbd:`C-space`. If one types a +prefix for the desired name before opening the box, the +first match is displayed. This is the same as if one enters a prefix +after the box is displayed. The same is usually true if one hits +. However, if there is only one match to an existing prefix, +it is immediately added to the editor text without opening a box. + +'Show Completions' outside of a string and without a preceding '.' +opens a box with keywords at least 5 letters long, all builtin names, +and available module-level names. When editing code in an editor +(as oppose to Shell), the latter can be updated by running your code +and not restarting the Shell thereafter. This is especially useful +after adding imports at the top of a file. + +Completion boxes intially exclude names beginning with '_' or, for +modules, not included in '__all__'. The hidden names can be accessed +by typing '_' after '.', either before or after the box is opened. .. _calltips: diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 424c6b50f339e1c..10a99f0d6c4d74a 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -4,7 +4,7 @@ - IDLE — Python 3.9.0a4 documentation + IDLE — Python 3.10.0a0 documentation @@ -17,7 +17,7 @@ @@ -71,7 +71,7 @@

Navigation

  • - 3.9.0a4 Documentation » + 3.10.0a0 Documentation »
  • @@ -201,7 +201,7 @@

    Edit menu (Shell and Editor)Completions in the Editing and navigation section below.

    Expand Word

    Expand a prefix you have typed to match a full word in the same window; @@ -465,38 +465,38 @@

    Automatic indentation

    Completions

    -

    Completions are supplied for functions, classes, and attributes of classes, -both built-in and user-defined. Completions are also provided for -filenames.

    -

    The AutoCompleteWindow (ACW) will open after a predefined delay (default is -two seconds) after a ‘.’ or (in a string) an os.sep is typed. If after one -of those characters (plus zero or more other characters) a tab is typed -the ACW will open immediately if a possible continuation is found.

    -

    If there is only one possible completion for the characters entered, a -Tab will supply that completion without opening the ACW.

    -

    ‘Show Completions’ will force open a completions window, by default the -C-space will open a completions window. In an empty -string, this will contain the files in the current directory. On a -blank line, it will contain the built-in and user-defined functions and -classes in the current namespaces, plus any modules imported. If some -characters have been entered, the ACW will attempt to be more specific.

    -

    If a string of characters is typed, the ACW selection will jump to the -entry most closely matching those characters. Entering a tab will -cause the longest non-ambiguous match to be entered in the Editor window or -Shell. Two tab in a row will supply the current ACW selection, as -will return or a double click. Cursor keys, Page Up/Down, mouse selection, -and the scroll wheel all operate on the ACW.

    -

    “Hidden” attributes can be accessed by typing the beginning of hidden -name after a ‘.’, e.g. ‘_’. This allows access to modules with -__all__ set, or to class-private attributes.

    -

    Completions and the ‘Expand Word’ facility can save a lot of typing!

    -

    Completions are currently limited to those in the namespaces. Names in -an Editor window which are not via __main__ and sys.modules will -not be found. Run the module once with your imports to correct this situation. -Note that IDLE itself places quite a few modules in sys.modules, so -much can be found by default, e.g. the re module.

    -

    If you don’t like the ACW popping up unbidden, simply make the delay -longer or disable the extension.

    +

    When available, completions are supplied for filenames and for +attributes of modules, classes, and functions. This is usually done +by displaying a completion box listing existing names. The name +being completed and the item highlighted in the box can be changed by +adding and deleting characters, with Up, Down, Page Up, Page Down, Home +and End keys, and by a single click within the box. Keys <Escape>, +<Enter>, and double <Tab> and clicks outside the box close the box. +A double click within the box selects and closes.

    +

    An attribute completion box will automatically open, if any completions +are available, if one types ‘.’ and waits for a predefined +delay. The delay defaults to 2 seconds and can be set in the settings +dialog. If one types os.sep or os.altsep in a string and waits, +a completion box opens with filenames in the current directory. +Typing a separator after a directory name changes the list to that +directory. To prevent auto popups, set the delay to a large number of +milliseconds, such as 100000000.

    +

    One can try to directly open a completion box with Show Completions on +the Edit menu. The default hot key is C-space. If one types a +prefix for the desired name before opening the box, the +first match is displayed. This is the same as if one enters a prefix +after the box is displayed. The same is usually true if one hits +<Tab>. However, if there is only one match to an existing prefix, +it is immediately added to the editor text without opening a box.

    +

    ‘Show Completions’ outside of a string and without a preceding ‘.’ +opens a box with keywords at least 5 letters long, all builtin names, +and available module-level names. When editing code in an editor +(as oppose to Shell), the latter can be updated by running your code +and not restarting the Shell thereafter. This is especially useful +after adding imports at the top of a file.

    +

    Completion boxes intially exclude names beginning with ‘_’ or, for +modules, not included in ‘__all__’. The hidden names can be accessed +by typing ‘_’ after ‘.’, either before or after the box is opened.

    Calltips

    @@ -935,7 +935,7 @@

    Navigation

  • - 3.9.0a4 Documentation » + 3.10.0a0 Documentation »
  • @@ -966,7 +966,7 @@

    Navigation



    - Last updated on Mar 07, 2020. + Last updated on Jul 07, 2020. Found a bug?
    From 31b2fc3163300fdb25c29010e342bf91dd470b7e Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jul 2020 18:47:36 -0400 Subject: [PATCH 05/10] that lists Co-authored-by: Cheryl Sabella --- Doc/library/idle.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 0ecf57f7f84d5a4..dd3042956bad819 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -476,7 +476,7 @@ Completions When available, completions are supplied for filenames and for attributes of modules, classes, and functions. This is usually done -by displaying a completion box listing existing names. The name +by displaying a completion box that lists existing names. The name being completed and the item highlighted in the box can be changed by adding and deleting characters, with Up, Down, Page Up, Page Down, Home and End keys, and by a single click within the box. Keys , From f8a8cad66f42007de1f9753b5f3d1c2815461f38 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jul 2020 20:06:55 -0400 Subject: [PATCH 06/10] Add date directive. Co-authored-by: Cheryl Sabella --- Doc/library/idle.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index dd3042956bad819..097d028d7930ab0 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -486,7 +486,7 @@ A double click within the box selects and closes. An attribute completion box will automatically open, if any completions are available, if one types '.' and waits for a predefined delay. The delay defaults to 2 seconds and can be set in the settings -dialog. If one types os.sep or os.altsep in a string and waits, +dialog. If one types an :data:`os.sep` or :data:`os.altsep` in a string and waits, a completion box opens with filenames in the current directory. Typing a separator after a directory name changes the list to that directory. To prevent auto popups, set the delay to a large number of From ee2450bffa8ffe328a099297fae1a14e868e041f Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jul 2020 20:30:32 -0400 Subject: [PATCH 07/10] Revise news item. --- Lib/idlelib/NEWS.txt | 3 ++- Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 92f233b8b43154c..1c5c03da86efc57 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,7 +3,8 @@ Released on 2020-10-05? ====================================== -bpo-37765: Add longer keywords (len >= 5) to tab completion list. +bpo-37765: Add keywords to module name completion list. Rewrite +Completions section of IDLE doc. bpo-41152: The encoding of ``stdin``, ``stdout`` and ``stderr`` in IDLE is now always UTF-8. diff --git a/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst b/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst index 37a6200ebe5ab1d..f8b53ca482a21e8 100644 --- a/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst +++ b/Misc/NEWS.d/next/IDLE/2020-07-07-18-44-30.bpo-37765.umc1o8.rst @@ -1 +1,2 @@ -Add longer keywords (len >= 5) to tab completion list. +Add keywords to module name completion list. Rewrite Completions +section of IDLE doc. From 061d96bb23f6e24ddd66c28f01c080d67c790814 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jul 2020 20:40:17 -0400 Subject: [PATCH 08/10] Include all keywords. --- Lib/idlelib/autocomplete.py | 6 +++--- Lib/idlelib/idle_test/test_autocomplete.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index a9de2a55cdedde4..e1e9e17311eda1e 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -176,9 +176,9 @@ def fetch_completions(self, what, mode): namespace = {**__main__.__builtins__.__dict__, **__main__.__dict__} bigl = eval("dir()", namespace) - key5 = (s for s in keyword.kwlist - if len(s) >= 5 and s != 'False') - bigl.extend(key5) + kwds = (s for s in keyword.kwlist + if s not in {'True', 'False', 'None'}) + bigl.extend(kwds) bigl.sort() if "__all__" in bigl: smalll = sorted(eval("__all__", namespace)) diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py index 22136332026c043..9c113bd893f1378 100644 --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -242,8 +242,7 @@ def test_fetch_completions(self): self.assertEqual(s, ['a', 'b']) self.assertIn('__name__', b) # From __main__.__dict__. self.assertIn('sum', b) # From __main__.__builtins__.__dict__. - self.assertNotIn('pass', b) # Exclude keywords <= 4. - self.assertIn('async', b) # Include keywords >= 5. + self.assertIn('nonlocal', b) # From keyword.kwlist. pos = b.index('False') # Test False not included twice. self.assertNotEqual(b[pos+1], 'False') From f4fe92069aaac9a728e58f99018e4dd65abeb32d Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Wed, 8 Jul 2020 22:26:48 -0400 Subject: [PATCH 09/10] Revise revised text. --- Doc/library/idle.rst | 69 +++++++++++++++++++++++++------------------ Lib/idlelib/help.html | 65 ++++++++++++++++++++++------------------ 2 files changed, 77 insertions(+), 57 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 097d028d7930ab0..a81f3901c596cb5 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -474,38 +474,49 @@ See also the indent/dedent region commands on the Completions ^^^^^^^^^^^ -When available, completions are supplied for filenames and for -attributes of modules, classes, and functions. This is usually done -by displaying a completion box that lists existing names. The name -being completed and the item highlighted in the box can be changed by -adding and deleting characters, with Up, Down, Page Up, Page Down, Home -and End keys, and by a single click within the box. Keys , -, and double and clicks outside the box close the box. +Completions are supplied, when requested and available, for module +names, attributes of classes or functions, or filenames. Each request +method displays a completion box with existing names. (See tab +completions below for an exception.) For any box, change the name +being completed and the item highlighted in the box by +typing and deleting characters; by hitting :kbd:`Up`, :kbd:`Down`, +:kbd:`PageUp`, :kbd:`PageDown`, :kbd:`Home`, and :kbd:`End` keys; +and by a single click within the box. Close the box with :kbd:`Escape`, +:kbd:`Enter`, and double :kbd:`Tab` keys or clicks outside the box. A double click within the box selects and closes. -An attribute completion box will automatically open, if any completions -are available, if one types '.' and waits for a predefined -delay. The delay defaults to 2 seconds and can be set in the settings -dialog. If one types an :data:`os.sep` or :data:`os.altsep` in a string and waits, -a completion box opens with filenames in the current directory. -Typing a separator after a directory name changes the list to that -directory. To prevent auto popups, set the delay to a large number of -milliseconds, such as 100000000. - -One can try to directly open a completion box with Show Completions on -the Edit menu. The default hot key is :kbd:`C-space`. If one types a -prefix for the desired name before opening the box, the -first match is displayed. This is the same as if one enters a prefix -after the box is displayed. The same is usually true if one hits -. However, if there is only one match to an existing prefix, -it is immediately added to the editor text without opening a box. - -'Show Completions' outside of a string and without a preceding '.' -opens a box with keywords at least 5 letters long, all builtin names, -and available module-level names. When editing code in an editor -(as oppose to Shell), the latter can be updated by running your code +One way to open a box is to type a key character and wait for a +predefined interval. This defaults to 2 seconds; customize it +in the settings dialog. (To prevent auto popups, set the delay to a +large number of milliseconds, such as 100000000.) For imported module +names or class or function attributes, type '.'. +For filenames in the root directory, type :data:`os.sep` or +data:`os.altsep` immediately after an opening quote. (On Windows, +one can specify a drive first.) Move into subdirectories by typing a +directory name and a separator. + +Instead of waiting, or after a box is closed. open a completion box +immediately with Show Completions on the Edit menu. The default hot +key is :kbd:`C-space`. If one types a prefix for the desired name +before opening the box, the first match is displayed. +The result is the same as if one enters a prefix +after the box is displayed. Show Completions after a quote completes +filenames in the current directory instead of a root directory. + +Hitting :kbd:`Tab` after a prefix usually has the same effect as Show +Completions. (With no prefix, it indents.) However, if there is only +one match to the prefix, that match is immediately added to the editor +text without opening a box. + +Invoking 'Show Completions', or hitting :kbd:`Tab` after a prefix, +outside of a string and without a preceding '.' opens a box with +keywords, builtin names, and available module-level names. + +When editing code in an editor (as oppose to Shell), increase the +available module-level names by running your code and not restarting the Shell thereafter. This is especially useful -after adding imports at the top of a file. +after adding imports at the top of a file. This also increases +possible attribute completions. Completion boxes intially exclude names beginning with '_' or, for modules, not included in '__all__'. The hidden names can be accessed diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 10a99f0d6c4d74a..81ce5100bb8ad5d 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -465,35 +465,44 @@

    Automatic indentation

    Completions

    -

    When available, completions are supplied for filenames and for -attributes of modules, classes, and functions. This is usually done -by displaying a completion box listing existing names. The name -being completed and the item highlighted in the box can be changed by -adding and deleting characters, with Up, Down, Page Up, Page Down, Home -and End keys, and by a single click within the box. Keys <Escape>, -<Enter>, and double <Tab> and clicks outside the box close the box. +

    Completions are supplied, when requested and available, for module +names, attributes of classes or functions, or filenames. Each request +method displays a completion box with existing names. (See tab +completions below for an exception.) For any box, change the name +being completed and the item highlighted in the box by +typing and deleting characters; by hitting Up, Down, +PageUp, PageDown, Home, and End keys; +and by a single click within the box. Close the box with Escape, +Enter, and double Tab keys or clicks outside the box. A double click within the box selects and closes.

    -

    An attribute completion box will automatically open, if any completions -are available, if one types ‘.’ and waits for a predefined -delay. The delay defaults to 2 seconds and can be set in the settings -dialog. If one types os.sep or os.altsep in a string and waits, -a completion box opens with filenames in the current directory. -Typing a separator after a directory name changes the list to that -directory. To prevent auto popups, set the delay to a large number of -milliseconds, such as 100000000.

    -

    One can try to directly open a completion box with Show Completions on -the Edit menu. The default hot key is C-space. If one types a -prefix for the desired name before opening the box, the -first match is displayed. This is the same as if one enters a prefix -after the box is displayed. The same is usually true if one hits -<Tab>. However, if there is only one match to an existing prefix, -it is immediately added to the editor text without opening a box.

    -

    ‘Show Completions’ outside of a string and without a preceding ‘.’ -opens a box with keywords at least 5 letters long, all builtin names, -and available module-level names. When editing code in an editor -(as oppose to Shell), the latter can be updated by running your code +

    One way to open a box is to type a key character and wait for a +predefined interval. This defaults to 2 seconds; customize it +in the settings dialog. (To prevent auto popups, set the delay to a +large number of milliseconds, such as 100000000.) For imported module +names or class or function attributes, type ‘.’. +For filenames in the root directory, type os.sep or +data:os.altsep immediately after an opening quote. (On Windows, +one can specify a drive first.) Move into subdirectories by typing a +directory name and a separator.

    +

    Instead of waiting, or after a box is closed. open a completion box +immediately with Show Completions on the Edit menu. The default hot +key is C-space. If one types a prefix for the desired name +before opening the box, the first match is displayed. +The result is the same as if one enters a prefix +after the box is displayed. Show Completions after a quote completes +filenames in the current directory instead of a root directory.

    +

    Hitting Tab after a prefix usually has the same effect as Show +Completions. (With no prefix, it indents.) However, if there is only +one match to the prefix, that match is immediately added to the editor +text without opening a box.

    +

    Invoking ‘Show Completions’, or hitting Tab after a prefix, +outside of a string and without a preceding ‘.’ opens a box with +keywords, builtin names, and available module-level names.

    +

    When editing code in an editor (as oppose to Shell), increase the +available module-level names by running your code and not restarting the Shell thereafter. This is especially useful -after adding imports at the top of a file.

    +after adding imports at the top of a file. This also increases +possible attribute completions.

    Completion boxes intially exclude names beginning with ‘_’ or, for modules, not included in ‘__all__’. The hidden names can be accessed by typing ‘_’ after ‘.’, either before or after the box is opened.

    @@ -966,7 +975,7 @@

    Navigation



    - Last updated on Jul 07, 2020. + Last updated on Jul 08, 2020. Found a bug?
    From 526db49c61dc6e9d71e2537e11ada6c73a3815f5 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Thu, 9 Jul 2020 16:22:49 -0400 Subject: [PATCH 10/10] Update idle.rst --- Doc/library/idle.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index a81f3901c596cb5..75b6fa3861b23d0 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -495,10 +495,10 @@ data:`os.altsep` immediately after an opening quote. (On Windows, one can specify a drive first.) Move into subdirectories by typing a directory name and a separator. -Instead of waiting, or after a box is closed. open a completion box +Instead of waiting, or after a box is closed, open a completion box immediately with Show Completions on the Edit menu. The default hot key is :kbd:`C-space`. If one types a prefix for the desired name -before opening the box, the first match is displayed. +before opening the box, the first match or near miss is made visible. The result is the same as if one enters a prefix after the box is displayed. Show Completions after a quote completes filenames in the current directory instead of a root directory.