I have been trying to add PHP snippet in Atom in MAC but the snippet does not work in the editor itself. A sample snippet I am trying to use is as below:
'.text.html.php':
'Paragraph tag':
'prefix': 'ptag'
'body': '<p>{1}</p>'
The scope is
text.html.php
When I try to access the snippet by typing "ptag" and hit tab nothing happens. Looks like I am missing something, help.
While .text.html.php scope is correct you might want to extend it to HTML files. In order to do that .text.html and .text.html.php should be separated with a comma:
'.text.html, .text.html.php':
'Paragraph tag':
'prefix': 'ptag'
'body': '<p>${1}</p>'
Alternatively you could set the scope to .text.html,php.
To position the cursor inside p tag you have to write ${1} instead of {1}. If you want to add additional text to it you can use ${1:paragraph}, so that it will generate <p>paragraph</p> and paragraph will be selected for modification.
You can read more about snippets in Flight Manual
Edit: Fixed scope as noted by Adam
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With