R
R
Rajab Magomedov2020-10-29 12:49:57
phpstorm
Rajab Magomedov, 2020-10-29 12:49:57

Increasing the counter in PhpStorm?

Hello. Such a question on PhpStorm. Let's say I have this line: Is it possible to set some kind of anchor in PhpStorm so that when copying this div, the next value is suppressed? Let's say I copy via ctrl+D , it should be:
<div class="div1"></div>

<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
и т.д.

Often you need such a functional, but I can not find it

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2020-10-29
@AleksandrB

div.dev$*3+ tab

S
Sergey delphinpro, 2020-10-29
@delphinpro

Often you need such a functional, but I can not find it

If you need such classes in layout, then you are definitely doing something wrong. Here you need to learn to typeset, and not look for plug-ins for IDE.
But even if we assume that this is really necessary, even if not in classes, but, for example, in data attributes:
<div class="div" data-counter="1"></div>
<div class="div" data-counter="2"></div>

Then it is possible to save the use of a template engine, which, in addition to this, will bring a bunch of convenient goodies. Including getting rid of code duplication.
On the example of a twig
{% for i in [1..3] %}
  <div class="div" data-counter="{{ i }}"></div>
{% endfor %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question