atom-community / atom-community/ide-python

Automatic code formatting duplicates lines and blocks of code

Đang mở
#384 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
upstream issue
Ngôn ngữ chính
JavaScript
Star
238
Fork
40
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

There seems to be a bug in automatic code formatting. The bug is triggered by opening the same code file into multiple tabs in separate panes. Having two tabs (of the same file) will cause the bug to occur once, three tabs will cause it to repeat twice, and so on.

I have been using the `ide-python` package only for a couple days, so I don't know about the specifics. This bug is present in both versions `1.9.4` and `1.9.5` at least. I turned off all checkboxes in the module's settings and restarted Atom, but this bug will still persist. I am using the "format on save" option.

Also, the file status is "modified" again after I **save** the file and automatic formatting is applied, so the file has to be manually saved twice. I don't think it should be like this.

### Example 1

**Original code**

```python
def foo():
pass

def bar():
pass
```

**Result after automating formatting**

```python
def foo():
pass

def bar():
pass
pass

```

Here the keyword `pass` is duplicated inside function `bar`.

### Example 2

**Original code**

```python
def foo():
pass
def bar():
pass

```

**Result after automating formatting**

```python
def foo():
pass

def bar():
pass
def bar():
pass

```

Here the whole function block for `bar` is duplicated. Formatting is also messed up.

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

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

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện vấn đề trong Atom với ide-python 1.9.4 hoặc 1.9.5, bật tính năng định dạng khi lưu và mở cùng một tệp Python trong nhiều khung. Theo dõi luồng định dạng tự động và lưu để xác định tại sao mỗi tab bổ sung lại nhân đôi nội dung; được xem là hoàn tất khi việc định dạng không còn nhân đôi các dòng hoặc khối và tệp không còn ở trạng thái đã sửa đổi sau một lần lưu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, python
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.