     # tabTrigger: fallback for name field
     return unless @zatanna and @autocomplete
     snippetEntries = []
+    haveFindNearestEnemy = false
+    haveFindNearest = false
     for group, props of e.propGroups
       for prop in props
         if _.isString prop  # organizePalette

    # TODO: Generalize this snippet replacement
    # TODO: Where should this logic live, and what format should it be in?
    if attackEntry?
      unless haveFindNearestEnemy
        # No findNearestEnemy, so update attack snippet to string-based target
        attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"'
      snippetEntries.push attackEntry

    # window.zatannaInstance = @zatanna  # For debugging. Make sure to not leave active when committing.
    # window.snippetEntries = snippetEntries
    lang = SpellView.editModes[e.language].substr 'ace/mode/'.length
    @zatanna.addSnippets snippetEntries, lang
    @editorLang = lang

  onMultiplayerChanged: ->
    if @session.get('multiplayer')

            meta: 'press enter'
            name: doc.name
            tabTrigger: doc.snippets[e.language].tab
          haveFindNearestEnemy ||= doc.name is 'findNearestEnemy'
          haveFindNearest ||= doc.name is 'findNearest'
          if doc.name is 'attack'
            # Postpone this until we know if findNearestEnemy is available
            attackEntry = entry
