Merge pull request #820 from ethereum/basicAutocompletion

Basic autocompletion
pull/1/head
yann300 7 years ago committed by GitHub
commit 6e75b94bff
  1. 14
      src/app/editor/editor.js
  2. 8
      test-browser/helpers/applytestmode.js

@ -5,6 +5,8 @@ var yo = require('yo-yo')
var csjs = require('csjs-inject')
var ace = require('brace')
var Range = ace.acequire('ace/range').Range
require('brace/ext/language_tools')
var langTools = ace.acequire('ace/ext/language_tools')
require('./mode-solidity.js')
var css = csjs`
@ -26,6 +28,18 @@ function Editor (opts = {}) {
var self = this
var el = yo`<div id="input"></div>`
var editor = ace.edit(el)
ace.acequire('ace/ext/language_tools')
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
})
var flowCompleter = {
getCompletions: function (editor, session, pos, prefix, callback) {
// @TODO add here other propositions
}
}
langTools.addCompleter(flowCompleter)
el.className += ' ' + css['ace-editor']
el.editor = editor // required to access the editor during tests
self.render = function () { return el }

@ -3,5 +3,11 @@
*
*/
console.log('applying test mode')
document.getElementById('input').editor.setBehavioursEnabled(false) // disable bracket auto-match (i.e. automatic injection of closing brackets and other things), so we can enter raw source code.
var editor = document.getElementById('input').editor
editor.setBehavioursEnabled(false) // disable bracket auto-match (i.e. automatic injection of closing brackets and other things), so we can enter raw source code.
editor.setOptions({
enableBasicAutocompletion: false,
enableSnippets: false,
enableLiveAutocompletion: false
})
console.log('test mode applied')

Loading…
Cancel
Save