emmetio / emmet-atom

Emmet support for Atom
MIT License
764 stars 180 forks source link

Javascript snippets not expanding as expected #536

Open lewishowles opened 6 years ago

lewishowles commented 6 years ago

I've been having an issue that I've just left alone for a while now, and was wondering if another set of eyes could help me fix it.

I use Emmet all the time, love it. The only place I can't currently use it is in Javascript snippets. For some reason they never trigger, no matter how I try to format the Snippets file.

I know having an invalid JSON file will stop it working, but I have validated the file and all looks fine.

My file (cut down, but only removing snippets that are of no interest to everyone else) is:

{
    "html": {
        "profile": "xhtml",
        "snippets": {
            ...
        },
        "abbreviations": {
            ...
        }
    },

    "phtml": {
        "extends": "html"
    },

    "scss": {
        "profile": "css",
        "snippets": {
            ...
        },

        "abbreviations": {
            ...
        }
    },

    "css": {
        "filters": "css",
        "profile": "css",
        "snippets": {
            ...
        }
    },

    "javascript": {
        "snippets": {
            "log": "console.log('|')",
            "logv": "console.log(|)",
            "fe": "${array}.forEach(function(${item}) {\n"
        }
    },

    "php": {
        "snippets": {
            ...
        }
    },

    "blade": {
        "filters": "html",
        "profile": "html",
        "snippets": {
            ...
        }
    }
}

For the Javascript part, I've tried the above, as well as:

"js": {
    "snippets": {
        "log": "console.log('|')",
        "logv": "console.log(|)",
        "fe": "${array}.forEach(function(${item}) {\n"
    }
},

and

"js": {
    "filters": "css",
    "profile": "css",
    "snippets": {
        "log": "console.log('|')",
        "logv": "console.log(|)",
        "fe": "${array}.forEach(function(${item}) {\n"
    }
},

When trying to expand abbreviation with, say, log, I get <log>

chadwithuhc commented 6 years ago

Same. Anyone know how to fix this?

lewishowles commented 6 years ago

I never found a way. Since there was no hint of a response I found something else that manages snippets.

sergeche commented 6 years ago

Currently, JS is not supported by Emmet and you should use native snippets instead