IntelliJ splits my code when reformatting using ctrl+alt+L - intellij-idea

ctrl+alt+L splits my code like this:
public void message_should_be_displayed(String text) {
qip.executeAssertEquals("Asserting if correct alert msg is displayed : ", text, qip.driver.switchTo()
.alert()
.getText());
}
It puts the last 2 lines in separate lines if I do reformat. Any idea how to fix this?

Settings (Preferences on macOS) | Editor | Code Style | Java | Wrapping and Braces | Chained method calls: Do not wrap.

Related

How to stop from alignment with space in WebStorm

When I use "Optimize imports" all imports are aligned with spaces like in the screenshot below.
How can I disable this?
Try disabling this option from 'Preferences/Settings | Editor | Code Style | JavaScript':

How do I change matching brackets color's highlighting in IntelliJ?

I'm using VS-Code color theme on IntelliJ, and when I place my cursor within a few nested brackets, it becomes almost invisible since the highlighting is the same color as my cursor (see the screenshot below).
I've found Settings => Editor -> Code Editing -> Matched Brace but I want to keep the highlighting, and change it's color.
And the options in Settings => Editor -> Color Scheme -> General -> Code -> Matched Brace change the settings brackets style when they're not selected, which is not the problem I'm facing.
Settings (Preferences on macOS) | Editor | Color Scheme | General | Code | Matched brace works fine here. Make sure to change the Foreground property or remove any Effects.
The color used in your example when the caret is not placed on the parentheses is set via Settings (Preferences on macOS) | Editor | Color Scheme | Language Defaults | Braces and Operators | Parentheses.

Rider automatically formats List initializer to not contain spaces causing compilation errors

When I write following code in Rider:
new List<Guid> { Guid.NewGuid() } and I type ; at the end, Rider automatically formats this into new List<Guid> {Guid.NewGuid()};
Note that spaces were removed before and after both braces.
Compiler doesn't like it and reports [SA1012] Opening brace should be followed by a space. and [SA1013] Closing brace should be preceded by a space.
How can I turn off such behavior in Rider?
I don't know which version of Rider you're using but in 2022.2.3 I had to enable the following property under File | Settings | Editor | Code Style | C#:
I hope it helps you as well!

Formatting code in PhpStorm does not work as I need it to work

How to use automatic line wrap and code formatting together in PhpStorm? My PhpStorm version is 2019.3.1
My SQL statements and my Strings look like the pic below.
What do I have to do, that the automatic wrapped lines do NOT jump to column 1 in the editor?
What do I have to do, that the automatic wrapped lines do NOT jump to column 1 in the editor?
Configure it accordingly (affects soft wrapped lines only, obviously): Settings/Preferences | Editor | General | Soft Wraps | Use original line's indent for wrapped parts

How can I set the line limit length for different types of files?

I have the following gray line that limits the number of characters a single line can accomodate:
I'd like to change the line length (this fill probably affect where this line is currently shown right now) for different files: for js, php files etc one line length, for HTML template files another. Is it possible? If not, how can I change at least for all file types?
This is now possible as the bug linked by #LazyOne has been resolved. You can now set different right margins for different programming languages.
The setting is under Settings | Editor | Code Style | <Your language> on the Wrapping and Braces tab at the very top of the list.
Default value can be set at
Settings/Preferences | Editor | Code Style --> Right margin (columns)
Since end of 2014 (after IDEA-59662 ticket was implemented) most languages have an option to adjust that value in language-dedicated section. For example: PHP
For unsupported languages .. or those that do not have such option -- you may try going with .editorconfig file and EditorConfig Support plugin -- should work.
For those who are from 2018:
Settings/Preferences | Editor | Code Style | Hard Wrap At
Or Settings/Preferences | Editor | Code Style | Your Technology(ex. PHP) | Hard wrap at