atom-community / atom-community/ide-python

Automatic code formatting duplicates lines and blocks of code

Abierto
#384 1 comentario 1 reacción 0 asignados Ver en GitHub
upstream issue
Lenguaje dominante
JavaScript
Estrellas
238
Forks
40
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza reproduciendo el problema en Atom con ide-python 1.9.4 o 1.9.5, el formato al guardar habilitado y el mismo archivo de Python abierto en varios paneles. Sigue el flujo del formateo automático y del guardado para determinar por qué cada pestaña adicional duplica el contenido; se considera terminado cuando el formato ya no duplica líneas ni bloques y el archivo no queda modificado después de un guardado.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, python
Área
tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.