1

When I write my code like this:

Good

I ask PhpStorm to reformat my code, and it does like this:

Bad

Ugly... How can I tell PhpStorm to not align params like this and leave it as it is?

Code sample:

export const scanIntervals = ({
    intervals,
    duration,
    start = 0,
    end = 1440,
    rounding = 10,
}) => intervals.some((interval) => {
    console.log('Hello World');
})

P.S. Sorry for my bad English

7
  • 1
    Is that TypeScript or JavaScript? (sorry, not JS person myself). It should be at Settings/Preferences | Editor | Code Style | [LANGUAGE] | Wrapping and Braces -- most likely one of the Align when multiline options. Would be good if you could provide an actual code sample as a text (so it can be copy-pasted into preview area and checked with few options) Commented Oct 9, 2017 at 13:35
  • @LazyOne Didnt find anything associated with it. Long searched for the necessary option but without any success. JavaScript ES6 Commented Oct 9, 2017 at 13:38
  • I personally would not be able to provide any help without some code sample that I can copy-paste .. as I simply do not know JavaScript at this level so cannot make my own (rather basic jQuery and alike usage). In such conditions I may only suggest to copy-paste your code there yourself and try checking/unchecking different options (paste again after resetting that option back). Sorry about that. Maybe somebody else knows exact option. Commented Oct 9, 2017 at 14:01
  • @LazyOne done.. Commented Oct 9, 2017 at 15:56
  • Thanks. Please post your current Code Style for JavaScript (that Wrapping and Braces tab) -- I want to compare it to mine (just export it and share somehow). In my tests Function declaration parameters | Align when multiline does trigger such big indent. Commented Oct 9, 2017 at 18:05

1 Answer 1

8
  1. Settings/Preferences
  2. Editor | Code Style | JavaScript | Wrapping and Braces
  3. Function declaration parameters --> Align when multiline

Accordingly to my tests using your code sample it's the option that is responsible for such behaviour. Please uncheck it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.