Almenon / Almenon/AREPL-vscode

smarter restart

Aperta
#236 2 commenti 1 reazione 1 assegnatario Rivendicata da @Almenon Vedi su GitHub
enhancement real-time
Lingua principale
TypeScript
Stelle
301
Fork
46
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

next step: check if the code is actually different before restarting.

For example, adding a space (in most scenarios) will not change the logic of the code, yet AREPL will still think that's an actual change and restart the evaluation. To avoid this I can parse the syntax of the new and old code and check if the syntax trees are the same.

Sample code:

```python
def is_same(code1, code2):
tree = ast.parse(code1)
tree2 = ast.parse(code2)
return ast.dump(tree) == ast.dump(tree2))
```

Avoiding restart is not a big deal with simple programs but with GUI-based on long-running programs it is important.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.