Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Sep 9, 2024
1 parent 46dbfa5 commit 3c7c21c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
Binary file modified public/zcl_excel_demo1.xlsx
Binary file not shown.
Binary file modified public/zcl_excel_demo2.xlsx
Binary file not shown.
43 changes: 37 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import "./index.css";
import "../public/favicon-16x16.png";
import "../public/favicon-32x32.png";
import * as monaco from "monaco-editor";
import {config, Transpiler} from "@abaplint/transpiler";
import {ABAP, MemoryConsole} from "@abaplint/runtime";
import {config, ITranspilerOptions, Transpiler, UnknownTypesEnum} from "@abaplint/transpiler";
// import {ABAP, MemoryConsole} from "@abaplint/runtime";
import * as abaplint from "@abaplint/core";
import * as abapMonaco from "@abaplint/monaco";
import Split from "split-grid";
Expand Down Expand Up @@ -111,9 +111,9 @@ const AsyncFunction = new Function(`return Object.getPrototypeOf(async function(
async function abapChanged() {
// @ts-ignore
console.dir(globalThis.abap);
const contents = editor1.getValue();

try {
const contents = editor1.getValue();
const file = new abaplint.MemoryFile(filename, contents);
reg.updateFile(file);
reg.parse();
Expand All @@ -124,6 +124,7 @@ async function abapChanged() {
document.getElementById("container2").innerHTML = `<iframe src="https://view.officeapps.live.com/op/view.aspx?src=https://abap2xlsx.github.io/abap2xlsx-web/${name}.xlsx" title="Excel"></iframe>`;

setTimeout(() => monaco.editor.getEditors()[0].focus(), 1000);
return;
} else {
const markers = monaco.editor.getModelMarkers({});
if (markers.length > 0) {
Expand All @@ -135,13 +136,43 @@ async function abapChanged() {
return;
}

document.getElementById("container2").innerHTML = `todo, compiling`;

// const res = await new Transpiler().runRaw([{filename, contents}]);
document.getElementById("container2").innerHTML = `<b>Compiling</b>`;
}
} catch (error) {
console.dir(error);
}

try {
/*
const raw = [];
for (const filename in abapfiles) {
if (filename.indexOf("zcl_excel_demo") === 0) {
continue;
}
raw.push({
filename: filename,
contents: abapfiles[filename],
})
if (filename === "cl_ixml.clas.locals_imp.abap") {
console.log(abapfiles[filename]);
}
}
*/
// console.dir(raw);
const options: ITranspilerOptions = {
"ignoreSyntaxCheck": false,
"addFilenames": true,
"addCommonJS": true,
"skipReposrc": true,
"unknownTypes": UnknownTypesEnum.runtimeError,
}
const res = await new Transpiler(options).run(reg);
console.dir("RESULT:");
console.dir(res);
} catch (error) {
document.getElementById("container2").innerHTML = `<u><b>Issues found during compilation</b></u><br>`;
document.getElementById("container2").innerHTML += error.toString();
}
}

editor1.onDidChangeModelContent(abapChanged);
Expand Down

0 comments on commit 3c7c21c

Please sign in to comment.