microsoft / microsoft/vscode-python-debugger

Prevent vscode from exiting the Python interpreter a script completes

Aberta
#524 9 comentários 41 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

feature-request needs PR
Linguagem predominante
TypeScript
Estrelas
181
Forks
126
Merge médio
2d 3h
PRs com merge (30d)
3

Descrição

Discussed in https://github.com/microsoft/vscode-python/discussions/16082

Originally posted by larsoner April 29, 2021
The way I have used Python for years (through Spyder, directly from a bash terminal, etc.) is to execute a script in interactive mode such that once it's done, you can interact with it, e.g.:

python -i script.py

VSCode's debugger does not give a way to get this behavior currently. And it seems like I am not the only one looking for it:

One workaround is to put a breakpoint at the end of your file, but this requires extra work.

Another workaround is to add "env": {"PYTHONINSPECT": "true"}, to the launch configuration with integratedTerminal, but this doesn't work properly as any input is captured and newlines aren't treated properly while printing, which makes it pretty unusable.

I could see at least two potential solutions (the first would be better I think):

  1. Make it so that in PYTHONINSPECT mode, the terminal could be interacted with properly, possibly by adding a new inspectOnExit or something that ran in -i / PYTHONINSPECT mode and returned proper input/output when the script completes. Based on https://github.com/microsoft/vscode-python/issues/5497 it sounds like this is a no-go, though.
  2. Add a stopOnExit debug option to mirror stopOnEntry in the debugger. This way at least variables could be inspected using the vscode debugger.

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

O issue não nomeia arquivos de implementação nem testes. Comece revisando a discussão vinculada e o comportamento existente do depurador stopOnEntry e, em seguida, compare as abordagens interativas propostas PYTHONINSPECT e stopOnExit com o issue 5497. Done deve proporcionar uma experiência utilizável de inspeção pós-script sem exigir um breakpoint no final.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
typescript
Domínio
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.