Intellij IDEA: newline after specific tag (br) - html

Is there a way to create a newline after a specific tag, in my case e.g. after every <br>? I've searched the settings under "Editor | Code Style | HTML | Other", but couldn't find it...

There is no such option, please vote for WEB-5182 to raise its priority and get notified on updates

Related

PhpStorm: how to Make the inspector / debugger ignore stuff in comments?

I don't need it telling me I spelled the word "danggit!" incorrectly. I just want it to ignore the comments.
like this:
<?php
$a = 123;// simple as, danggit!
/* danggit, this frustrates me! */
also
"The word 'thru' is informal. Consider replacing it with through."
I dont want to see this, especially in comments
I don't need it telling me I spelled the word "danggit!" incorrectly. I just want it to ignore the comments.
You can configure where this "Typo" inspection should be applied at the following screen: Settings/Preferences | Editor | Inspections | Proofreading | Typo.
https://www.jetbrains.com/help/phpstorm/spellchecking.html#configure-the-typo-inspection
Danggit, now i'm getting "The word 'thru' is informal. Consider replacing it with through." I dont want to see this, especially in comments.
This is a different thing in action. This time it's Grammar.
Settings/Preferences | Editor | Natural Languages | Grammar and Style -- Here on a Scopes tab you can configure the same. https://www.jetbrains.com/help/phpstorm/grammar.html#scope
... or/and configure what rules to use (on a Rules tab): https://www.jetbrains.com/help/phpstorm/grammar.html#rules
In case if you need to configure too many of them, well... just disable the Grammar checks completely: Settings/Preferences | Editor | Inspections | Proofreading | Grammar

Making PhpStorm's auto-format add a newline before control structures

In order to make code more readable, I like to add a newline before control structures.
For instance:
$var = new Thing1;
if ($var instanceof Thing2) {
echo 'This thing has Thing2!';
}
Becomes:
$var = new Thing1;
if ($var instanceof Thing2) {
echo 'This thing has Thing2!';
}
I do this naturally when I code, however, that's not the case with a lot of the code I have to examine.
Is it possible to do this in PhpStorm 2018? There doesn't seem to be an option for this.
All possible places where IDE can keep specific number of blank lines are configured at Settings/Preferences | Editor | Code Style | PHP | Blank Lines.
From what I see -- nothing for control structures or code blocks in general.
The closest ticket I have managed to find is this: https://youtrack.jetbrains.com/issue/WI-19769 -- watch it (star/vote/comment) to get notified on any progress.
Or do you own search and check appropriate subsystem.
As LazyOne pointed out, there does not seem to be a way to do this using the Code Formatter, which would have been ideal.
I've tried playing around with Structural Search and Replace but didn't find a way to properly match/replace conditional statements. You may want to look into that.
In the meantime, the following "standard" Search & Replace regexp may help:
Search: ^(?<!\n\n)([ \t]*)if([ \t]*)\(
Replace: \n$1if$2(
Note that it will also add newlines between // comments and if's, which may or may not be something you want/need.

PhpStorm html class name folding

PhpStorm has great code folding features, but I need to know:
If there is any way to fold html classes names in code like style inline attribute values?
Because, If I'm going to use some libs like MDL, it could be alooooooot of unnecessary html class declarations and I want to keep it folded.
Like this one:
There is no such option for class attribute collapsing -- only for HTML's 'style' attribute.
All available option can be found in Settings/Preferences | Editor | General | Code Folding
Consider submitting new Feature Request ticket to the Issue Tracker at https://youtrack.jetbrains.com/issues/WEB (but check for existing tickets first).

PhpStorm remove line wrapping for "use statements" from code formatter

I would like to remove the line wrapping for the use statements in a php class when I apply Code | Reformat code.
current look:
use
Acme/Foo/Bar;
(my) desired look:
use Acme/Foo/Bar;
I've been looking at the File | Setting | Code Style | PHP but could not find it.
Another question is that is it possible to wrap logical operators but no other binary operators using the formatter. I don't expect much though..
Think I am relying too much on the auto-formatter. Now I figured out that I can just do whatever I want (manually) by disabling most of the line wrapping options but enabling the keep line breaks option. The "use statements" formatting as mentioned in my question is because I ticked on the wrapping option under File | Setting | Code Style | PHP | Wrapping and Braces | Function declaration parameters.

phpstorm french characters formating issue

I'm using PHPstorm 6.
When i try to format my code which contains french characters, i got a issue like you see on the pictures.
NB : i got this just when i put my text into a tag like :
<span>génie Informatique</span>
So before formatting i was this :
And after formatting i got this
Thanks
What kind of file is that -- HTML?
In any case: you do have light green background between the tags. This suggests that you have another language injected between those tags (Language Injection functionality), which may use completely different formatting rules (not HTML -- e.g. JavaScript or whatever you may have injected there).
Possible solution:
Place cursor somewhere between such tags, Alt+Enter (or click on light bulb icon) and use "Uninject Language" option.
Alternatively: Settings | Language Injections -- find and disable (or even delete) offending entry there (will be "global" or "project" type in last column).