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

Support RPC through a socket. #387

Closed
jneem opened this issue Jun 28, 2021 · 5 comments
Closed

Support RPC through a socket. #387

jneem opened this issue Jun 28, 2021 · 5 comments
Labels
A-plugin Area: Plugin system C-enhancement Category: Improvements

Comments

@jneem
Copy link
Contributor

jneem commented Jun 28, 2021

vim (and neovim) allow you to send commands to the editor through a socket (see, e.g. the nvim docs). This is very useful for scripting. For example, the main thing I want it for right now is for synctex support

@jneem jneem added the C-enhancement Category: Improvements label Jun 28, 2021
@CBenoit CBenoit added the A-plugin Area: Plugin system label Jun 28, 2021
@CBenoit
Copy link
Member

CBenoit commented Jun 28, 2021

It's likely that we'll not use this approach for scripting, but a WASM plugins sytem instead.
If RPC is absolutely required for a specific use case, it may be provided by a RPC plugin. I'll actually add this on my list of things to try with the plugins system.

@jneem
Copy link
Contributor Author

jneem commented Jun 28, 2021

Sure, that makes sense. Just to be clear about the use case, the workflow is:

  1. I'm working on a tex file in the editor, and I compile it to a pdf.
  2. I open the pdf in a pdf viewer.
  3. I click (or Ctrl+click, or whatever) on a part of the pdf, and as a result I expect the editor to jump to that part of the file.

The mechanism that gvim uses to do step 3 is that I configure the tex compiler to include file/line information in the pdf, and then I configure my pdf viewer to run gvim --servername GVIM --remote +%{line} %{input} when clicked. Rather than opening a new editor, this command communicates (via a socket) with an existing instance of the editor and tells it to jump to some specified line. neovim does something similar, but with a rather richer msgpack API.

I don't think having WASM plugins solves this on its own, although I guess it should be possible to write a WASM plugin that listens on a socket, as long as the plugins aren't sandboxed too tightly. (A quick google suggests that sockets aren't yet supported in WASI, but maybe that will come...)

@CBenoit
Copy link
Member

CBenoit commented Jun 28, 2021

Thank you for the details. I actually really like this feature and hope to achieve it with Helix in a way or another. As you mentioned, it may be limited at first, but I'm not worried support for networking will greatly improve over time.
In the meantime we could even expose host functions for that. In fact, if WASI and networking is not a thing by the time I need it, I'll definitely try this.

@kirawi
Copy link
Member

kirawi commented Nov 6, 2021

Subsumed by #998

@petertheprocess
Copy link

After crawling all the related issues and discussions, I found out it seems the RPC solution is not planned to be supported.
However I really like and need this latex inverse-search use-case, is there any alternative solution to achieve that in 2024? @jneem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-plugin Area: Plugin system C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

4 participants