You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Preserve newlines from original source when printing nodes from TextChanges (#36688)
* Allow emitter to write multiple newlines in node lists
* Progress
* Progress
* Fix recomputeIndentation
* Add tests, fix leading line terminator count
* Do a bit less work when `preserveNewlines` is off
* Fix accidental find/replace rename
* Restore some monomorphism
* Fix single line writer
* Fix other writers
* Revert "Fix other writers"
This reverts commit 21b0cb8.
* Revert "Fix single line writer"
This reverts commit e535e27.
* Revert "Restore some monomorphism"
This reverts commit e3ef427.
* Add equal position optimization to getLinesBetweenRangeEndAndRangeStart
* Add one more test
* Actually save the test file
* Rename preserveNewlines to preserveSourceNewlines
* Make ignoreSourceNewlines internal
* Optimize lines-between functions
* Add comment;
* Fix trailing line terminator count bug for function parameters
* Preserve newlines around parenthesized expressions
* Back to speculative microoptimizations, yay
* Don’t call getEffectiveLines during tsc emit at all
Copy file name to clipboardExpand all lines: src/compiler/types.ts
+3-1
Original file line number
Diff line number
Diff line change
@@ -3784,7 +3784,7 @@ namespace ts {
3784
3784
writeParameter(text: string): void;
3785
3785
writeProperty(text: string): void;
3786
3786
writeSymbol(text: string,symbol: Symbol): void;
3787
-
writeLine(): void;
3787
+
writeLine(force?: boolean): void;
3788
3788
increaseIndent(): void;
3789
3789
decreaseIndent(): void;
3790
3790
clear(): void;
@@ -5860,6 +5860,7 @@ namespace ts {
5860
5860
NoAsciiEscaping=1<<24,// When synthesizing nodes that lack an original node or textSourceNode, we want to write the text on the node with ASCII escaping substitutions.
5861
5861
/*@internal*/TypeScriptClassWrapper=1<<25,// The node is an IIFE class wrapper created by the ts transform.
5862
5862
/*@internal*/NeverApplyImportHelper=1<<26,// Indicates the node should never be wrapped with an import star helper (because, for example, it imports tslib itself)
5863
+
/*@internal*/IgnoreSourceNewlines=1<<27,// Overrides `printerOptions.preserveSourceNewlines` to print this node (and all descendants) with default whitespace.
0 commit comments