IDLE: add an AST browser
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza revisando el issue complementario del explorador de tokens #152941 y el PR vinculado gh-152947, ya que este issue no menciona archivos de implementación ni pruebas. El trabajo estará completo cuando un AST Browser del menú Tools de IDLE analice el código fuente aplicable, muestre el árbol expandido, sincronice las selecciones con el editor e informe de errores de sintaxis para los fragmentos que no se puedan analizar.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- desktop, devtools
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 25/100