G
G
goodweather2021-03-16 19:23:21
phpstorm
goodweather, 2021-03-16 19:23:21

How to add lines to snippets?

I found in phpstorm Live templates. They solve most of my problems except for one.

In projects, I often use the same array keys, such as "success", "errors", "PREVIEW_PICTURE", "DETAIL_PAGE_URL"

In other editors, I managed to create such snippets, autocomplete worked. But with the Live template, I can't get it to work.

Is it possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Matutu, 2021-03-26
@Matutu

In a separate file common to all projects, for example /home/autoComplete.inc

<?php
$arItem = [
  'DETAIL_PICTURE' => 1,
  'DETAIL_TEXT' => 1,
]; // СРАЗУ ПОСЛЕ ОБНУЛЯЕМ:
$arItem = []; // ИЛИ unset($arItem);  (НЕ ПРОВЕРЯЛ 2й ВАРИАНТ)
Then in all projects. The keys will appear if require is recognized by phpStorm. That's just how it is today. ¯\_(ツ)_/¯ require '/home/autoComplete.inc';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question