IDLE: add a token browser
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Ausgabe von Python's tokenize und dem Erweiterungseinstiegspunkt von IDLE im Menü Tools für die Shell und den Editor. Prüfen Sie, wie ein ttk.Treeview Token-Typ, Zeichenfolge und Bereich darstellen kann, und verifizieren Sie anschließend das im Issue beschriebene Verhalten für Auswahl, Doppelklick, Cursor und Gültigkeitsbereich. Als abgeschlossen gilt die Arbeit, wenn der Browser dem aktuellen Fenster folgt und Token-Zeilen den Quellpositionen zuordnet; gh-152946 ist als nachfolgender PR verknüpft.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- desktop, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 30/100