-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Preserve newlines from original source when printing nodes from TextChanges #36688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
2b9e4aa
Allow emitter to write multiple newlines in node lists
andrewbranch c689617
Progress
andrewbranch 6e272f3
Progress
andrewbranch 839fb8e
Fix recomputeIndentation
andrewbranch 0ea8d79
Add tests, fix leading line terminator count
andrewbranch 6ff9c2b
Do a bit less work when `preserveNewlines` is off
andrewbranch c91efd4
Fix accidental find/replace rename
andrewbranch e3ef427
Restore some monomorphism
andrewbranch e535e27
Fix single line writer
andrewbranch 21b0cb8
Fix other writers
andrewbranch b6cf73d
Merge branch 'master' into bug/27294
andrewbranch 0c536c5
Revert "Fix other writers"
andrewbranch 91eaf80
Revert "Fix single line writer"
andrewbranch 3be2c86
Revert "Restore some monomorphism"
andrewbranch 8ed98bc
Add equal position optimization to getLinesBetweenRangeEndAndRangeStart
andrewbranch d9c80fd
Add one more test
andrewbranch af188d4
Actually save the test file
andrewbranch 19a9728
Rename preserveNewlines to preserveSourceNewlines
andrewbranch 131f2bb
Make ignoreSourceNewlines internal
andrewbranch 34147a5
Optimize lines-between functions
andrewbranch cf96308
Merge branch 'master' into bug/27294
andrewbranch 075c782
Add comment;
andrewbranch 563d223
Fix trailing line terminator count bug for function parameters
andrewbranch 8b61d66
Preserve newlines around parenthesized expressions
andrewbranch e7c2b28
Merge branch 'master' into bug/27294
andrewbranch e99d833
Back to speculative microoptimizations, yay
andrewbranch ac768d0
Don’t call getEffectiveLines during tsc emit at all
andrewbranch 6daa27e
Merge branch 'master' into bug/27294
andrewbranch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.