Almenon / Almenon/AREPL-vscode

smarter restart

Offen
#236 2 Kommentare 1 Reaktion 1 zugewiesene Person Beansprucht von @Almenon Auf GitHub ansehen
enhancement real-time
Vorherrschende Sprache
TypeScript
Sterne
301
Forks
46
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.