diff --git a/default_snippets/anylang/comment b/default_snippets/anylang/comment new file mode 100644 index 0000000..1435fad --- /dev/null +++ b/default_snippets/anylang/comment @@ -0,0 +1,3 @@ +/* + * {{$1:comment}} + */ \ No newline at end of file diff --git a/src/Snippets.js b/src/Snippets.js index 5e10e22..aa2203a 100644 --- a/src/Snippets.js +++ b/src/Snippets.js @@ -61,9 +61,13 @@ define(function (require, exports, module) { // filter snippets by language of the context file var currentFileExtension = FileUtils.getSmartFileExtension(fileContext); result = _.filter(result, function (snippet) { - return snippet.meta && snippet.meta.lang && - snippet.meta.lang === currentFileExtension || - snippet.meta.lang.indexOf(currentFileExtension) !== -1; + var noLang = !snippet.meta || !snippet.meta.lang; + var hasLang = snippet.meta && snippet.meta.lang; + var langMatchesFile = hasLang && ( + snippet.meta.lang === currentFileExtension || + snippet.meta.lang.indexOf(currentFileExtension) !== -1 + ); + return noLang || langMatchesFile; }); }