3

In JetBrains IDE including PHPStorm, PyCharm, IntelliJ Idea, I can type this

age > 0.if

Then press tab and I will get

if (age > 0) {
}

In my application I need to type a lot of these:

    const resPartnerFactory = new BaseModelFactory(ResPartner);
    const accountChartTemplateFactory = new BaseModelFactory(AccountChartTemplate);
    const resCompanyFactory = new BaseModelFactory(ResCompany);

And want to create a live template like

    ResPartner.bmf

I have created these

enter image description here

How to finishe the .bmf part?

tom10271
  • 4,222
  • 5
  • 33
  • 62
  • 2
    Those are different things: the `.if` is a [Postfix completion](https://www.jetbrains.com/help/idea/auto-completing-code.html#postfix_completion) (that can transform the context a bit) while on screenshots you are trying to use [ordinary Live Templates](https://www.jetbrains.com/help/idea/using-live-templates.html) that will replace entered abbreviation with the predefined template. – LazyOne Dec 04 '20 at 09:58
  • 1
    The help page for Postfix completion shows how it can be done. As I understand it will be something like `const $EXPR$Factory = new BaseModelFactory($EXPR$);` You can also look at the [Custom Postfix Templates plugin](https://plugins.jetbrains.com/plugin/9862-custom-postfix-templates) -- it offers more of them + the ability to edit or create new ones (which was limited/not much possible until now, at very least in PhpStorm) – LazyOne Dec 04 '20 at 10:08

0 Answers0