![]() ![]() Go to Keymap -> Main Menu -> Edit-> Macros-> Format-save.Press Ctrl+ Alt+ l then Ctrl+ Alt+ Shift+ S (Windows/Linux) or Cmd+ Alt+ l and Cmd+ Alt+ Shift+ S (Mac).Click on Edit -> Macros -> Start Macro Recording.Set keyboard shortcut to Ctrl+ Alt+ Shift+ S (Windows/Linux) or Cmd+ Alt+ Shift+ S (Mac) and click OK on the shortcut window and settings window.Right click and select Add Keyboard Shortcut.Right click and select Remove Ctrl+S/Cmd+S.Go to Keymap -> Main Menu -> File-> Save All.Open the settings with ctrl + alt+ s (Windows/Linux) or cmd+ + (Mac).There were also a number of bug-fixes in and around the formatting tool, and some new settings and tweaks were added, like the ability to keep comments next to the return statement in functions/methods.A slight correction on the answer based on Code reformatting on save in PhpStorm or other jetbrains ide This answer is basically correct, but you need to create a custom keybinding for Save All in order for it to work, and the keybinding given for Windows (or Linux), Ctrl+ Alt+ S is used to open the settings dialog which could have unwanted consequences. The formatter now adheres to blank line settings even if you’re using some of the alternative PHP syntaxes. There have also been some more minor improvements. To see these options in the code completion popup, make sure you’ve got case sensitivity in code completion turned off, by selecting None in the Case sensitive completion option. You can turn this behavior on or off by using the Add a comma after last element in multiline array option under the Other tab.Īnother brand new introduction in PhpStorm, the formatter will now change the case of `true`, `false` or `null` to the case you’ve set in the code style setting, whenever you select them using the code completion popup. Īnother much sought-after improvement is the ability to tell the code formatter to add trailing commas when reformatting arrays. To set the minimum blank lines before and after class definition braces, use the After Class Header option. ![]() Now, under the Minimum Blank Lines options (which can be found under Settings -> Code Style -> PHP -> Blank Lines), the Blank Lines Around option only affects properties, constants or method blank lines that are not adjacent to the start or end of a class. In order to allow the Reformat Code tool to reformat the code exactly to the user’s needs, in PhpStorm 9 the Minimum Blank Lines Around options have been changed, and a new option called After Class Header was added. Ensuring a minimum blank line of 1 in PhpStorm 8 would result in the following formatting: ![]() This led to some consternation as it was adding blank lines around properties and methods, which was causing undesired blank lines between the first/last property, class or method. In PhpStorm 8, the option to set a minimum number of blank lines around fields was introduced. Now, the `break` statement will appear with the same indentation as the corresponding `case` statement. Using the Code Style settings under the Editor tab, then navigating to Wrapping and Braces -> ‘switch’ statement, you can uncheck the Indent ‘break’ from ‘case’ option to get the alternative formatting. ![]() The standard indentation is for the `break` statement to appear on the same line as the code: Let’s take a look at what formatting changes have been seen in PhpStorm 9 & 10.Īn option for controlling the indentation of the `break` statement has been added. Recent versions of PhpStorm have bundled several interesting formatting changes. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |