diff options
Diffstat (limited to 'js/prolog.js')
-rw-r--r-- | js/prolog.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/js/prolog.js b/js/prolog.js index 089f63e..a377cc9 100644 --- a/js/prolog.js +++ b/js/prolog.js @@ -353,6 +353,25 @@ }); $('#btn_code_hint').on('click', function () { // handler.processServerHints([{id:'drop_down', start: 20, end: 26, choices:['ena', 'dva', 'tri']}]); + jqConsole.echo('?- hint.'); + jqConsole.pause(); + var doc = editor.getDoc(); + codeq.comms.sendHint({ + 'program': editor.getDoc().getValue(), + 'problem_id': problem.id + }).then( + function hintSuccess(data) { + jqConsole.resume(); + if (data.code === 0) + handler.processServerHints(data.hints); + else + jqConsole.error(data.message); + }, + function hintFailed (error) { + jqConsole.resume(); + jqConsole.exception(error); + } + ).done(); }); $('#btn_code_test').on('click', function () { jqConsole.echo('?- test.'); @@ -376,7 +395,7 @@ jqConsole.error(data.message); } }, - tf = function testFailed (error) { + function testFailed (error) { jqConsole.resume(); jqConsole.exception(error); } |