Skip to content

gh-152941: Add a token browser to IDLE#152946

Open
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:idle-tokenbrowser
Open

gh-152941: Add a token browser to IDLE#152946
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:idle-tokenbrowser

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 3, 2026

Copy link
Copy Markdown
Member

Add a Token Browser extension on the Tools menu (Shell and editor). It shows the output of tokenize for the current window in a ttk.Treeview, one row per token with its type, string, and range.

Selecting a row highlights the corresponding source in the editor; double-clicking moves the cursor to that token. The browser follows the editor: a selection selects every overlapping token row, and the cursor alone selects the single token containing it. Scope is the editor selection if there is one, else the Shell's current input, else the whole window.

🤖 Generated with Claude Code

@read-the-docs-community

read-the-docs-community Bot commented Jul 3, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33433719 | 📁 Comparing c1f145f against main (ac1acb6)

  🔍 Preview build  

3 files changed
± library/idle.html
± library/tk.html
± whatsnew/changelog.html

@terryjreedy terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't make this an extension. See issue.

@bedevere-app

bedevere-app Bot commented Jul 3, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Add a Token Browser command to a new Browse menu (Shell and editor).  It
opens a window listing the Python tokens of the editor content, or of the
selection if there is one, with the token type names colored as by
"python -m tokenize".

There is one browser per editor; invoking the command again refreshes it
and selects the token at the cursor.  Selecting rows highlights the
matching regions in the editor and, while the browser has focus, moves
the editor cursor there; selecting text or moving the cursor in the
editor selects the matching rows.  Double-clicking a row (or pressing
Escape) hides the browser, revealing the editor at the token.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants