Set in intellij the root indent to 0 - intellij-idea

I am using intellij and i want to set the root indent to 0, but the normal indent to 2. Is there a way in intellij to do that?
Actual:
Target:
Thank you everyone.

Try adding 'script' to Settings | Editor | Code Style | HTML > Other > Do no indent children of.

Related

What is this empty non-numbered row in IntelliJ?

What is this empty non-numbered row in IntelliJ? How can it disable me? Class should be on line 3.
Disable "Preferences | Editor | Inlay Hints | Code Vision"
We are working on the fix already: https://youtrack.jetbrains.com/issue/IDEA-290051/Code-Vision:-inlay-consumes-vertical-space-in-the-editor-even-wh

IntelliJ doesn't automatically break line

I'm having issues with IntelliJ automatic Reformat Code on one specific line of code:
catch (MyException1 | MyException2 | MyException3 | MyException4 | MyException5 | MyException6 | MyException7 | MyException8 e) {
I have set in Editor -> Code Style Hard wrap at 140
In Editor -> Code Style -> Java -> Wrapping and Braces everything is either Chop down if Long or Wrap if long
Now, the issue is that running Code -> Reformat Code doesn't break this line into 2 automatically (it should as it exceeds 140 characters). And what's worse, if I break it manually, then Reformat Code will bring it back to one line. As I have the Line Length inspection on, IntelliJ complains about this line.
This is the only line in the whole project where IntelliJ has this problem, all other expressions containing + or || etc. are correctly wrapped.
Wrapping or chopping down multi-catch types is not supported on IntelliJ IDEA 2021.3 and below. IntelliJ IDEA 2022.1 will support this. See https://youtrack.jetbrains.com/issue/IDEA-178941

IntelliJ - code with "expand all" by default

Question please on IntelliJ.
Currently, IntelliJ "folds" code that are one liners. Something like:
public String getFoo() { return foo; }
A insist, it is just a visual. On the file itself, it is not folded, just on the visual of the IDE.
public String getFoo() {
return foo;
}
On Mac, on each start of IntelliJ, I am currently selecting all files and pressing "shift" + "command + "plus sign +" to expand all files.
Is there a way to have by default files with expand all?
Thank you
Disable these settings:
Settings (Preferences on macOS) | Editor | General | Code Folding | Simple property accessors
Settings (Preferences on macOS) | Editor | General | Code Folding | One-line methods

Intellij IDEA 2018.1 - Disable simple comment folding

Using IntelliJ 2018.1 I noticed that on certain files multi-line simple comments are always folded:
// My multi
// line
// comment
becomes
//...
How do I turn it off? I need to always see my comments.
Settings | Editor | General | Code Folding | [ ] End of line comments sequence

How to change line width in IntelliJ (from 120 character)

I was wondering how I can change the line length in IntelliJ.
Since I use a pretty high resolution, I get that line that shows 120 characters straight through the middle of the screen. Can I change it from 120 to, say, 250?
IntelliJ IDEA 2018
File > Settings... > Editor > Code Style > Hard wrap at
IntelliJ IDEA 2016 & 2017
File > Settings... > Editor > Code Style > Right margin (columns):
You can alter the "Right margin" attribute in the preferences, which can be found via
File | Settings | Project Settings | Code Style - General
Right Margin (columns) In this text box, specify the number of columns
to be used to display pages in the editor.
Source: Jetbrains
It seems like Jetbrains made some renaming and moved settings around so the accepted answer is no longer 100% valid anymore.
Intellij 2018.3:
hard wrap - idea will automatically wrap the line as you type, this is not what the OP was asking for
visual guide - just a vertical line indicating a characters limit, default is 120
If you just want to change the visual guide from the default 120 to lets say 80 in my example:
Also you can change the color or the visual guide by clicking on the Foreground:
Lastly, you can also set the visual guide for all file types (unless specified) here:
It may be useful to notice that very good answers given above may not be enough. It is because of one more tick is required here:
Be aware that need to change both location:
File > Settings... > Editor > Code Style > "Hard Wrap at"
and
File > Settings... > Editor > Code Style > (your language) > Wrapping and Braces > Hard wrap at
I didn't understand why my this didn't work but I found out that this setting is now also under the programming language itself at:
'Editor' | 'Code Style' | < your language > | 'Wrapping and Braces' | 'Right margin (columns)'
Open .editorconfig in the root of your project (or create one if you don't have any) and add:
max_line_length = 80
The IDE should pick it up immediately (works in PhpStorm, developed by the same company). As a bonus, it can be committed to GIT and will stay consistent across different editors you may be using in the future. More info on .editorconfig.