Format Space within braces for ES6 import/export
I haven't been able to figure out how to set format to add or retain the spaces within braces for TypeScript / ES6 import/export.
So I want
```
import { Component, EventEmitter, OnInit, Output, Input } from '@angular/core’;
```
Instead of
```
import {Component, EventEmitter, OnInit, Output, Input} from '@angular/core';
```
Please sign in to leave a comment.
please try enabling Preferences | Editor | Code Style | TypeScript, Spaces / Within / ES6 import/export braces - does it help?
That was it - thanks (I totally didn't see that option before.)
Upvoted. This helped me greatly.
Never thought Typescript will be a separate option in the list of Code Options.
Is this option also available for Resharper?
Unfortunately, at this moment there is no such option in Resharper.
Please vote for this feature https://youtrack.jetbrains.com/issue/RSRP-465954 to increase its priority and to be notified about updates.
Very helpful. Thanks Elena.
@Henrik Vendelbo
Thanks @Elena, your solution fixed my problem! My imports are now spacing correctly.
If I want this setting to be in the .editorconfig (so my colleagues have same settings when formatting the code), what shall I do? When exporting EditorConfig, there are only settings for indentation. I did not find any property for this in the index https://www.jetbrains.com/help/rider/EditorConfig_Index.html
Not sure about Rider, but in Webstorm it is
And for the regular IntelliJ IDEA? The
ij_javascript_spaces_within_imports
has no effect..
it's the same in IDEA, and it does work for me
for JavaScript
for Typescript
I'm using version 2021.2.3 on Typescript project, setting ON ES6 import/export braces doesn't add spaces. Any help ?
Are you using .editorconfig? Its settings override the code style preferences. Please also make sure that you don't have Prettier set up as your default formatter
solved I changed Typescrpit setting editor
This works for javascript:
But after putting it in .editorconfig I had to restart the project. Which I mostly do via
File -> "Invalidate Caches..." and then choose bottom left "Just restart"
and you get a beautiful autocomplete like this