Ahas: comm bridges and IPC

28 views
Skip to first unread message

Edward K. Ream

unread,
Oct 11, 2019, 9:39:52 AM10/11/19
to leo-editor
shutil.which is one of those "small" tools that has a big impact re inter-process communication, IPC.

- The @adoc and @pandoc commands already use "which" to call the external asciidoctor and pandoc tools.

- The pyzo_in_leo plugin uses "which" to add the appropriate folder to sys.path.  As a result, Leo no longer needs to copy pyzo's sources!

But that's just a start.

Aha: client/server just means communication between separate processes.  Because we are using separate processes, we need some kind of text format, like JSON or MessagePack.

Robert Cholette has adapted the json protocols from leoflexx for his VS Code integration module.  Naturally, this is written in JS.  This JS "talks" to Leo's bridge.

Applications of these patterns

1. The pyzo_in_leo plugin (or a new plugin) could inject code into pyzo to enable a full two-way comm bridge between pyzo and Leo itself. This would eliminate the need use pyzo's docks in Leo!

The comm bridge could provide full access to all of Leo's commands, within pyzo.  It would also provide full access to all of pyzo's features, within Leo.

2. Similarly, a neovim plugin, written in python, running in neovim, could provide a full comm bridge between neovim and Leo.  Within neovim, Leo would appear to neovim plugin.  Within Leo, neovim would appear to be a Leo plugin.

3. Robert's VS code integration is a model for any JS integration, including the Jupyter notebook or Joe Orr's LeoVue project.  Both are tremendously exciting. Millions of scientists may be using Jupyter, while LeoVue greatly expands Leo's rendering capabilities.  It would be great to have Leo appear to be a Jupyter or LeoVue plugin.

Summary

It should be relatively straightforward to create two-way comm bridges between VS Code, neovim, LeoVue or Jupyter notebooks.  These comm bridge should appear to be symmetric. Each app regards the other app as one of its plugins.

The leointeg project leverages json-like data structure used in the leoflexx project.  This could provide a prototype for JS integration with LeoVue or Jupyter.

Pure python comm bridges could allow either vim or pyzo to integrate fully with Leo.

All questions and comments welcome.

Edward
Reply all
Reply to author
Forward
0 new messages