python / python/cpython

IDLE: add an AST browser

Aberta
#152,942 8 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

stdlib topic-IDLE type-feature
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

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. 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

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.