Ensure formatter can always get a newline character by andrewbranch · Pull Request #38579 · microsoft/TypeScript (original) (raw)

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.