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

RFC: write server in ocaml #269

Open
amiralies opened this issue Jun 7, 2021 · 6 comments
Open

RFC: write server in ocaml #269

amiralies opened this issue Jun 7, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@amiralies
Copy link
Contributor

as more features being introduced in server the communication get's trickier (syncing types / deciding where some specific logic should live / avoid logic duplication). it might be good to think about writing the server in ocaml.

@cristianoc
Copy link
Collaborator

Another major advantage is ease of integration with editors beside vscode.
A good point in time for this could be when the feature set stabilises.

@cristianoc cristianoc added the enhancement New feature or request label Jun 8, 2021
@fhammerschmidt
Copy link
Member

OCaml as in OCaml syntax with ReScript, or OCaml with js_of_ocaml like vscode-ocaml-platform?

To me, it would have been way harder to contribute. I think most people who learned ReScript are also familiar with TypeScript. I would prefer to have the server in ReScript. Sharing types should still be possible.

But I also don't understand how the LSP-part is easier to integrate with other editors when it is not written in JS. If you think about moving as much logic as possible into the analysis binary or even another binary that gets called by a very lean server.ts, that may be valid, though.

@cristianoc
Copy link
Collaborator

We are talking about producing a binary, vs a bunch of .ts plus binary.

@amiralies
Copy link
Contributor Author

Should we do this?
iirc ocaml-lsp provides a lsp spec implemntation, I think we can use that.

@zth
Copy link
Collaborator

zth commented Jun 7, 2022

My 5c is we should wait with this (and the related issue about rewriting the client in ReScript). My impression is that while migrating it to OCaml is a good long term goal, right now we should be prioritizing building crucial features, and onboarding new contributors. I think that's going to be easier to do in the current setup, at least for the foreseeable future.

Put in another way - it's not super large, but there's a fair bit of code in the server, and porting it + ensuring it all works as intended is probably going to be a significant undertaking. I don't think we can afford that undertaking (including all the risks of a rewrite getting stale etc) right now, before we have a large and sustainable contributor pool.

@aspeddro
Copy link
Contributor

aspeddro commented Nov 30, 2022

Related to this topic.

The server side contains a lot of ts code. What I think can be moved to analysis and reduce transaction cost for the future:

  • Open Compiled JS File
  • Create Interface

If we move all logic to ocaml we can:

  • Eliminate server/src/{lookup.ts,buildSchema.ts}
  • Reduce server/src/{server.ts,utils.ts}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants