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

@@ -142,10 +142,10 @@ export class PluginManager {
this._pythonPlugins.push(plugin);
}
configure(config: AppConfig) {
async configure(config: AppConfig) {
for (const p of this._plugins) p.configure?.(config);
for (const p of this._pythonPlugins) p.configure?.(config);
for (const p of this._pythonPlugins) await p.configure?.(config);
}
beforeLaunch(config: AppConfig) {
@@ -158,7 +158,7 @@ export class PluginManager {
}
}
afterSetup(interpreter: InterpreterClient) {
async afterSetup(interpreter: InterpreterClient) {
for (const p of this._plugins) {
try {
p.afterSetup?.(interpreter);
@@ -167,43 +167,63 @@ export class PluginManager {
}
}
for (const p of this._pythonPlugins) p.afterSetup?.(interpreter);
for (const p of this._pythonPlugins) await p.afterSetup?.(interpreter);
}
afterStartup(interpreter: InterpreterClient) {
async afterStartup(interpreter: InterpreterClient) {
for (const p of this._plugins) p.afterStartup?.(interpreter);
for (const p of this._pythonPlugins) p.afterStartup?.(interpreter);
for (const p of this._pythonPlugins) await p.afterStartup?.(interpreter);
}
beforePyScriptExec(options: { interpreter: InterpreterClient; src: string; pyScriptTag: PyScriptTag }) {
async beforePyScriptExec(options: { interpreter: InterpreterClient; src: string; pyScriptTag: PyScriptTag }) {
for (const p of this._plugins) p.beforePyScriptExec?.(options);
for (const p of this._pythonPlugins) p.beforePyScriptExec?.callKwargs(options);
for (const p of this._pythonPlugins)
await p.beforePyScriptExec(options.interpreter, options.src, options.pyScriptTag);
}
afterPyScriptExec(options: { interpreter: InterpreterClient; src: string; pyScriptTag: PyScriptTag; result: any }) {
async afterPyScriptExec(options: {
interpreter: InterpreterClient;
src: string;
pyScriptTag: PyScriptTag;
result: any;
}) {
for (const p of this._plugins) p.afterPyScriptExec?.(options);
for (const p of this._pythonPlugins) p.afterPyScriptExec?.callKwargs(options);
for (const p of this._pythonPlugins)
await p.afterPyScriptExec(options.interpreter, options.src, options.pyScriptTag, options.result);
}
beforePyReplExec(options: { interpreter: InterpreterClient; src: string; outEl: HTMLElement; pyReplTag: any }) {
async beforePyReplExec(options: {
interpreter: InterpreterClient;
src: string;
outEl: HTMLElement;
pyReplTag: any;
}) {
for (const p of this._plugins) p.beforePyReplExec?.(options);
for (const p of this._pythonPlugins) p.beforePyReplExec?.callKwargs(options);
for (const p of this._pythonPlugins)
await p.beforePyReplExec?.(options.interpreter, options.src, options.outEl, options.pyReplTag);
}
afterPyReplExec(options: { interpreter: InterpreterClient; src: string; outEl; pyReplTag; result }) {
async afterPyReplExec(options: { interpreter: InterpreterClient; src: string; outEl; pyReplTag; result }) {
for (const p of this._plugins) p.afterPyReplExec?.(options);
for (const p of this._pythonPlugins) p.afterPyReplExec?.callKwargs(options);
for (const p of this._pythonPlugins)
await p.afterPyReplExec?.(
options.interpreter,
options.src,
options.outEl,
options.pyReplTag,
options.result,
);
}
onUserError(error: UserError) {
async onUserError(error: UserError) {
for (const p of this._plugins) p.onUserError?.(error);
for (const p of this._pythonPlugins) p.onUserError?.(error);
for (const p of this._pythonPlugins) await p.onUserError?.(error);
}
}