How to turn off adding spaces within interpolation expressions ONLY inside string literals?

Let's say we have such code:

export class ConsoleGreeter extends Greeter {
greet(to, from) {
return `Hello, ${ to } from ${ from.join(',') }`;
}
}

export class ReactGreeter extends Greeter {
greet(to, from) {
return (<div className="greeting">
Hello, { to } from
{ from.map(name => <Name>{ name }</Name>) }
</div>);
}
}

And I want to keep spaces within interpolation expressions here:

 return (<div className="greeting">
Hello, { to } from
{ from.map(name => <Name>{ name }</Name>) }
</div>);

but not here:

 return `Hello, ${ to } from ${ from.join(',') }`;

I just have been using WebStorm 2015 for a while and it worked there as I described above but not in the 2018.3 version.

1 comment

No way - Preferences | Editor | Code Style | JavaScript | Spaces, Other/Within interpolation expressions option affects all interpolation. If you miss a separate option for string interpolations, please file a feature request to youtrack, https://youtrack.jetbrains.com/issues/WEB

0

Please sign in to leave a comment.