Autocomplete game.

And don’t create duplicate entries for hero. autocompletes

Closes #3883
This commit is contained in:
Matt Lott 2016-08-26 11:27:33 -07:00
parent b8d4e51331
commit a700a00c94

View file

@ -321,14 +321,12 @@ module.exports = class Autocomplete
attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"' attackEntry.content = attackEntry.content.replace '${1:enemy}', '"${1:Enemy Name}"'
snippetEntries.push attackEntry snippetEntries.push attackEntry
# Add copied hero. entries for most important ones that start with hero. # Update 'hero.' and 'game.' entries to include their prefixes
sortedEntries = _.sortBy snippetEntries, (entry) -> -1 * parseInt(entry.importance ? 0) for entry in snippetEntries
for entry in sortedEntries if entry.content?.indexOf('hero.') is 0 and entry.name?.indexOf('hero.') < 0
if entry.content?.indexOf('hero.') is 0 entry.name = "hero.#{entry.name}"
newEntry = _.cloneDeep(entry) else if entry.content?.indexOf('game.') is 0 and entry.name?.indexOf('game.') < 0
entry.name = "hero.#{newEntry.name}" entry.name = "game.#{entry.name}"
snippetEntries.push(newEntry)
break if snippetEntries.length - sortedEntries.length >= 10
if haveFindNearest and not haveFindNearestEnemy if haveFindNearest and not haveFindNearestEnemy
spellView.translateFindNearest() spellView.translateFindNearest()