Skip to content

Commit

Permalink
Run code before debugging (#163)
Browse files Browse the repository at this point in the history
* Run code before debugging

* when you forget to check that you can still run code
  • Loading branch information
rahularya50 authored and kavigupta committed Nov 14, 2019
1 parent 8cc6bd6 commit f854bc3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions editor/static/scripts/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,21 @@ function register(layout) {
}
});

container.getElement().find(".run-btn").on("click", run);
container.getElement().find(".run-btn").on("click", () => run());

container.getElement().find(".save-btn").on("click", () => save());

container.getElement().find(".reformat-btn").on("click", reformat);

container.getElement().find(".sub-btn").on("click", async function () {
await save();
await run(true);
open("substitution_tree", componentState.id);
});

container.getElement().find(".env-btn").on("click", async function () {
await save();
await run(true);
open("env_diagram", componentState.id);
});

Expand Down Expand Up @@ -235,7 +237,7 @@ function register(layout) {
})
}

async function run() {
async function run(noOutput) {
let code = [editor.getValue()];

async function run_done(data) {
Expand Down Expand Up @@ -263,9 +265,11 @@ function register(layout) {

await save(true);

open("output", componentState.id);
if (data.graphics_open) {
open("turtle_graphics", componentState.id);
if (!noOutput) {
open("output", componentState.id);
if (data.graphics_open) {
open("turtle_graphics", componentState.id);
}
}
// noinspection JSIgnoredPromiseFromCall
saveState(true);
Expand Down Expand Up @@ -316,4 +320,4 @@ function register(layout) {
terminable_command("test cases", ajax, done_fn);
}
});
}
}

0 comments on commit f854bc3

Please sign in to comment.