First draft of new closeHangingIndent option #128
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.
PR for #127
Based on manual testing, this change does what I want, except in one situation, and has one bug that I'm not sure how to fix.
From this:
You get this just by pressing Enter in the right places:
From this:
You can get this from just Enter as well:
However, from this:
Pressing Enter before the }) gives you this:
Which I was hoping would be this:
And pressing Enter before the ) mysteriously puts it right under the "e" in Wrapper, even if you've already pressed Enter before the }.
Unfortunately, the complex hanging indent case mentioned in the comments inside
nextIndentationLevel()
no longer works as intended.Becomes this after pressing Enter between 8 and ] :
When it's supposed to be this:
I'm not sure how to accomplish my goal without breaking this. The code path for my two successes and this failure are the same (the first
if
block at the end ofnextIndentationLevel()
).Checklist
I had to use optional arguments to move
dedentIfHanging
around within the code without breaking the tests. I have no prior experience with TypeScript, so I was pretty baffled about what to do to update them. I'll try to get that figured out next week.I'm also not 100% sure my description for the new setting is quite right.