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

Start Ydoc with the language server #9862

Open
wants to merge 66 commits into
base: develop
Choose a base branch
from
Open

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented May 3, 2024

Pull Request Description

Changelog:

  • update: Ydoc starts with the language server on the localhost:1234 by default. The hostname and ports can be configured by setting environment variables LANGUAGE_SERVER_YDOC_HOSTNAME and LANGUAGE_SERVER_YDOC_PORT
  • update: by default npm dev run uses the node Ydoc server. You can control it with POLYGLOT_YDOC_SERVER env variable. For example,
    env POLYGLOT_YDOC_SERVER='true' npm --workspace=enso-gui2 run dev
    
    To connect to the Ydoc server running on the 1234 port (the one started with the language server)
    env POLYGLOT_YDOC_SERVER='ws://127.0.0.1:1235' npm --workspace=enso-gui2 run dev
    
    To connect to the provided URL. Can be useful for debugging when you start a separate Ydoc process.
  • update: run npm install before the engine build. It is required to create the Ydoc JS bundle.

Important Notes

Checklist

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

  • The documentation has been updated, if necessary.
  • 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.

@4e6 4e6 added the CI: No changelog needed Do not require a changelog entry for this PR. label May 3, 2024
@4e6 4e6 self-assigned this May 3, 2024
@4e6 4e6 force-pushed the wip/db/ydoc-language-server branch 2 times, most recently from 4acf4d6 to 22488da Compare May 10, 2024 13:28
build.sbt Outdated Show resolved Hide resolved
build.sbt Show resolved Hide resolved
Comment on lines +9 to +13
// ydoc-server
requires io.helidon.webclient;
requires io.helidon.webclient.websocket;
requires io.helidon.webserver;
requires io.helidon.webserver.websocket;
Copy link
Member

Choose a reason for hiding this comment

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

Good solution for now, if everything works with that. But at the end, we must ensure that runtime.jar does not require helidon modules. Let's keep that in mind and create a separate ticket for that before merging.

@@ -13,9 +13,9 @@ public class ClassLoaderConstants {
* consistent.
*/
public static final List<String> CLASS_DELEGATION_PATTERNS =
List.of("org.graalvm", "java", "org.slf4j", "ch.qos");
List.of("org.graalvm", "java", "org.slf4j", "ch.qos", "io.helidon");
Copy link
Member

Choose a reason for hiding this comment

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

Good. This ensures that our boot class loader deleagates loading of all io.helidon.* classes to the system class loader, which picks the classes from JARs inside the component directory.

@4e6 4e6 force-pushed the wip/db/ydoc-language-server branch from 5958a94 to d77d8a5 Compare May 13, 2024 15:59
@4e6 4e6 added CI: Clean build required CI runners will be cleaned before and after this PR is built. and removed CI: Clean build required CI runners will be cleaned before and after this PR is built. labels May 13, 2024
@4e6 4e6 force-pushed the wip/db/ydoc-language-server branch from d0f2108 to 8a16bf9 Compare May 17, 2024 06:16
app/gui2/src/stores/project/index.ts Outdated Show resolved Hide resolved
@@ -63,7 +59,7 @@ export default defineConfig({
...getDefines(localServerPort),
IS_CLOUD_BUILD: JSON.stringify(IS_CLOUD_BUILD),
PROJECT_MANAGER_URL: JSON.stringify(projectManagerUrl),
YDOC_SERVER_URL: IS_POLYGLOT_YDOC_SERVER ? JSON.stringify('defined') : undefined,
YDOC_SERVER_URL: JSON.stringify(POLYGLOT_YDOC_SERVER),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this change is one of the causes for such a weird config check. The undefined value should not be stringified here.

Suggested change
YDOC_SERVER_URL: JSON.stringify(POLYGLOT_YDOC_SERVER),
YDOC_SERVER_URL: POLYGLOT_YDOC_SERVER ? JSON.stringify(POLYGLOT_YDOC_SERVER) : undefined,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

JSON.stringify(undefined) === undefined anyway. I was using this special 'undefined' string because the config only allows having string values. I refactored the logic

if (jsonAddress == null) {
toastAndLog('noJSONEndpointError')
} else if (binaryAddress == null) {
toastAndLog('noBinaryEndpointError')
} else {
let ydocAddress: string
if (ydocUrl == null) {
ydocAddress = 'undefined'
Copy link
Contributor

Choose a reason for hiding this comment

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

Again unexpected stringified undefined that I'd like to get rid of.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This special value can be confusing, I agree. I refactored the ydocUrl logic

@JaroslavTulach JaroslavTulach self-requested a review May 21, 2024 13:32
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.

It is great to see this to be green. Let's integrate and let's unblock the cloud integration.

@somebody1234
Copy link
Collaborator

hey, just wondering - what's the roadmap for this stuff? will this be theoretically ready for integration with Cloud after this PR? or are there more steps that are needed?

@somebody1234 somebody1234 requested a review from Frizi May 23, 2024 10:59
@4e6
Copy link
Contributor Author

4e6 commented May 23, 2024

This should be enough to start integration in the cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants