IDLE: add an AST browser
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece revisando a issue complementar do navegador de tokens #152941 e o PR vinculado gh-152947, pois esta issue não nomeia arquivos de implementação nem testes. O trabalho estará concluído quando um AST Browser do menu Tools do IDLE analisar o código-fonte aplicável, exibir a árvore expandida, sincronizar as seleções com o editor e relatar erros de sintaxe para fragmentos que não possam ser analisados.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- desktop, devtools
- Tipo de issue
- Funcionalidade
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 25/100