microsoft / microsoft/TypeScript
feature request: change indentation of multi-line variable declarations
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den Formatierungspfad von tsserver für mehrzeilige let-, var- und const-Deklarationen zu untersuchen, und verwende die Beispiele im Abschnitt Suggestion als erwartete Ausgabe. Identifiziere die Formatter-Tests, die die Einrückung abdecken, und füge Fälle für andere Einrückungsgrößen als 4 hinzu; als erledigt gilt dies, wenn diese Deklarationen konsistent die angeforderte Fortsetzungseinrückung verwenden, ohne das Laufzeitverhalten zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100