Skip to content

RFC: write server in ocaml #269

Open

Description

@amiralies

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.

Activity

  1. cristianoc commented on Jun 8, 2021

    @cristianoc
    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.

  2. added
    enhancement
    on Jun 8, 2021
  3. fhammerschmidt commented on Jun 8, 2021

    @fhammerschmidt
    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.

  4. cristianoc commented on Jun 8, 2021

    @cristianoc
    Collaborator

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

  5. amiralies commented on Jun 7, 2022

    @amiralies
    ContributorAuthor

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

  6. zth commented on Jun 7, 2022

    @zth
    Member

    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.

  7. nojaf commented on May 16, 2025

    @nojaf
    Contributor

    As mentioned in #1094, I toyed with this idea in https://github.com/nojaf/rescript/tree/lsp.
    It uses https://github.com/c-cube/linol, which is a nice starting point for the LSP.

    But yeah, tl;dr it is a lot of work of course.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions