Commit c3da8848 authored by Andrew Gibiansky's avatar Andrew Gibiansky

now actually works

parent 670ccde9
......@@ -7,6 +7,8 @@ if (initialized && window.parsecWidgetRegistered === undefined) {
// Do not load this script again.
window.parsecWidgetRegistered = true;
var parsecWidgetCounter = 0;
// Register the comm target.
var ParsecWidget = function (comm) {
this.comm = comm;
......@@ -47,6 +49,10 @@ var ParsecWidget = function (comm) {
var out = this.cell.output_area.element;
this.textarea = out.find("#parsec-editor")[0];
this.output = out.find("#parsec-output")[0];
// Give the elements a different name.
this.textarea.id += parsecWidgetCounter;
this.output.id += parsecWidgetCounter;
parsecWidgetCounter++;
var editor = CodeMirror.fromTextArea(this.textarea, options);
var editor = editor;
......@@ -61,14 +67,13 @@ var ParsecWidget = function (comm) {
ParsecWidget.prototype.handler = function(msg) {
var data = msg.content.data;
this.hasError = data["status"] == "error";
console.log('handler', msg);
if (this.hasError) {
out = data["msg"];
this.output.innerHTML = data["msg"];
this.error = data;
} else {
out = data["result"];
this.output.innerHTML = data["result"];
}
// Update viewed output.
this.output.innerHTML = out;
};
// Register this widget.
......
......@@ -3,7 +3,7 @@
"celltoolbar": "Hiding",
"language": "haskell",
"name": "",
"signature": "sha256:444705f910fcdf32804f8966333f9306a779ea3b3a6123eff79873d78e4c6f56"
"signature": "sha256:804b433cf50ca6157f3f59dbddeffdb20dda07eee3e4701830f71f5eee0fbfd3"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -36,16 +36,22 @@
"cell_type": "code",
"collapsed": false,
"input": [
"Slider"
"1+1"
],
"language": "python",
"metadata": {},
"metadata": {
"hidden": false
},
"outputs": [
{
"metadata": {},
"output_type": "display_data"
"output_type": "display_data",
"text": [
"2"
]
}
]
],
"prompt_number": 1
},
{
"cell_type": "code",
......@@ -104,6 +110,8 @@
"// Do not load this script again.\n",
"window.parsecWidgetRegistered = true;\n",
"\n",
"var parsecWidgetCounter = 0;\n",
"\n",
"// Register the comm target.\n",
"var ParsecWidget = function (comm) {\n",
" this.comm = comm;\n",
......@@ -144,6 +152,10 @@
" var out = this.cell.output_area.element;\n",
" this.textarea = out.find(\"#parsec-editor\")[0];\n",
" this.output = out.find(\"#parsec-output\")[0];\n",
" // Give the elements a different name.\n",
" this.textarea.id += parsecWidgetCounter;\n",
" this.output.id += parsecWidgetCounter;\n",
" parsecWidgetCounter++;\n",
"\n",
" var editor = CodeMirror.fromTextArea(this.textarea, options);\n",
" var editor = editor;\n",
......@@ -158,14 +170,13 @@
"ParsecWidget.prototype.handler = function(msg) {\n",
" var data = msg.content.data;\n",
" this.hasError = data[\"status\"] == \"error\";\n",
" console.log('handler', msg);\n",
" if (this.hasError) {\n",
" out = data[\"msg\"];\n",
" this.output.innerHTML = data[\"msg\"];\n",
" this.error = data;\n",
" } else {\n",
" out = data[\"result\"];\n",
" this.output.innerHTML = data[\"result\"];\n",
" }\n",
" // Update viewed output.\n",
" this.output.innerHTML = out;\n",
"};\n",
"\n",
"// Register this widget.\n",
......
......@@ -56,14 +56,14 @@ lintIdent = "lintIdentAEjlkQeh"
lint :: [Located CodeBlock] -> IO Display
lint blocks = do
-- Initialize hlint settings
initialized <- isEmptyMVar hlintSettings
when (not initialized) $ autoSettings >>= putMVar hlintSettings
initialized <- not <$> isEmptyMVar hlintSettings
when (not initialized) $ do
autoSettings >>= putMVar hlintSettings
-- Get hlint settings
(flags, classify, hint) <- readMVar hlintSettings
let mode = hseFlags flags
-- create 'suggestions'
let modules = mapMaybe (createModule mode) blocks
ideas = applyHints classify hint modules
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment