Merge pull request #3548 from Catsync/autocomplete-hero

hero autocomplete hack
This commit is contained in:
Catsync 2016-04-13 14:59:21 -04:00
commit 7ff12f326f

View file

@ -517,6 +517,17 @@ module.exports = class SpellView extends CocoView
when 'python' then 'while True'
when 'coffeescript' then 'loop'
else 'while true'
# For now, update autocomplete to use hero instead of self/this, if hero is already used in the source.
# Later, we should make this happen all the time - or better yet update the snippets.
source = @getSource()
if /hero/.test(source)
thisToken =
'python': /self/,
'javascript': /this/,
'lua': /self/
if thisToken[e.language] and thisToken[e.language].test(content)
content = content.replace thisToken[e.language], 'hero'
entry =
content: content
meta: $.i18n.t('keyboard_shortcuts.press_enter', defaultValue: 'press enter')