Blank line preservation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, typescript
- Ambito
- tooling
Direzione di ricerca
Non viene indicato alcun file, test o punto di ingresso; inizia individuando le API per la stringificazione dei nodi e lo spostamento del codice. Definisci e testa come spaceBefore e spaceAfter rappresentano righe vuote, commenti, interruzioni di riga all’inizio della riga e indentazione, e stabilisci se toString(true) li include.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When moving a block of code, you can use toString on each node and "paste" the result by using the appropriate method. There needs to be a way to preserve blank lines between nodes, so we can preserve the author's style.
The first idea that comes to mind is a method that returns a string containing only newlines (and maybe indentation?) corresponding to the number of blank lines before or after the node (so two variants). This string can then be "pasted" just like the toString result.
As an example:
foo()
// comment 1
bar()
// comment 2
foo()
Assume the bar() expression is represented by node:
node.spaceBefore() // => "\n\n// comment 1\n"
node.toString() // => "bar()"
node.spaceAfter() // => "\n\n\n// comment 2\n"
In the above example, the \n that begins bar()'s line is included in the spaceBefore result. And the \n that begins the line after that is included in the spaceAfter result. I'm not certain, but I think that's the expected behavior.
I'm also undecided if indentation should be included or not. I'm leaning towards no, because toString currently strips indentation and we should match that behavior.
Another thing: maybe toString(true) can include the result of spaceAfter (and even the result of spaceBefore if we're the first sibling of a BlockStatement) to make things easier?
These decisions could easily be a source of many bugs if we aren't careful.
- Lingua principale
- TypeScript
- Stelle
- 16
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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 alloc/nebu
-
Support input sourcemaps Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Conditional plugins Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Support for other languages Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
[RFC] Node.prototype.wrap Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
mksglu/context-mode#1200 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
AOSSIE-Org/DebateAI#582 · 2 commenti ·