Is it possible to add some kind of comment marker in the code which can group or separate blocks in the structure view?
This isn't very helpful:
I was hoping for something similar to the pragma mark feature in XCode (like #pragma mark in Swift?)
Is it possible to add some kind of comment marker in the code which can group or separate blocks in the structure view?
This isn't very helpful:
I was hoping for something similar to the pragma mark feature in XCode (like #pragma mark in Swift?)
Exactly the same behavior / act as a plain separator -- nope.
Grouping -- yes.
//<editor-fold defaultstate="collapsed" desc="YOUR TEXT HERE">
...CSS CODE HERE...
//</editor-fold>
An example:
//<editor-fold defaultstate="collapsed" desc="Misc global things">
.main-container .main-wrapper {
padding-bottom: 0;
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Video embedding">
.embed-video {
margin-bottom: 20px;
position: relative;
overflow: hidden;
width: 100%;
&::after {
display: block;
content: '';
}
> iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
}
.embed-video-16x9::after {
padding-top: 56.25%;
}
//</editor-fold>
You can also make them nested if needed (I personally have no need for this though; and never even tried more than one level deep).
HINT: you can use dashes or similar symbols to make it a bit more visible/standing out (distinguish from the actual styles):
//<editor-fold defaultstate="collapsed" desc="=== My First Block">
.main-container .main-wrapper {
padding-bottom: 0;
}
//</editor-fold>
//<editor-fold desc="=== My Second Block">
.main-container .main-wrapper {
padding-bottom: 0;
}
//</editor-fold>
region
...endregion
style of comment will also work. It is simpler to write & read (since it's not a XML-like tag).
Cons: you cannot provide the default state (collapsed or expanded) this way.
//region My First Block
.main-container .main-wrapper {
padding-bottom: 0;
}
//endregion
//region My Second Block
.main-container .main-wrapper {
padding-bottom: 0;
}
//endregion
You cannot mix multiple comment styles in the same file.
I mean: you can... but the first style found in a file will be treated as a grouping comment; another style will be treated as an ordinary plain comment.
https://www.jetbrains.com/help/phpstorm/working-with-source-code.html#use-the-surround-with-action