mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
integrated autocomplete
This commit is contained in:
parent
9a3ba70ea2
commit
f6355b034b
5 changed files with 22 additions and 3 deletions
|
@ -382,6 +382,8 @@
|
||||||
editor_config_keybindings_label: "Key Bindings"
|
editor_config_keybindings_label: "Key Bindings"
|
||||||
editor_config_keybindings_default: "Default (Ace)"
|
editor_config_keybindings_default: "Default (Ace)"
|
||||||
editor_config_keybindings_description: "Adds additional shortcuts known from the common editors."
|
editor_config_keybindings_description: "Adds additional shortcuts known from the common editors."
|
||||||
|
editor_config_livecompletion_label: "Live Autocompletion"
|
||||||
|
editor_config_livecompletion_description: "Displays autocomplete suggestions while typing."
|
||||||
editor_config_invisibles_label: "Show Invisibles"
|
editor_config_invisibles_label: "Show Invisibles"
|
||||||
editor_config_invisibles_description: "Displays invisibles such as spaces or tabs."
|
editor_config_invisibles_description: "Displays invisibles such as spaces or tabs."
|
||||||
editor_config_indentguides_label: "Show Indent Guides"
|
editor_config_indentguides_label: "Show Indent Guides"
|
||||||
|
|
|
@ -65,6 +65,7 @@ UserSchema = c.object {},
|
||||||
invisibles: {type: 'boolean', 'default': false}
|
invisibles: {type: 'boolean', 'default': false}
|
||||||
indentGuides: {type: 'boolean', 'default': false}
|
indentGuides: {type: 'boolean', 'default': false}
|
||||||
behaviors: {type: 'boolean', 'default': false}
|
behaviors: {type: 'boolean', 'default': false}
|
||||||
|
liveCompletion: {type: 'boolean', 'default': false}
|
||||||
|
|
||||||
simulatedBy: {type: 'integer', minimum: 0, default: 0}
|
simulatedBy: {type: 'integer', minimum: 0, default: 0}
|
||||||
simulatedFor: {type: 'integer', minimum: 0, default: 0}
|
simulatedFor: {type: 'integer', minimum: 0, default: 0}
|
||||||
|
|
|
@ -27,6 +27,12 @@ block modal-body-content
|
||||||
option(value="emacs" selected=(keyBindings === "emacs")) Emacs
|
option(value="emacs" selected=(keyBindings === "emacs")) Emacs
|
||||||
span.help-block(data-i18n="play_level.editor_config_keybindings_description") Adds additional shortcuts known from the common editors.
|
span.help-block(data-i18n="play_level.editor_config_keybindings_description") Adds additional shortcuts known from the common editors.
|
||||||
|
|
||||||
|
.form-group.checkbox
|
||||||
|
label(for="tome-live-completion")
|
||||||
|
input#tome-live-completion(name="liveCompletion", type="checkbox", checked=liveCompletion)
|
||||||
|
span(data-i18n="play_level.editor_config_livecompletion_label") Live Autocompletion
|
||||||
|
span.help-block(data-i18n="play_level.editor_config_livecompletion_description") Displays autocomplete suggestions while typing.
|
||||||
|
|
||||||
.form-group.checkbox
|
.form-group.checkbox
|
||||||
label(for="tome-invisibles")
|
label(for="tome-invisibles")
|
||||||
input#tome-invisibles(name="invisibles", type="checkbox", checked=invisibles)
|
input#tome-invisibles(name="invisibles", type="checkbox", checked=invisibles)
|
||||||
|
|
|
@ -13,6 +13,7 @@ module.exports = class EditorConfigModal extends View
|
||||||
invisibles: false
|
invisibles: false
|
||||||
indentGuides: false
|
indentGuides: false
|
||||||
behaviors: false
|
behaviors: false
|
||||||
|
liveCompletion: false
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'change #tome-invisibles': 'updateInvisibles'
|
'change #tome-invisibles': 'updateInvisibles'
|
||||||
|
@ -20,6 +21,7 @@ module.exports = class EditorConfigModal extends View
|
||||||
'change #tome-key-bindings': 'updateKeyBindings'
|
'change #tome-key-bindings': 'updateKeyBindings'
|
||||||
'change #tome-indent-guides': 'updateIndentGuides'
|
'change #tome-indent-guides': 'updateIndentGuides'
|
||||||
'change #tome-behaviors': 'updateBehaviors'
|
'change #tome-behaviors': 'updateBehaviors'
|
||||||
|
'change #tome-live-completion': 'updateLiveCompletion'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super(options)
|
super(options)
|
||||||
|
@ -43,6 +45,7 @@ module.exports = class EditorConfigModal extends View
|
||||||
c.invisibles = @aceConfig.invisibles
|
c.invisibles = @aceConfig.invisibles
|
||||||
c.indentGuides = @aceConfig.indentGuides
|
c.indentGuides = @aceConfig.indentGuides
|
||||||
c.behaviors = @aceConfig.behaviors
|
c.behaviors = @aceConfig.behaviors
|
||||||
|
c.liveCompletion = @aceConfig.liveCompletion
|
||||||
c
|
c
|
||||||
|
|
||||||
updateSessionLanguage: ->
|
updateSessionLanguage: ->
|
||||||
|
@ -63,6 +66,9 @@ module.exports = class EditorConfigModal extends View
|
||||||
updateBehaviors: ->
|
updateBehaviors: ->
|
||||||
@aceConfig.behaviors = @$el.find('#tome-behaviors').prop('checked')
|
@aceConfig.behaviors = @$el.find('#tome-behaviors').prop('checked')
|
||||||
|
|
||||||
|
updateLiveCompletion: ->
|
||||||
|
@aceConfig.liveCompletion = @$el.find('#tome-live-completion').prop('checked')
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
|
|
||||||
|
@ -75,6 +81,7 @@ module.exports = class EditorConfigModal extends View
|
||||||
@aceConfig.keyBindings = @$el.find('#tome-key-bindings').val()
|
@aceConfig.keyBindings = @$el.find('#tome-key-bindings').val()
|
||||||
@aceConfig.indentGuides = @$el.find('#tome-indent-guides').prop('checked')
|
@aceConfig.indentGuides = @$el.find('#tome-indent-guides').prop('checked')
|
||||||
@aceConfig.behaviors = @$el.find('#tome-behaviors').prop('checked')
|
@aceConfig.behaviors = @$el.find('#tome-behaviors').prop('checked')
|
||||||
|
@aceConfig.liveCompletion = @$el.find('#tome-live-completion').prop('checked')
|
||||||
me.set 'aceConfig', @aceConfig
|
me.set 'aceConfig', @aceConfig
|
||||||
Backbone.Mediator.publish 'tome:change-config'
|
Backbone.Mediator.publish 'tome:change-config'
|
||||||
Backbone.Mediator.publish 'tome:change-language', language: newLanguage unless newLanguage is oldLanguage
|
Backbone.Mediator.publish 'tome:change-language', language: newLanguage unless newLanguage is oldLanguage
|
||||||
|
|
|
@ -95,9 +95,10 @@ module.exports = class SpellView extends View
|
||||||
@toggleControls null, @writable
|
@toggleControls null, @writable
|
||||||
@aceSession.selection.on 'changeCursor', @onCursorActivity
|
@aceSession.selection.on 'changeCursor', @onCursorActivity
|
||||||
$(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick
|
$(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick
|
||||||
@zatanna = new Zatanna @ace
|
@zatanna = new Zatanna @ace,
|
||||||
# @addZatannaSnippets()
|
liveCompletion: aceConfig.liveCompletion ? false
|
||||||
# window.aceEditor = @ace
|
completers:
|
||||||
|
keywords: false
|
||||||
|
|
||||||
createACEShortcuts: ->
|
createACEShortcuts: ->
|
||||||
@aceCommands = aceCommands = []
|
@aceCommands = aceCommands = []
|
||||||
|
@ -643,10 +644,12 @@ module.exports = class SpellView extends View
|
||||||
@ace.setDisplayIndentGuides aceConfig.indentGuides # default false
|
@ace.setDisplayIndentGuides aceConfig.indentGuides # default false
|
||||||
@ace.setShowInvisibles aceConfig.invisibles # default false
|
@ace.setShowInvisibles aceConfig.invisibles # default false
|
||||||
@ace.setKeyboardHandler @keyBindings[aceConfig.keyBindings ? 'default']
|
@ace.setKeyboardHandler @keyBindings[aceConfig.keyBindings ? 'default']
|
||||||
|
@zatanna.set 'liveCompletion', (aceConfig.liveCompletion ? false)
|
||||||
|
|
||||||
onChangeLanguage: (e) ->
|
onChangeLanguage: (e) ->
|
||||||
if @spell.canWrite()
|
if @spell.canWrite()
|
||||||
@aceSession.setMode @editModes[e.language]
|
@aceSession.setMode @editModes[e.language]
|
||||||
|
@zatanna.set 'language', @editModes[e.language].substr('ace/mode/')
|
||||||
|
|
||||||
dismiss: ->
|
dismiss: ->
|
||||||
@spell.hasChangedSignificantly @getSource(), null, (hasChanged) =>
|
@spell.hasChangedSignificantly @getSource(), null, (hasChanged) =>
|
||||||
|
|
Loading…
Reference in a new issue