Skip to content

Publish LSP to npm #734

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

Merged
merged 21 commits into from
Oct 8, 2023
Merged

Publish LSP to npm #734

merged 21 commits into from
Oct 8, 2023

Conversation

aspeddro
Copy link
Contributor

@aspeddro aspeddro commented Feb 17, 2023

  • Publish a binary to npm as rescriptls. Support two channels stdio and node-ipc
  • VSCode client keeps using node-ipc channel

Related #354

@zth
Copy link
Collaborator

zth commented Feb 17, 2023

Great stuff!

One thing I'd like to mull over a bit before going this route is that there might be a separate case for publishing just the analysis binary to npm, by itself. That would be because the analysis binary might in the future contain more general tooling, not just stuff for powering the LSP. Doc extraction is one example where it's possible that's the easiest way of distributing it.

This package will have the analysis bin too of course. So maybe there's a way to name this (and expose the analysis bin separately) so that they can be exposed via the same package, without it being fantastically confusing.. Let me think a bit. Any feedback welcome.

@cristianoc
Copy link
Collaborator

cristianoc commented Feb 17, 2023

Perhaps only expose the part of the analysis binary which is for public consumption. Without even leaking the existence of the binary (helps keeping freedom to move stuff between binary and ts).

@aspeddro
Copy link
Contributor Author

If I understand correctly, as reported by users the main problem is that we don't publish an LSP like OCaml does to facilitate the setup in several editors. Just publishing the analysis binary does not resolve the reported issue.

yes accessing lsp server and related binaries each time when changing machine that doesn't have it mean setting up $PATH or changing editor configuration file (in this case Helix) over again. npm package definitely help.
Comment

One idea is to do what rust-analyzer does. We publish a single binary with subcommands.

  • rescript-toolchain lsp [args] - Start LSP
  • rescript-toolchain analysis [args] - Call OCaml analysis binary commands

@aspeddro
Copy link
Contributor Author

aspeddro commented Oct 8, 2023

Ready for review.

@aspeddro aspeddro changed the title [PoC]: Publish LSP to npm Publish LSP to npm Oct 8, 2023
@aspeddro aspeddro marked this pull request as ready for review October 8, 2023 05:24
@aspeddro
Copy link
Contributor Author

aspeddro commented Oct 8, 2023

The first version should be 0.1.0 or 1.20?

@zth zth requested review from zth and cristianoc October 8, 2023 09:24
Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

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

Awesome! I think 1.20.0 for the version is right, it's nice to have the same as the actual extension.

Fantastic to get this out.

@zth zth merged commit 28e1957 into rescript-lang:master Oct 8, 2023
@aspeddro aspeddro deleted the publish-npm branch October 12, 2023 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants