VS Code Jupyter percentage syntax rust-analyzer

I am wondering if there are plans to support the percentage syntax when working with the VS Code rust analyzer ext. It's quite useful to use evcxr kernel to troubleshoot and plot stuff, but the ipynb format is a bit tough to collaborate on and very unportable.

Supporting the percentage format (Notebook formats — Jupytext documentation) gives the ability to both easily use the LSP on the file hopefully, build and compile as a standalone binary quite easily, etc.

I believe this is purely a client implementation (ie allow .rs files having the %% sign to be interpreted by the IDE as notebooks). Maybe someone can point me to a workaround / hack as this functionality already exists in the python extension so maybe a new file extension can be defined and mapped to this "file type" ?

Are you trying to use Rust code inside a Jupyter server? So something like this:

// %%
// This is a code cell

Some uncommented Rust code here

// %%
// This is the next code cell

More uncommented Rust code

Code then gets sent to Jupyter server to be run, and gets displayed in a VS Code window.

Yes correct, many IDEs support that format and it feels a lot more natural especially in a compiled language setting. Also it's trivial to copy paste the whole block into a package's main and it just works, it can be integrated into CI flows and roll out production code from a "notebook" very easily as opposed to the canonical jupyter format.

You can have a look at the Python extension for VS Code and see how the code cell functionality might be ported to Rust Analyzer. Apparently questions should go to Stack Overflow (see link below) if you're not sure where to start.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.