Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute yjs from insight script #11965

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Jan 2, 2025

Pull Request Description

Allow populating Yjs metadata with values provided by the insight script.

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

@4e6 4e6 self-assigned this Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

🧪 Storybook is successfully deployed!

📊 Dashboard:

@4e6
Copy link
Contributor Author

4e6 commented Jan 2, 2025

That's working:

  • parse the module contents into AST
  • attach node values provided by the insight as an AST metadata

What's in progress:

  • synchronize module AST with the ydoc-server. There is an issue with a WebSocket connection that may be caused by the context (mis)configuration

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

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

Thanks Dmitry for finding a way to convert insight offsets to ASTs!

const result = ctx.returnValue(frame)
if (result && spanMap) {
const key = Ast.nodeKey(ctx.charIndex, ctx.charEndIndex - ctx.charIndex)
const asts = spanMap.nodes.get(key)
Copy link
Member

Choose a reason for hiding this comment

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

I see. Whenever we get an insight.on('return', ...) event, we look appropriate asts and update them. I am not sure how fast this is, but it certainly seems good enough for demonstration purposes.

}
}, {
expressions: true,
statements: false,
Copy link
Member

Choose a reason for hiding this comment

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

I believe n = 42 would be a statement - e.g. if you want to observe when "IDE nodes" are being assigned to, you may want to observe statements.

@@ -316,6 +316,11 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) {
RuntimeOptions.JOB_PARALLELISM,
Runtime.getRuntime.availableProcessors().toString
)
if (System.getProperty("enso.dev.inspectPort") != null) {
val inspectPort = Integer.getInteger("enso.dev.inspectPort", 34567);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is necessary. Just use regular enso --inspect:

    --inspect                              Start the Chrome inspector when
                                           --run is used.

but yeah, I am not sure if it works in "language server" mode. I'd rather got it working then designing new enso.dev.inspectPort property.

@@ -252,7 +254,7 @@ public Context build() {
}

private static HostAccess allWithTypeMapping() {
return HostAccess.newBuilder()
return HostAccess.newBuilder(HostAccess.EXPLICIT)
Copy link
Member

Choose a reason for hiding this comment

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

Starting with EXPLICIT and then allowing allPublicAccess is strange. Doesn't it create HostAccess.PUBLIC?

@@ -165,6 +166,7 @@ public Context build() {
Context.newBuilder()
.allowExperimentalOptions(true)
.allowAllAccess(true)
.allowIO(IOAccess.ALL)
Copy link
Member

Choose a reason for hiding this comment

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

What is this good for? I don't think our JavaScript is performing any I/O by itself! The JavaScript code calls into the ydoc-polyfill Java classes and only then the Java classes do some I/O - we shouldn't need a GraalVM permission for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants