Skip to content

Instantly share code, notes, and snippets.

@jckeen
Last active July 7, 2023 05:29
Show Gist options
  • Save jckeen/68e78863be019eb84827904d36c7a196 to your computer and use it in GitHub Desktop.
Save jckeen/68e78863be019eb84827904d36c7a196 to your computer and use it in GitHub Desktop.
Angular 2 TypeScript Code Style For WebStorm
<!--
These are code style settings, based off the Style Guide for Angular 2:
https://angular.io/docs/ts/latest/guide/style-guide.html
WebStorm does not currently reformat code based off of tslint.json settings.
This is an attempt to set TypeScript settings for Code Style to follow the Style Guide.
I will update this as I find differences.
To Import: Settings > Editor > Code Style > Import
-->
<code_scheme name="Angular 2">
<TypeScriptCodeStyleSettings>
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
</TypeScriptCodeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="SPACE_WITHIN_BRACKETS" value="true" />
</codeStyleSettings>
</code_scheme>
@webmobiles
Copy link

hello, did you updated this code? or did you found another more completed?

actually webstorm reformat code like this:

constructor(
                  public appState: AppState,
                  private authenticationService: AuthenticationService,
) 

and style code is like this:

constructor(
    public appState: AppState,
    private authenticationService: AuthenticationService,
) 

@matiasiglesias
Copy link

matiasiglesias commented Jan 10, 2018

Please add indent options

  <codeStyleSettings language="TypeScript">
    <option name="SPACE_WITHIN_BRACKETS" value="true" />
    <indentOptions>
      <option name="INDENT_SIZE" value="2" />
      <option name="CONTINUATION_INDENT_SIZE" value="2" />
      <option name="TAB_SIZE" value="2" />
    </indentOptions>
  </codeStyleSettings>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment