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

insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets not behaving correctly #7540

Closed
dbaeumer opened this issue Mar 16, 2016 · 4 comments · Fixed by #10447
Closed

insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets not behaving correctly #7540

dbaeumer opened this issue Mar 16, 2016 · 4 comments · Fixed by #10447
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@dbaeumer
Copy link
Member

From @sofianhn on March 15, 2016 21:7

  1. add "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true to the workspace settings.
  2. open a TS file and copy if (x) {var x = 1;}
  3. select the line and format
  4. expected==Actual => if (x) { var x = 1; }
  5. change the option to false.
  6. format again
  7. Actual == if (x) { var x = 1; } but expected if (x) {var x = 1;}

Copied from original issue: microsoft/vscode#4279

@dbaeumer dbaeumer self-assigned this Mar 16, 2016
@dbaeumer
Copy link
Member Author

Moving to TS. We pass the right option to the tsserver.

@zhengbli
Copy link
Contributor

zhengbli commented May 4, 2016

This is because the tsserver considers only [ and ] as brackets. Therefore this rule is not meant for the described scenario. We could open up new API for { and } (namely braces), but that should be a separate issue.

@zhengbli zhengbli closed this as completed May 4, 2016
@zhengbli zhengbli added the Question An issue which isn't directly actionable in code label May 4, 2016
@bcherny
Copy link

bcherny commented Aug 9, 2016

@zhengbli What is the correct option to use for {}? Did you guys end up reusing insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets, or is there a separate flag?

@zhengbli
Copy link
Contributor

@bcherny no corresponding rule has been provided. But that should be easy to add, I'll send a PR soon.

@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Question An issue which isn't directly actionable in code labels Sep 6, 2016
@mhegazy mhegazy modified the milestones: TypeScript 2.1, TypeScript 2.0 Sep 6, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants