Skip to content

Commit

Permalink
issue #26
Browse files Browse the repository at this point in the history
  • Loading branch information
zaggino committed Feb 11, 2015
1 parent 6502e33 commit 94c3183
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions default_snippets/anylang/comment
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
* {{$1:comment}}
*/
10 changes: 7 additions & 3 deletions src/Snippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}

Expand Down

0 comments on commit 94c3183

Please sign in to comment.