Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Automatic code formatting duplicates lines and blocks of code

未關閉
#384 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
javascript, python
領域
tooling

研究方向

首先,在 Atom 中使用 ide-python 1.9.4 或 1.9.5,啟用儲存時格式化,並在多個窗格中開啟同一個 Python 檔案,以重現該問題。追蹤自動格式化和儲存路徑,以確定為什麼每個額外的分頁都會複製內容;當格式化不再複製行或區塊,且檔案在儲存一次後不再保持已修改狀態時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

upstream issue

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

def foo():
    pass

def bar():
    pass

Result after automating formatting

def foo():
    pass


def bar():
    pass
    pass

Here the keyword pass is duplicated inside function bar.

Example 2

Original code

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

Result after automating formatting

def foo():
    pass


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

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

主要語言
JavaScript
星號
238
分支
41
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

atom-community/ide-python 的其他 Issue

查看 atom-community/ide-python 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。