dsherret / ts-morph

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
https://ts-morph.com
MIT License
5.03k stars 196 forks source link

fix: getBodyText() doesn't work as would be expected #1560

Closed jmyrick02 closed 1 month ago

jmyrick02 commented 4 months ago

Fixes #1559

The first test corresponds to the first issue mentioned in #1559, which is definitely a bug. This is addressed by the addition of the new if statement at the end of the while loop. The second test corresponds to my preferred behavior of ignoring empty lines when adjusting indentation levels. This was addressed by the modification of the condition to update the minimum indent level. If you do not believe this should be default behavior, at least an option should be provided, since I'm finding it necessary for my use case.

Please let me know if you have any thoughts.

jmyrick02 commented 1 month ago

Thanks!

Thank you so much! This is my first real OSS contribution, so I appreciate this a lot. Thanks for being a maintainer.