synclink integration (#1258)

synclink integration + fixes for `py-repl` related tests and `display` tests
This commit is contained in:
Madhur Tandon
2023-03-27 20:56:31 +05:30
committed by GitHub
parent 88f0738500
commit c8f9f16791
35 changed files with 555 additions and 230 deletions

View File

@@ -47,7 +47,7 @@ export class ImportmapPlugin extends Plugin {
}
logger.info('Registering JS module', name);
interpreter._remote.registerJsModule(name, exports);
await interpreter._remote.registerJsModule(name, exports);
}
}
}

View File

@@ -16,7 +16,7 @@ class MyPlugin(Plugin):
console.log(f"configuration received: {config}")
def afterStartup(self, interpreter):
console.log(f"interpreter received: {interpreter}")
console.log("interpreter received:", interpreter)
plugin = MyPlugin("py-markdown")

View File

@@ -94,13 +94,13 @@ export class StdioDirector extends Plugin {
}
}
afterPyReplExec(options: {
async afterPyReplExec(options: {
interpreter: InterpreterClient;
src: string;
outEl: HTMLElement;
pyReplTag: InstanceType<ReturnType<typeof make_PyRepl>>;
result: any; // eslint-disable-line @typescript-eslint/no-explicit-any
}): void {
}): Promise<void> {
// display the value of the last-evaluated expression in the REPL
if (options.result !== undefined) {
const outputId: string | undefined = options.pyReplTag.getAttribute('output');
@@ -108,14 +108,14 @@ export class StdioDirector extends Plugin {
// 'output' attribute also used as location to send
// result of REPL
if (document.getElementById(outputId)) {
pyDisplay(options.interpreter, options.result, { target: outputId });
await pyDisplay(options.interpreter, options.result, { target: outputId });
} else {
//no matching element on page
createSingularWarning(`output = "${outputId}" does not match the id of any element on the page.`);
}
} else {
// 'otuput atribuite not provided
pyDisplay(options.interpreter, options.result, { target: options.outEl.id });
await pyDisplay(options.interpreter, options.result, { target: options.outEl.id });
}
}