How to create snippets for __Construct?

Asked

Viewed 193 times

4

I use Codeintel for PHP, but when I try to create the __construct I have to do everything manual. Someone knows how to develop the snippet to create the same or have a plugin own?

1 answer

0

Go on Tools > New Snippet.

Then paste this sample code:

<snippet>
    <content><![CDATA[
public function __construct(${1:\$argument})
{
}
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>__con</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>

Save it in the folder Packages/User with the desired name, giving you the extension sublime-snippet.

Now just open a PHP file and type __con to show the option of our small snippet test.

Observing: If you want to change the trigger to the snippet to another name, simply change the value of tabTrigger to the desired value.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.