Almenon / Almenon/AREPL-vscode

smarter restart

Đang mở
#236 2 bình luận 1 reaction 1 người được giao Được @Almenon nhận Xem trên GitHub
enhancement real-time
Ngôn ngữ chính
TypeScript
Star
301
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.