Search code examples
intellij-idealive-templates

Define live templates with the same abbreviation for different contexts


I'd like to define two live templates for PHP and JavaScript with the same abbreviation: t.

In Live Templates preferences I have set

$this->

for PHP, but I cannot set

this

in JavaScript because of error

Duplicate live templates in user group

Is it possible somehow to define those templates with the same keyword but for different contexts ?


Solution

  • You can define live templates with the same prefix in different groups. If you specify different contexts for those, you'll get different behavior in those contexts.