microsoft / microsoft/TypeScript

feature request: change indentation of multi-line variable declarations

Aperta
#30,322 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Search Terms

format code indent tsserver

Suggestion

When tsserver formats the following typescript code using an indent size of 2, I get

let a = 1,
  b = 2

while I'd expect it to indent the code like

let a = 1,
    b = 2

regardless of the indent size.

Additionally, the following code would be formatted like

const a = 1,
      b = 2

Use Cases

This feature would be useful in variable declarations (let, var, const) when using an indent size different than 4.

Examples

See the Suggestion section above.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando il percorso di formattazione di tsserver per le dichiarazioni let, var e const su più righe, usando gli esempi nella sezione Suggestion come output previsto. Individua i test del formatter che coprono l'indentazione e aggiungi casi per dimensioni di indentazione diverse da 4; il lavoro sarà considerato completato quando queste dichiarazioni useranno costantemente l'indentazione di continuazione richiesta senza modificare il comportamento a runtime.

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

Valutazione

Stack tecnologico
typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
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.