IDLE: add an AST browser
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Feature or enhancement
As a companion to the proposed token browser (#152941), visualizing the abstract syntax tree helps in learning how Python parses code and in understanding the structure that the compiler works from.
I propose an AST Browser added as an extension on the Tools menu (Shell and editor). It shows ast.parse of the current window as a hierarchical, fully expanded ttk.Treeview, each node labeled with its type and inline simple fields.
Interaction:
- Selecting a node highlights the corresponding source in the editor.
- The browser follows the editor: the editor selection (or cursor) selects the single smallest enclosing node.
- Scope is the editor selection if it parses, else the Shell's current input, else the whole window (a context-dependent fragment that does not parse reports the syntax error).
It shares the window skeleton and editor-sync mechanism with the token browser, so the two are best reviewed and landed together.
A PR will follow.
Linked PRs
- gh-152947
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando la issue complementare del browser dei token #152941 e la PR collegata gh-152947, poiché questa issue non indica file di implementazione né test. Il lavoro è completo quando un AST Browser del menu Tools di IDLE analizza il codice sorgente applicabile, visualizza l’albero espanso, sincronizza le selezioni con l’editor e segnala gli errori di sintassi per i frammenti non analizzabili.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- desktop, devtools
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100