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

Export custom comm message types and structure in Positron API #265

Open
jmcphers opened this issue Mar 10, 2023 · 4 comments
Open

Export custom comm message types and structure in Positron API #265

jmcphers opened this issue Mar 10, 2023 · 4 comments
Labels
area: core Issues related to Core category.

Comments

@jmcphers
Copy link
Collaborator

jmcphers commented Mar 10, 2023

Positron contains a number of custom communication channels, each of which defines its own protocol for frontend/backend communication. These generally represent UI elements, such as the Environment pane, a plot, a data viewer instance, etc.

For example, Environment pane exchanges messages with its back-end counterpart using strongly typed data structures, which currently live here:

https://github.com/rstudio/positron/blob/main/src/vs/workbench/services/languageRuntime/common/languageRuntimeEnvironmentClient.ts

While this is an appropriate source of truth for the data structures while they are evolving rapidly, at some point we need to define the protocol for each comm such that third parties can implement their own backends for these UI elements. That probably means that they need to be represented in positron.d.ts in some way.

@jmcphers jmcphers changed the title Export Environment message types and structure in public API Export custom comm message types and structure in Positron API Jun 8, 2023
@jmcphers jmcphers added this to the Public Beta milestone Jun 8, 2023
@jmcphers
Copy link
Collaborator Author

We currently have some infrastructure that does code (and type) generation for Positron global events (see events.yaml), but it isn't used much since, unlike RStudio, Positron's client/server communication is typically scoped into comm channels of the kind we're talking about here.

As we've added and refined comms over the last couple of months, enough patterns have emerged that I think we could codify them effectively in YAML. Each comm has:

  • an ID
  • a set of events that carry data payloads (almost identical to the Positron global event list)
  • a set of RPCs that are like events but have a send type as well as a return type

From the YAML we could generate the typings in positron.d.ts as well as boilerplate client code, and possibly also Rust types in amalthea.

@seeM
Copy link
Contributor

seeM commented Oct 18, 2023

We could probably do this for Python pydantic models too. I started on that in #865 but decided to close it until we formalized our comms a bit more

@lionel-
Copy link
Contributor

lionel- commented Dec 22, 2023

#1942 laid out the ground work for this formalisation.

@wesm wesm added the area: core Issues related to Core category. label Feb 29, 2024
wesm pushed a commit that referenced this issue Mar 28, 2024
Merge pull request #265 from posit-dev/prefer-namespace-completions

Prefer namespace completions
--------------------
Commit message for posit-dev/positron-python@8359792:

test that namespace completions are preferred

--------------------
Commit message for posit-dev/positron-python@1d3855a:

prefer completions using the user's namespace over static analysis

Relates to #601.


Authored-by: Wasim Lorgat <[email protected]>
Signed-off-by: Wasim Lorgat <[email protected]>
wesm pushed a commit that referenced this issue Mar 28, 2024
Merge pull request #265 from posit-dev/prefer-namespace-completions

Prefer namespace completions
--------------------
Commit message for posit-dev/positron-python@8359792:

test that namespace completions are preferred

--------------------
Commit message for posit-dev/positron-python@1d3855a:

prefer completions using the user's namespace over static analysis

Relates to #601.


Authored-by: Wasim Lorgat <[email protected]>
Signed-off-by: Wasim Lorgat <[email protected]>
@jmcphers
Copy link
Collaborator Author

One way to do this would be to factor the implementation of the comms so that the actual RPCs are not part of the Positron API, and only the API surface is. This approach is detailed in #4997.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to Core category.
Projects
None yet
Development

No branches or pull requests

5 participants