Single expressions function declaration use of Join Lines wrong without braces

eg:

function foo (v) {
  return v * 2
}

Now select the function and press Ctrl+Shift+J or Ctrl+Shift+A to execute Join Lines

The code will change to:

function foo (v) return v * 2

 

However, JavaScript doesn't seem to allow such statements, and I've been told syntax errors in Node or in the browser.

Expected:

function foo (v) { return v * 2 }

 

PhpStorm 2023.1.3

Build #PS-231.9161.47, built on June 22, 2023

 

0
1 comment

😶 I found it, and it looks like it's already a known issue that should be fixed in the next release

 

Join lines shouldn't remove braces in functions : WEB-54537
https://youtrack.jetbrains.com/issue/WEB-54537/Join-lines-shouldnt-remove-braces-in-functions

0

Please sign in to leave a comment.