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

Autoindent adjusts end-brace to wrong indentation level (JavaScript) #31455

Closed
atombender opened this issue Jul 26, 2017 · 1 comment
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues wont-fix

Comments

@atombender
Copy link

  • VSCode Version: 1.14.2
  • OS Version: 10.12.5

vsc

Steps to Reproduce:

  • Start with code:
try {
  start()
    .catch(err => {
      // ...
    });
  • Now type } at the end of this snippet.
  • It will placed one level deep, instead of being aligned with the outer }:
try {
  start()
    .catch(err => {
      // ...
    });
  }  // :-(
  • Manually fixing the indentation level and following up with } finally { automatically adjusts the line again, which is frustrating.

Is it because the autoindent support doesn't understand anonymous function syntax?

Reproduces without extensions: Yes

@vscodebot vscodebot bot added the editor label Jul 26, 2017
@rebornix rebornix added bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues labels Aug 15, 2017
@alexdima alexdima removed the editor label Nov 23, 2017
@rebornix
Copy link
Member

rebornix commented Nov 3, 2020

This is due to the limited architecture (regex based indentation rules and only support limited code styles), we may want to consider using formatters if they exist for indenation adjustment (if interested, we can discuss in #19847).

For this particular issue, if the indentation rules are leading to more trouble than having no auto indent, you can set editor.autoIndent to advanced to disable the regex based indentation adjustment. As we don't have an easy good-enough fix for it, we close it for now and explore better solutions through issues like #19847.

@rebornix rebornix closed this as completed Nov 3, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-autoindent Editor auto indentation issues wont-fix
Projects
None yet
Development

No branches or pull requests

4 participants