Skip to content
Draft
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2512bb9
feat: build insight script
4e6 Dec 23, 2024
4477b4a
feat: initialize polyfill parser
4e6 Dec 25, 2024
31c97b9
DRAFT: insight parse tree
4e6 Dec 25, 2024
936bf45
feat: enso.dev.inspectPort
4e6 Dec 26, 2024
d9ce757
DRAFT: set widget metadata
4e6 Dec 27, 2024
50266f9
DRAFT: y-websocket
4e6 Dec 31, 2024
93ba1dc
DRAFT: debug websocket
4e6 Jan 1, 2025
7c889c6
Merge branch 'develop' into wip/db/11477-execute-yjs-insight
4e6 Mar 10, 2025
2932fac
update: after merge
4e6 Mar 10, 2025
8d17b9e
Combine previous value of ENSO_JVM_OPTS together WithDebugCommand.DEB…
JaroslavTulach Mar 13, 2025
814eb91
Re-try callback when JavaScript refuses to execute because of Multi t…
JaroslavTulach Mar 13, 2025
c8acbb2
Merging with latest develop
JaroslavTulach Mar 31, 2025
557bd00
Reverting unnecessary changes in ContextFactory
JaroslavTulach Mar 31, 2025
696d9e3
Use normal --inspect or DAP debugging
JaroslavTulach Mar 31, 2025
dc1a883
Merging with most recent develop
JaroslavTulach Apr 7, 2025
d0610ba
Merge remote-tracking branch 'origin/develop' into wip/db/11477-execu…
JaroslavTulach Apr 8, 2025
048bd5c
Merging with Share getThreadManager pool
JaroslavTulach Apr 11, 2025
d0d71be
Merging with most recent develop
JaroslavTulach May 7, 2025
31729b7
Merge remote-tracking branch 'origin/develop' into wip/db/11477-execu…
JaroslavTulach May 12, 2025
bce8380
Merging with origin/develop
JaroslavTulach May 12, 2025
ec78a92
Formatting import statements
JaroslavTulach May 12, 2025
2d91f12
Include requested URL in the failure message
JaroslavTulach May 12, 2025
dca720d
No need to change Zlib when allowBufferAccess is on
JaroslavTulach May 12, 2025
f383682
Updating to helidon 4.2.2
JaroslavTulach May 12, 2025
877b227
Removing outdated debug configuration
JaroslavTulach May 12, 2025
7df699c
Merge remote-tracking branch 'origin/develop' into wip/db/11477-execu…
JaroslavTulach May 16, 2025
e29bfc1
Merge remote-tracking branch 'origin/develop' into wip/db/11477-execu…
JaroslavTulach May 23, 2025
8e21525
Create zlib Buffer over ArrayBuffer view
JaroslavTulach May 23, 2025
1c7e750
WebSocketClient utility to check compatibility of the polyfill
JaroslavTulach May 24, 2025
6f0d885
Delay initialization of insight by ten seconds to not interfere with …
JaroslavTulach May 24, 2025
b10c9c7
Don't clean the session to avoid NPE and get more explainable exception
JaroslavTulach May 24, 2025
a44375a
Turn into interfactive shell
JaroslavTulach May 24, 2025
efda23a
Merging in #13159
JaroslavTulach May 26, 2025
1ed6d4d
Allow override (composition) of ENSO_JVM_OPTS env variable
JaroslavTulach May 27, 2025
e8c11ab
Use /home/devel/NetBeansProjects/enso/enso.ide to reference current w…
JaroslavTulach May 27, 2025
1ec18f1
Cannot stringify frame - the content may be too deep
JaroslavTulach May 27, 2025
b81b815
--jvm option takes argument in enso, but not in project-manager
JaroslavTulach May 27, 2025
c8e5342
Allow project-manager --jvm to have an argument
JaroslavTulach May 27, 2025
2be45bf
Unexpected exceptions like IllegalStateException should be reported. …
JaroslavTulach May 27, 2025
08c21ae
prepareFunctionCall may need Truffle context. Wrapping in submitExecu…
JaroslavTulach May 27, 2025
8a73292
Merge remote-tracking branch 'origin/develop' into wip/db/11477-execu…
JaroslavTulach May 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
* <pre>
* $ graalvm/bin/java
* -p enso-engine-*?/enso-*?/component/
* -m org.enso.ydoc.polyfill/org.enso.ydoc.polyfill.WebSocketClient
* -m org.enso.ydoc.polyfill/org.enso.ydoc.polyfill.WebSocketShell
* </pre>
*
* The {@code enso-engine-*?/enso-*?/component/} represents path to the @{code component} directory
* which needs to be adjusted to proper path on each operating system. All lines may need to be
* concatenated into a single line.
*/
final class WebSocketClient implements AutoCloseable {
final class WebSocketShell implements AutoCloseable {
private final Context ctx;
private final ScheduledExecutorService executor;

private WebSocketClient(boolean inspect) throws Exception {
private WebSocketShell(boolean inspect) throws Exception {
var access =
HostAccess.newBuilder(HostAccess.EXPLICIT).allowBufferAccess(true).allowArrayAccess(true);
var b = Context.newBuilder().allowExperimentalOptions(true).allowHostAccess(access.build());
Expand Down Expand Up @@ -71,6 +71,15 @@ final Future<Value> eval(File code) throws Exception {
return res;
}

final Future<Value> eval(String line) throws Exception {
var res =
executor.submit(
() -> {
return ctx.eval("js", line);
});
return res;
}

@Override
public void close() throws Exception {
executor.shutdown();
Expand Down Expand Up @@ -101,12 +110,20 @@ public static void main(String[] params) throws Exception {
System.exit(1);
}

try (var client = new WebSocketClient(inspect)) {
try (var client = new WebSocketShell(inspect)) {
var code = files.get(0);
var res = client.eval(code);
System.out.printf("Script %s evaluated to %s\nPress any key to stop...", code, res);
System.in.read();
System.out.println("Exiting");
System.out.printf("Script %s evaluated to %s\n", code, res);
var console = System.console();
for (int i = 0; i < 10; i++) {
var line = console.readLine("js> ");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This console.readLine seems to work surprisingly well. It supports arrow movements and even provides history of previous entries. Isn't it time to replace JLine with it? Isn't the console actually backed by JLine (repackaged)?

if (line == null) {
break;
}
res = client.eval(line);
System.out.println(res.get());
}
System.out.printf("Exiting with %s", res);
}
}
}
Loading