I have a problem with PhpStorm. I'm talking about the line which divide code.
Sometimes I have too much characters in one line and this line move next characters to next line.
I prefer to use Ctrl + Alt + L to format code and this line destroy readability of code.
How can I move this line or even delete it?
You can try setting Hard wrap at value in Settings | Editor | Code Style | HTML to some big number and set Visual guides: accordingly. You can also try disabling Wrap text and setting Wrap attributes to Do not wrap.
Note that you can hide the hard wrap guide line by disabling Show hard wrap guide (configured in Code Style options) in Settings | Editor | General | Appearance, but hiding it won't prevent code from being wrapped (as #LazyOne mentioned in his comment)
Related
When I format the code in intellij with Alt + L the code doesn't align to go inside the vertical line in intellij.
Here is an example what I mean:
This array goes outside the vertical line, there where "test5" starts. When I format it, it will not be broken and go to a new line like this:
How can I set it in so it will format the code inside the line?
I googled it but what i found was only "how to remove the vertical line"
File | Settings | Editor | Code Style | Java, Wrapping and Braces, set the relevant options to Wrap if long:
Am trying to shift multiple lines of code in intellij IDEA by a single space using Tab shortcut but it always shifts by 4 spaces rather than a space. I have tried Edit > Convert Indent > To spaces but to no avail.
How do you shift multiple lines of code by a single space without messing with the default configuration for the file?
As #Andrey already suggested, I would use the Multi Cursor feature that has been around since intellij idea version 13.
I like the Add selection on Next Occurrence feature very much. It helps me to edit multiple lines very fast.
This screenshot shows the action in the Settings -> Keymap screen.
I have an annoying bug regarding intellij 14.0.3. The issue is that it keeps indents on empty lines and I can't remove that whitespace in any way. Under code style, I have not checked the checkbox "keep indents on empty lines" and judging from the display how that functionality works I'd say it would do it.
However, it still keeps the indents and that creates bad diffs in git since whitespace is added. Is this a bug? Can I in any way remove them? I have tried to uncheck that checkbox under both the language I use and the main one. None of them seems to change it.
Try enabling the Strip trailing spaces on save option in Settings/Editor/General.
You can choose whether this should be performed for All lines or only the lines you modify to avoid creating unnecessary diffs.
The whitespace is stripped when you explicitly hit CTRL+S or automatically after some period (IntelliJ has autosaving).
One thing to note is that if you have cursor on an empty line and there are some spaces before it, hitting CTRL + S won't strip the whitespace, because this would probably be annoying as your cursor would jump to the beginning of the line if the file was autosaved by IntelliJ (I read somewhere on YouTrack that this was a design decision).
Here is a screenshot of the option I describe:
What I did to strip spaces without having to open & save each file is running a regex in the find and replace window:
Ctrl+Shift+R
Text to find ^ +\n Find every line that starts with (^) one or more spaces ( +) and nothing else (/n).
Replace with: \n A new line.
General > Regular expression (obviously important to check this box)
Eventually you may want to limit the scope because this will be quite the lengthy operation
Find and eventually continue if IDEA warns for the high amount of occurrences.
Click All Files to run the actual replace operation. It might take some time before IDEA to respond.
I am new to Intellij Idea. I didn't find any information on how to wrap the code after certain characters (ex: 150 characters, break the line)
I want to break the code after the vertical line, the following code must come in next line.
Note: I used Reformat code option, but it did just realigned the code with some white spaces etc, but not wrapping up the code. It's difficult to see the end of the code.
You go to Settings (alt+ctrl+s) then select Code Style - General
Here you can configure your margins and if you want the code to wrap after it reaches the end of it
I have a text file that looks like:
a=12
b=13
c=14
d =15
e = 16
f = 17
Some of the numbers have spaces after them. Some don't. Some have tabs etc.
It seems that when i am in InteliJ's editor any place i click on is well .. clickable.
How can i restrict it by actual line length?
Settings -> Editor -> Allow placement of caret after end of line.
You can set the global code style to do things like put spaces around the assignment operator, and then do a global "reformat code" by selected text, file, or entire project.
I use IntelliJ 12: