atom-community / atom-community/ide-python

Automatic code formatting duplicates lines and blocks of code

Aperta
#384 1 commento 1 reazione 0 assegnatari Vedi su GitHub
upstream issue
Lingua principale
JavaScript
Stelle
238
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo il problema in Atom con ide-python 1.9.4 o 1.9.5, la formattazione al salvataggio abilitata e lo stesso file Python aperto in più riquadri. Traccia il percorso della formattazione automatica e del salvataggio per determinare perché ogni scheda aggiuntiva duplica il contenuto; il lavoro è completato quando la formattazione non duplica più righe o blocchi e il file non rimane modificato dopo un solo salvataggio.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, python
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.