Skip to content

bpo-35521: IDLE: Add code context section to docs #11205

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

Merged
merged 5 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,16 @@ Go to Line

Show Completions
Open a scrollable list allowing selection of keywords and attributes. See
Completions in the Tips sections below.
:ref:`Completions <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;
repeat to get a different expansion.

Show call tip
After an unclosed parenthesis for a function, open a small window with
function parameter hints.
function parameter hints. See :ref:`Calltips <calltips>` in the
Editing and navigation section below.

Show surrounding parens
Highlight the surrounding parenthesis.
Expand Down Expand Up @@ -278,8 +279,8 @@ Configure IDLE

Code Context (toggle)(Editor Window only)
Open a pane at the top of the edit window which shows the block context
of the code which has scrolled above the top of the window. Clicking a
line in this pane exposes that line at the top of the editor.
of the code which has scrolled above the top of the window. See
:ref:`Code Context <code-context>` in the Editing and Navigation section below.

Window menu (Shell and Editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -310,8 +311,8 @@ Turtle Demo
Run the turtledemo module with example Python code and turtle drawings.

Additional help sources may be added here with the Configure IDLE dialog under
the General tab. See the "Help sources" subsection below for more
on Help menu choices.
the General tab. See the :ref:`Help sources <help-sources>` subsection below
for more on Help menu choices.

.. index::
single: Cut
Expand Down Expand Up @@ -359,6 +360,8 @@ Squeeze
the code above and the prompt below down to a 'Squeezed text' label.


.. _editing-and-navigation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will be used now, but it will in the future. I intend to convert non-menu-section references in a follow-up PR.


Editing and navigation
----------------------

Expand Down Expand Up @@ -431,6 +434,9 @@ are restricted to four spaces due to Tcl/Tk limitations.

See also the indent/dedent region commands in the edit menu.


.. _completions:

Completions
^^^^^^^^^^^

Expand Down Expand Up @@ -475,6 +481,8 @@ 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.

.. _calltips:

Calltips
^^^^^^^^

Expand Down Expand Up @@ -503,6 +511,25 @@ In an editor, import statements have no effect until one runs the file. One
might want to run a file after writing the import statements at the top,
or immediately run an existing file before editing.

.. _code-context:

Code Context
^^^^^^^^^^^^

Within an editor window containing Python code, code context can be toggled
in order to show or hide a pane at the top of the window. When shown, this
pane freezes the opening lines for block code, such as those beginning with
``class``, ``def``, or ``if`` keywords, that would have otherwise scrolled
out of view. The size of the pane will be expanded and contracted as needed
to show the all current levels of context, up to the maximum number of
lines defined in the Configure IDLE dialog (which defaults to 15). If there
are no current context lines and the feature is toggled on, a single blank
line will display. Clicking on a line in the context pane will move that
line to the top of the editor.

The text and background colors for the context pane can be configured under
the Highlights tab in the Configure IDLE dialog.

Python Shell window
^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -768,6 +795,8 @@ with the default subprocess if at all possible.
Help and preferences
--------------------

.. _help-sources:

Help sources
^^^^^^^^^^^^

Expand Down
39 changes: 28 additions & 11 deletions Lib/idlelib/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,14 @@ <h3>Edit menu (Shell and Editor)<a class="headerlink" href="#edit-menu-shell-and
<dd>Move cursor to the line number requested and make that line visible.</dd>
<dt>Show Completions</dt>
<dd>Open a scrollable list allowing selection of keywords and attributes. See
Completions in the Tips sections below.</dd>
<a class="reference internal" href="#completions"><span class="std std-ref">Completions</span></a> in the Editing and navigation section below.</dd>
<dt>Expand Word</dt>
<dd>Expand a prefix you have typed to match a full word in the same window;
repeat to get a different expansion.</dd>
<dt>Show call tip</dt>
<dd>After an unclosed parenthesis for a function, open a small window with
function parameter hints.</dd>
function parameter hints. See <a class="reference internal" href="#calltips"><span class="std std-ref">Calltips</span></a> in the
Editing and navigation section below.</dd>
<dt>Show surrounding parens</dt>
<dd>Highlight the surrounding parenthesis.</dd>
</dl>
Expand Down Expand Up @@ -314,8 +315,8 @@ <h3>Options menu (Shell and Editor)<a class="headerlink" href="#options-menu-she
</dd>
<dt>Code Context (toggle)(Editor Window only)</dt>
<dd>Open a pane at the top of the edit window which shows the block context
of the code which has scrolled above the top of the window. Clicking a
line in this pane exposes that line at the top of the editor.</dd>
of the code which has scrolled above the top of the window. See
<a class="reference internal" href="#code-context"><span class="std std-ref">Code Context</span></a> in the Editing and Navigation section below.</dd>
</dl>
</div>
<div class="section" id="window-menu-shell-and-editor">
Expand Down Expand Up @@ -344,8 +345,8 @@ <h3>Help menu (Shell and Editor)<a class="headerlink" href="#help-menu-shell-and
<dd>Run the turtledemo module with example Python code and turtle drawings.</dd>
</dl>
<p>Additional help sources may be added here with the Configure IDLE dialog under
the General tab. See the Help sources subsection below for more
on Help menu choices.</p>
the General tab. See the <a class="reference internal" href="#help-sources"><span class="std std-ref">Help sources</span></a> subsection below
for more on Help menu choices.</p>
</div>
<div class="section" id="context-menus">
<span id="index-4"></span><h3>Context Menus<a class="headerlink" href="#context-menus" title="Permalink to this headline">¶</a></h3>
Expand Down Expand Up @@ -383,7 +384,7 @@ <h3>Help menu (Shell and Editor)<a class="headerlink" href="#help-menu-shell-and
</div>
</div>
<div class="section" id="editing-and-navigation">
<h2>Editing and navigation<a class="headerlink" href="#editing-and-navigation" title="Permalink to this headline">¶</a></h2>
<span id="id2"></span><h2>Editing and navigation<a class="headerlink" href="#editing-and-navigation" title="Permalink to this headline">¶</a></h2>
<div class="section" id="editor-windows">
<h3>Editor windows<a class="headerlink" href="#editor-windows" title="Permalink to this headline">¶</a></h3>
<p>IDLE may open editor windows when it starts, depending on settings
Expand Down Expand Up @@ -445,7 +446,7 @@ <h3>Automatic indentation<a class="headerlink" href="#automatic-indentation" tit
<p>See also the indent/dedent region commands in the edit menu.</p>
</div>
<div class="section" id="completions">
<h3>Completions<a class="headerlink" href="#completions" title="Permalink to this headline">¶</a></h3>
<span id="id3"></span><h3>Completions<a class="headerlink" href="#completions" title="Permalink to this headline">¶</a></h3>
<p>Completions are supplied for functions, classes, and attributes of classes,
both built-in and user-defined. Completions are also provided for
filenames.</p>
Expand Down Expand Up @@ -480,7 +481,7 @@ <h3>Completions<a class="headerlink" href="#completions" title="Permalink to thi
longer or disable the extension.</p>
</div>
<div class="section" id="calltips">
<h3>Calltips<a class="headerlink" href="#calltips" title="Permalink to this headline">¶</a></h3>
<span id="id4"></span><h3>Calltips<a class="headerlink" href="#calltips" title="Permalink to this headline">¶</a></h3>
<p>A calltip is shown when one types <kbd class="kbd docutils literal notranslate">(</kbd> after the name of an <em>accessible</em>
function. A name expression may include dots and subscripts. A calltip
remains until it is clicked, the cursor is moved out of the argument area,
Expand All @@ -502,6 +503,21 @@ <h3>Calltips<a class="headerlink" href="#calltips" title="Permalink to this head
might want to run a file after writing the import statements at the top,
or immediately run an existing file before editing.</p>
</div>
<div class="section" id="code-context">
<span id="id5"></span><h3>Code Context<a class="headerlink" href="#code-context" title="Permalink to this headline">¶</a></h3>
<p>Within an editor window containing Python code, code context can be toggled
in order to show or hide a pane at the top of the window. When shown, this
pane freezes the opening lines for block code, such as those beginning with
<code class="docutils literal notranslate"><span class="pre">class</span></code>, <code class="docutils literal notranslate"><span class="pre">def</span></code>, or <code class="docutils literal notranslate"><span class="pre">if</span></code> keywords, that would have otherwise scrolled
out of view. The size of the pane will be expanded and contracted as needed
to show the all current levels of context, up to the maximum number of
lines defined in the Configure IDLE dialog (which defaults to 15). If there
are no current context lines and the feature is toggled on, a single blank
line will display. Clicking on a line in the context pane will move that
line to the top of the editor.</p>
<p>The text and background colors for the context pane can be configured under
the Highlights tab in the Configure IDLE dialog.</p>
</div>
<div class="section" id="python-shell-window">
<h3>Python Shell window<a class="headerlink" href="#python-shell-window" title="Permalink to this headline">¶</a></h3>
<p>With IDLE’s Shell, one enters, edits, and recalls complete statements.
Expand Down Expand Up @@ -733,7 +749,7 @@ <h3>Running without a subprocess<a class="headerlink" href="#running-without-a-s
<div class="section" id="help-and-preferences">
<h2>Help and preferences<a class="headerlink" href="#help-and-preferences" title="Permalink to this headline">¶</a></h2>
<div class="section" id="help-sources">
<h3>Help sources<a class="headerlink" href="#help-sources" title="Permalink to this headline">¶</a></h3>
<span id="id6"></span><h3>Help sources<a class="headerlink" href="#help-sources" title="Permalink to this headline">¶</a></h3>
<p>Help menu entry “IDLE Help” displays a formatted html version of the
IDLE chapter of the Library Reference. The result, in a read-only
tkinter text window, is close to what one sees in a web browser.
Expand Down Expand Up @@ -801,6 +817,7 @@ <h3><a href="../contents.html">Table of Contents</a></h3>
<li><a class="reference internal" href="#automatic-indentation">Automatic indentation</a></li>
<li><a class="reference internal" href="#completions">Completions</a></li>
<li><a class="reference internal" href="#calltips">Calltips</a></li>
<li><a class="reference internal" href="#code-context">Code Context</a></li>
<li><a class="reference internal" href="#python-shell-window">Python Shell window</a></li>
<li><a class="reference internal" href="#text-colors">Text colors</a></li>
</ul>
Expand Down Expand Up @@ -899,7 +916,7 @@ <h3>Navigation</h3>
<br />
<br />

Last updated on Nov 12, 2018.
Last updated on Dec 19, 2018.
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
<br />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Document the IDLE editor code context feature. Add some internal references
within the IDLE doc.