-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve newlines from original source when printing nodes from TextC…
…hanges (#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
- Loading branch information
1 parent
667f3b4
commit 237ea52
Showing
24 changed files
with
477 additions
and
137 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,8 @@ var y = { | |
"typeof": | ||
}; | ||
var x = (_a = { | ||
a: a, : .b, | ||
a: a, | ||
: .b, | ||
a: a | ||
}, | ||
_a["ss"] = , | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
//// /*1*/console.log(1); | ||
//// | ||
//// console.log(2); | ||
//// | ||
//// console.log(3);/*2*/ | ||
|
||
goTo.select("1", "2"); | ||
edit.applyRefactor({ | ||
refactorName: "Extract Symbol", | ||
actionName: "function_scope_0", | ||
actionDescription: "Extract to function in global scope", | ||
newContent: | ||
`/*RENAME*/newFunction(); | ||
function newFunction() { | ||
console.log(1); | ||
console.log(2); | ||
console.log(3); | ||
} | ||
` | ||
}); |
Oops, something went wrong.