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
How do I select a line by shortcut?
My goal is e.g. to surround a specific code snippet with something like try/catch block:
Select line Key -> Shift+F10 -> s -> s -> t -> r -> y -> enter -> baammm.
I found I could do HOME and then shift+END, but the HOME and END button are far away. According to Visual Studio Shortcut Description (unstated to which version this is referencing to) it says Ctrl + L.
In my case (freshly downloaded VS without any changes made in any settings) Ctrl+L (i.e. Ctrl+Shift+l) is deleting the line, which is NOT selecting it. Ctrl+l is then deleting the line keeping its contents in the cache which is very basically Ctrl+x
According to Mr_Green in that similar question) it is Ctrl+E then U, which doesn't work either.
And then I found this:
Tools -> Options -> Environment -> Keyboard
Here I would think to find something like "Edit.SelectLine", but it's not there.
IntelliJ IDEA 13 includes new improvement Statement highlighting in Database Console:
How to change color of highlighting ?
You have to go to: Setting -> Editor -> Colors & Fonts -> General -> Injected language fragment -> Background
How to make phpstorm display line numbers by default?
Couldn't find that option. It's kind of annoying to turn them on manually for each page.
Settings (or Preferences if you are on Mac) | Editor | General | Appearance and check Show line numbers.
Just now found where is it on Windows. Its View -> Active Editor -> Show Line Numbers (changes only for current document) and File -> Settings -> Editor -> Appearance -> Show Line Numbers (for all documents)
For Mac Version go to PhpStorm -> Preferences in menu.
In the preference window go to IDE settings -> Editor -> Appearance -> Show Line Numbers (To change setting for all documents)
OR if you want to quickly set show line number PER CURRENT WINDOW even easier - right click on the long white column (where breakpoints are set) then select Show Line Numbers.
Red dot on the screenshot is a place where you have to click
All the guys are right. I am just bringing the the current soultion with the images.
Go to File-> Settings
In the box in the top right corner type in line numbers, just below that choose Editor->Appearance, from the right checkboxes, find Show line numbers and check it.
After that hit Apply and OK
That should do the trick.
My version of PhpStorm is 6.0.3
If you're on a Mac:
PhpStorm -> Preferences... -> Editor -> Appearance -> Show Line Numbers
just double tap 'Shift'
and search for 'Line Numbers'
and there you will see a toggle option on or off
In PHPStorm 8 this setting is no longer under 'Appearance' but now in:
File -> Settings -> Editor -> Appearance -> Show line numbers
Follow the below steps:
Click on File->Settings->
In the Settings dialog box Expand Editor under IDE Settings
Click Apperance - > select Show line numbers.
Click Apply->Ok.
Simplest solution for line numbers in php storm..There are many other solutions but i think A big picture a good from 1000 words.
File -> Settings -> Editor -> General -> Appearance
check "Show Line Numbers"
This is the current location as of phpStorm 8.0.2 on Ubuntu 14.04
Settings -> editor | appearance | Show line numbers
Just right click on left side where line numbers generally show, select "show line numbers"
In PHPStorm 2016: File > Settings > Editor > General > Appearance > check "Show line numbers"
By typing command + shift + A you will get a search prompt and write line numbers . Now you can trigger button on or off
For PhpStorm version 9 on Windows.
File→Settings→Editor→General→Appearence then check Show line numbers
in the top right corner is a search button type show line numbers and you will see a toggle option. this way you never have to do it yourself. :)
File->settings->IDE Settings->Editor->Appearance
And just check the "Show line numbers" works with 8.0.1
On the Mac version 8.0.1 has this setting here:
PhpStorm > Preferences > Editor (this is in the second section on the left - i.e. IDE Settings NOT Project Settings) > Appearance > Show line numbers
You should go to: File -> Settings -> Editor -> General -> Appearance -> Show Line Numbers
As of the latest version:
PhpStorm > Preferences.. > Editor > General > Appearance > Show line numbers
I'm trying to force IntelliJ to reformat the code the way Eclipse does it.
When I set a line width to e.g. 120 chars I would like IDE to join line that were broken up to multiple lines (e.g. because the line width was set to 80 chars).
I want to go from here:
int a = 1
+ 2;
To here:
int a = 1 + 2
Is it possible in IntelliJ? I'm looking for the appropriate setting in the formatter but cannot find it. Could someone tell me where I can find it?
This works for me in intellij 8 if i go to:
File -> Settings -> Code Style -> Wrapping -> Binary operations -> set to: 'Wrap if long' or 'Do not wrap'
Then CTRL-ALT-L to reformat the code
Menu -> Edit -> Join Lines (Ctrl+Shift+J)
If your code already contains inappropriate line breaks and you want the formatter to remove them during the reformat,
File -> Settings -> Code Style -> Wrapping and Braces ->
Keep When Formatting -> Line Breaks -> Untick
(at least on IntelliJ 15 based Editors)
For Intellij 2016.2.x I had to deselect this option in the Settings:
Then go back to your code and press CTRL-ALT-L