PHP Snippets not working


#1

Hi!
I’m trying to customize some snippets but the PHP ones don’t work.

If I put this in my snippets.cson file, it works from any js file:

   '.source.js':
      'example':
        'prefix': 'ex'
        'body': 'this is an example'

If i just change it like this, it doesn’t work in php files:

'.source.php':
  'example':
    'prefix': 'ex'
    'body': 'this is an example'

Any idea? Could this be an Emmet package (which I have installed) conflict problem?

I also tried using the * selector to make it work in any file, but no luck. I don’t really know if this should work, anyway…

Cheers


#2

I think the scope for PHP is .text.html.php, so does this work:

'.text.html.php':
  'example':
    'prefix': 'ex'
    'body': 'this is an example'

#3

Thanx for your answer, but it’s not working either…


#4

Hmm… It worked for me


#5

Maybe if you try

'.text.php':
  ...

#6

Not working… Even disabling Emmet doesn’t fix it. By the way my current version is 0.186


#7

Have you tried(with ‘.text.html.php’: scope) to refresh Atom or run in safe mode?


#8

A PHP file is assumed to be HTML until you’re inside a <?php block. So outside the block the scopes look like this:

But inside the block the scopes look like this:

So snippets will need to be scoped for whether you want them to work outside or inside a PHP block. You might try just:

'.php':
  # snip

Oddity in PHP Snippets
#9

Yes, that’s totally right, thanks!!
I didn’t know the “log scopes at cursor” trick, thanks again.

Keep the good work, Atom is awesome!


#10

Hi again,
Finally I have been able to understand a little bit more of this issue. Today, when I started Atom the hints you gave me about the right PHP scopes worked, even the scopes that didn’t work on Friday (see olmokramer post above) ¿?¿?

After some hours working I realized that Emmet package was disabled, I had disabled it on Friday, but I guess it didn’t really disable it until I ran atom from a different folder or restart my computer, not even reloading worked for me. I made a few tests and saw that this problem is directly related with the Emmet package, but also it’s an Atom issue, since disabling Emmet package doesn’t work as expected.

I’ve also notice that the PHP tags inside HTML code are not highlighted properly when Emmet is enabled. Where should I put this issues so Emmet package developers can take care of it?

Cheers


#11

Emmet should clean up after itself properly, if it doesn’t, that’s also an Emmet issue.

You can find the Issues list for any Atom package by going to the package in the Settings View and clicking the “Report Issue” button:

Or find the package on the website and click the Bugs button:


#12

OK, thank you very much.

I’ve been checking the open issues and some of them seem related with the snippets problems. So i will just open one for the clean up after disabling.

Cheers