Add padding when pressing space between a pair of curly braces #22583
Labels
editor-autoclosing
Editor automatic closing of parens / brackets / etc.
feature-request
Request for new features or functionality
Milestone
When I type
{
to create a pair of curly braces:...and then when I press space, I would like 2 spaces to be inserted with the cursor in the middle:
Currently it just inserts a single space, so getting the same result requires pressing space twice then the back arrow once. Or otherwise setting:
...then formatting the line once there's already stuff inside it.
I believe pressing space between a pair of brackets with nothing between them (
{}
) is more-or-less an unambiguous signal (in pretty much any language) that the user intends to have a padding space at both ends. It's also very similar to the already-covered case where someone instead presses enter to produce:In Sublime Text I was able to add the functionality myself using a keybinding that looked (in their format) like:
...but in VS Code there doesn't seem to be enough functionality available to add a keybinding like this - I can insert a snippet but can't see anything that would allow me to limit the context to the inside of a pair of brackets.
If someone points me to the place in the codebase where the similar behavior for pressing "enter" is defined, I might be able to open a PR myself.
The text was updated successfully, but these errors were encountered: