Skip to content
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

Ensure formatter can always get a newline character #38579

Merged
merged 3 commits into from
May 19, 2020

Conversation

andrewbranch
Copy link
Member

Fixes #38548

It looks like this was always a problem, but didn’t surface itself (at least not where anyone noticed) until we started preserving source newlines in refactors and codefixes. Also, I don’t think this bug was ever observable from VS or VS Code because AFAIK they always populate formattingSettings.newLineCharacter. The bug report stemmed from programmatic language service usage.

Copy link
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Impact is low, but risk is also low, so I'd be fine with including this in a servicing release.

@amcasey
Copy link
Member

amcasey commented May 14, 2020

FYI @jessetrinity who is also working in this area

@andrewbranch andrewbranch merged commit 707e977 into microsoft:master May 19, 2020
@andrewbranch
Copy link
Member Author

@typescript-bot cherry-pick this to release-3.9

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 19, 2020

Heya @andrewbranch, I've started to run the task to cherry-pick this into release-3.9 on this PR at 90923e2. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @andrewbranch, I've opened #38666 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request May 19, 2020
Component commits:
0a696c9 Ensure formatter can always get a newline character

ab09d67 Make FormatContext.host optional since it’s not necessary if format options are all applied

90923e2 Make FormattingHost required again
@andrewbranch andrewbranch deleted the bug/38548 branch May 19, 2020 20:20
andrewbranch added a commit that referenced this pull request May 19, 2020
Component commits:
0a696c9 Ensure formatter can always get a newline character

ab09d67 Make FormatContext.host optional since it’s not necessary if format options are all applied

90923e2 Make FormattingHost required again

Co-authored-by: Andrew Branch <andrew@wheream.io>
cangSDARM added a commit to cangSDARM/TypeScript that referenced this pull request May 20, 2020
* upstream/master:
  Support naming tuple members (microsoft#38234)
  LEGO: check in for master to temporary branch.
  fix: extract const in jsx (microsoft#37912)
  No contextual types from circular mapped type properties (microsoft#38653)
  Ensure formatter can always get a newline character (microsoft#38579)
  Fix debug command for Node debugging
  Remove mentions of runtests-browser in CONTRIBUTING.md
  fix(33233): add outlining for comments before property access expression
  regression(38485): allow using rawText property in processing a tagged template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3.9 Regression: organizeImports prepends/appends "undefined" when there are 2+ named imports
4 participants