-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
bpo-37765: Add keywords to IDLE tab completions #15138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
15b9ba0
e8e0dfa
76053bf
8d53070
561a52a
31b2fc3
f8a8cad
b898ac0
ee2450b
061d96b
f4fe920
526db49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 <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 <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 | ||
|
terryjreedy marked this conversation as resolved.
Outdated
|
||
| 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>, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you mention keys without enclosing them in brackets, but in the next line you enclose the keys in brackets. You also use the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was consistent within sentences ;-). Habit and history. The directive translates to |
||
| <Enter>, and double <Tab> and clicks outside the box close the box. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think 'close the box' is the point of this sentence, but it gets lost. It might be clearer to start with that. Or, alternatively, to reformat this paragraph somehow as a navigation section with bullets or subsections. Something like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I revised to "Close the box with ...", parallel to previous sentence. As to structure, we have a 3 dimensions: Open method (wait, hot key, tab), namespace (main, attribute, files), and stage (open select, close), with some cells blank (wait never opens the main namespace) and some entries identical. The existing order made little sense to me. I started with select and close because these are common to all open methods and lists. I made this more explicit. I follow with the 3 invocation methods and module level completions. In any case, there are more edits all through the doc and a will wait a day for more comments before merging. |
||
| 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, | ||
|
terryjreedy marked this conversation as resolved.
Outdated
|
||
| 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 | ||
| <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: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add longer keywords (len >= 5) to tab completion list. |
Uh oh!
There was an error while loading. Please reload this page.