mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 10:56:53 -05:00
Merge pull request #3548 from Catsync/autocomplete-hero
hero autocomplete hack
This commit is contained in:
commit
7ff12f326f
1 changed files with 11 additions and 0 deletions
|
@ -517,6 +517,17 @@ module.exports = class SpellView extends CocoView
|
||||||
when 'python' then 'while True'
|
when 'python' then 'while True'
|
||||||
when 'coffeescript' then 'loop'
|
when 'coffeescript' then 'loop'
|
||||||
else 'while true'
|
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 =
|
entry =
|
||||||
content: content
|
content: content
|
||||||
meta: $.i18n.t('keyboard_shortcuts.press_enter', defaultValue: 'press enter')
|
meta: $.i18n.t('keyboard_shortcuts.press_enter', defaultValue: 'press enter')
|
||||||
|
|
Loading…
Reference in a new issue