From 0b1be7f308dfff5744de28c1fc7d6134b0936e70 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 26 Sep 2017 13:05:53 +0200 Subject: [PATCH 1/2] basic autocomplete --- src/app/editor/editor.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app/editor/editor.js b/src/app/editor/editor.js index b3950854d0..c196940c5e 100644 --- a/src/app/editor/editor.js +++ b/src/app/editor/editor.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`
` 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 } From 40893f769fe3225b0c4595865df649d60896212b Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 26 Sep 2017 15:22:58 +0200 Subject: [PATCH 2/2] fix test --- test-browser/helpers/applytestmode.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test-browser/helpers/applytestmode.js b/test-browser/helpers/applytestmode.js index 89366fd7d5..c97c4b7ce1 100644 --- a/test-browser/helpers/applytestmode.js +++ b/test-browser/helpers/applytestmode.js @@ -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')