Preserve two empty lines when function is commented out
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Riproduci il comportamento del formatter con l’esempio GDScript dell’issue, quindi traccia come vengono gestiti i commenti, l’indentazione e le righe vuote intorno ai confini delle funzioni. Verifica se il formatter distingue tra corpi di funzione commentati e commenti tra le funzioni. Il lavoro è completo quando vengono preservate due righe vuote intorno alla funzione commentata, mantenendo il comportamento di formattazione esistente nel resto del codice.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When you comment out a function in between or after a function, the formatter unnecessarily removes empty lines. Here is an example:
Before:
func f(x: float) -> float:
return x
func g(x: float) -> float:
return x
func h(x: float) -> float:
return x
After commenting out middle function:
func f(x: float) -> float:
return x
# func g(x: float) -> float:
# return x
func h(x: float) -> float:
return x
This violates the official style guide which says:
Surround functions and class definitions with two blank lines
This also annoyingly bobs functions up and down as you temporarily comment them out, which is not ideal. I assume the problem here is that the formatter treats commented sections following a function as part of the function itself, and thus tries to use a single empty line.
At least on VSCode, comments made with CTRL + / respect the indent level of the commented code. So, it should be possible to detect whether a comment is part of the function or part of a codeblock outside the function using the indent level. However, I am not sure if this convention is universal.
- Lingua principale
- Rust
- Stelle
- 458
- Fork
- 40
- Merge medio
- 1g 15h
- PR unite (30g)
- 4
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GDQuest/GDScript-formatter
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
GDQuest/GDScript-formatter#362 · 2 commenti ·
-
Godot 4.8.dev6 Parse Error Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
GDQuest/GDScript-formatter#359 · 9 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GDQuest/GDScript-formatter#327 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
GDQuest/GDScript-formatter#361 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
GDQuest/GDScript-formatter#360 ·
Tutte le issue di GDQuest/GDScript-formatter
Issue simili
-
bug github_actions
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
registrystack/registry-stack#1393 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
longbridge/gpui-kit#3223 ·
-
bug engine
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
rocky-data/rocky#2181 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
oasisprotocol/oasis-sdk#2523 ·
-
[indexer] [QA] Add a focused test for the new NonRetryableError / assertSocketAlive() behavior. Apertabot:ai-assisted component:indexer QA-roadmap status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
midnightntwrk/midnight-indexer#1557 ·