 
   add: (filePath, snippetsBySelector) ->
     for selector, snippetsByName of snippetsBySelector
+      # Skip snippet if it's not in the same scope or the global scope
+      if selector.indexOf(@grammar.scopeName) is -1 and
+      selector.indexOf("*") is -1
+        continue
       for label, snippet of snippetsByName
         snippet.label = label
         @snippets[label] = snippet

        callback?()

  loadSyntaxPackages: (callback) ->
    grammar = @editor.getGrammar()
    grammarPath = grammar.path

    if grammarPath
      packagePath = path.resolve grammarPath, "../.."

module.exports =
class SnippetsLoader
  loaded: false
  constructor: (@editor) ->
    @grammar = @editor.getGrammar()

  getUserSnippetsPath: ->
    userSnippetsPath = CSON.resolve path.join(atom.getConfigDirPath(), "snippets")
