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

Auto-indent on closing brace #67678

Open
alexagranov7 opened this issue Jan 31, 2019 · 11 comments
Open

Auto-indent on closing brace #67678

alexagranov7 opened this issue Jan 31, 2019 · 11 comments
Assignees
Labels
editor-autoindent Editor auto indentation issues feature-request Request for new features or functionality javascript JavaScript support issues on-unit-test typescript Typescript support issues
Milestone

Comments

@alexagranov7
Copy link

alexagranov7 commented Jan 31, 2019

VSCode Version: Code 1.30.2
OS Version: Windows_NT x64 10.0.17763
Extensions: Extensions are enabled
image

on typing the closing brace. Meaning VSCode should take the current tab indentation size in account and auto-indent the code-block when typing the closing brace.

@vscodebot
Copy link

vscodebot bot commented Jan 31, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the editor-autoindent Editor auto indentation issues label Jan 31, 2019
@alexdima alexdima added the feature-request Request for new features or functionality label Feb 1, 2019
@alexdima alexdima assigned rebornix and unassigned alexdima Aug 8, 2019
@Kenobi-the-2nd
Copy link

Yes, I would very much like to see this feature added as well. Oftentimes I will type in some code, then need to surround it in a loop, if statement, or other block contained by braces. When doing this, I expect that adding the closing brace after the initial brace will indent all code within the braces. I would expect the same behavior when surrounding code with other characters, such as brackets '[]', parentheses '()', or angled brackets '<>'.

This is a standard feature that is present in other versions of Visual Studio such as Visual Studio Enterprise and even Visual Studio Community. When starting out using Visual Studio Code, I expected this same functionality and was disappointed to learn it was not present. This feature is a must-have and I sincerely hope that it will be added.

Thank-you very much for your time.

@rudamaia
Copy link

visual studio for mac has this... Why it still not happening in vscode?

@rebornix rebornix added this to the Backlog Candidates milestone Nov 3, 2020
@GearTheWorld
Copy link

1.61.2 having Auto Indent to full and it doesn't work. Am I missing something?

image

@gbirchmeier
Copy link

I don't understand why this is still an outstanding issue.

@eclazi
Copy link

eclazi commented Jan 12, 2023

Adding my support to this, would love to see it implemented

@aiday-mar aiday-mar assigned aiday-mar and unassigned rebornix Mar 8, 2024
@aiday-mar aiday-mar added javascript JavaScript support issues typescript Typescript support issues labels Mar 15, 2024
@aiday-mar
Copy link
Contributor

Hi in order for us to better understand the issue, could you please include a screen recording of the issue you are seeing, as well as include a code sample where this is happening?

@gbirchmeier
Copy link

@aiday-mar Here you go. It doesn't take much to replicate-- just create a new typescript file and write some code in it.

My VSCode is 1.87.2, with plugin "JavaScript and TypeScript Nightly" v5.5.20240314.

Screen.Recording.2024-03-18.at.11.57.39.AM.mov

@aiday-mar
Copy link
Contributor

aiday-mar commented Mar 28, 2024

Hi I see thank you. As a temporary workaround, you may enable format on type or format on save from the settings:

"editor.formatOnSave": true

OR

"editor.formatOnType": true

@bflora2
Copy link

bflora2 commented Aug 1, 2024

I've been aggravated by this problem for a long time, but then I found a VSCode extension named "Universal Format on Type" by Crend King that seems to fix the problem perfectly. Woo-Hoo!

@chrisjaquet
Copy link

Enabling

"editor.formatOnType": true

does note trigger a reformat of the code block (or the line containing the closing brace). It only seems to adjust the indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-autoindent Editor auto indentation issues feature-request Request for new features or functionality javascript JavaScript support issues on-unit-test typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

12 participants