mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -05:00
fixed autocomplete issue related to switching the programming language
This commit is contained in:
parent
3f57644b0b
commit
004a14ae3c
3 changed files with 11 additions and 9 deletions
|
@ -93,7 +93,7 @@ module.exports = class SpellPaletteView extends View
|
|||
tabbify = count >= 10
|
||||
@entries = []
|
||||
|
||||
Backbone.Mediator.publish 'tome:update-snippets', propGroups: propGroups, allDocs: allDocs
|
||||
Backbone.Mediator.publish 'tome:update-snippets', propGroups: propGroups, allDocs: allDocs, language: @options.language
|
||||
|
||||
for owner, props of propGroups
|
||||
for prop in props
|
||||
|
|
|
@ -96,6 +96,7 @@ module.exports = class SpellView extends View
|
|||
@aceSession.selection.on 'changeCursor', @onCursorActivity
|
||||
$(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick
|
||||
@zatanna = new Zatanna @ace,
|
||||
|
||||
liveCompletion: aceConfig.liveCompletion ? true
|
||||
completers:
|
||||
keywords: false
|
||||
|
@ -180,16 +181,17 @@ module.exports = class SpellView extends View
|
|||
return (owner is 'this' or owner is 'more') and (not doc.owner? or doc.owner is 'this')
|
||||
console.log 'could not find doc for', prop, 'from', e.allDocs['__' + prop], 'for', owner, 'of', e.propGroups unless doc
|
||||
doc ?= prop
|
||||
if doc.snippets?[@spell.language]
|
||||
if doc.snippets?[e.language]
|
||||
entry =
|
||||
content: doc.snippets[@spell.language].code
|
||||
content: doc.snippets[e.language].code
|
||||
name: doc.name
|
||||
tabTrigger: doc.snippets[@spell.language].tab
|
||||
tabTrigger: doc.snippets[e.language].tab
|
||||
snippetEntries.push entry
|
||||
|
||||
window.zatanna = @zatanna
|
||||
window.snippetEntries = snippetEntries
|
||||
@zatanna.addSnippets snippetEntries, @spell.language
|
||||
# window.zatanna = @zatanna
|
||||
# window.snippetEntries = snippetEntries
|
||||
lang = @editModes[e.language].substr 'ace/mode/'.length
|
||||
@zatanna.addSnippets snippetEntries, lang
|
||||
|
||||
onMultiplayerChanged: ->
|
||||
if @session.get('multiplayer')
|
||||
|
@ -652,7 +654,7 @@ module.exports = class SpellView extends View
|
|||
onChangeLanguage: (e) ->
|
||||
return unless @spell.canWrite()
|
||||
@aceSession.setMode @editModes[e.language]
|
||||
@zatanna.set 'language', @editModes[e.language].substr('ace/mode/')
|
||||
# @zatanna.set 'language', @editModes[e.language].substr('ace/mode/')
|
||||
wasDefault = @getSource() is @spell.originalSource
|
||||
@spell.setLanguage e.language
|
||||
@reloadCode true if wasDefault
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
"bootstrap": "~3.1.1",
|
||||
"validated-backbone-mediator": "~0.1.3",
|
||||
"jquery.browser": "~0.0.6",
|
||||
"zatanna": "~0.0.1"
|
||||
"zatanna": "~0.0.2"
|
||||
},
|
||||
"overrides": {
|
||||
"backbone": {
|
||||
|
|
Loading…
Reference in a new issue