HTML and PHP Snippets in href quotes do not work


#1

Hello,

I’ve made some HTML and PHP Snippets with the scope ‘.text.html.php’ and they work almost everywhere in my .php files, except inside the quotes of a href ( … same problem with classes and basically everywhere inside of quotes).

It’s annoying, for example I cant use PHP Snippets there.

By the way, I’m using Atom 1.8.0, the latest Version. If you need more Infos to help me, feel free to ask.

Thank you!


#2

For snippets you want in quotes, try adding them with .string.html.


#3

Thanks for the fast answer.
Unfortunately, its still not working. My Snippet looks like this:

'.string.html.php':
    'Echo':
        'prefix': 'E'
        'body': """<?=$1?>"""

I’ve experimented with the scope (’.string.html’, ‘.string.php’, etc.) but that didnt work either.


#4

Can you share some example code where the snippet doesn’t work? Everything is better with repro steps :grinning:


#5

.string.html works for me. There is no php class in matched quotes, so that won’t work.


#6

For example, just some lines from one of my .php files:

<div class="elements">
<?php
    if ($lCatalogID != "") {
?>
    <a href=""><?=$oDic->GetDicItem('newelement')?></a>
<?php
    }
?>
</div>

When I try to insert my snippet

'.string.html':
    'Echo':
        'prefix': 'E'
        'body': """<?=$1?>"""

into the quotes of the href, I get no autocompletion and the snippet is not working.


#7

I’m not sure why. It works for me. The snippet and code are exactly the same, and the buffer I’m testing it in is set on the PHP grammar.


#8

I see the same results as @DamnedScholar. The snippet expands on Tab. You are correct that the autocomplete for it doesn’t show up though.