python / python/cpython

IDLE: add a token browser

未關閉
#152,941 9 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

stdlib topic-IDLE type-feature
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

Seeing how source is split into tokens helps in learning how Python's tokenizer works and in debugging tokenizer-dependent behavior, but IDLE offers no way to inspect the token stream.

I propose a Token Browser added as an 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.

Interaction:

  • Selecting a row highlights the corresponding source in the editor.
  • Double-clicking a row moves the editor 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.

A PR will follow.

Linked PRs
  • gh-152946

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 Python 的 tokenize 輸出以及 Shell 和編輯器的 Tools 選單中的 IDLE 擴充功能入口點開始。檢視 ttk.Treeview 如何表示 token 類型、字串和範圍,然後驗證 issue 中描述的選取、雙擊、游標和作用域行為。完成的標準是瀏覽器跟隨目前的視窗,並將 token 列對應到原始碼位置;gh-152946 已作為後續 PR 連結。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
desktop, tooling
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。