JuliaPluto / PlutoSliderServer.jl

Web server to run just the `@bind` parts of a Pluto.jl notebook
https://computationalthinking.mit.edu/
The Unlicense
130 stars 17 forks source link

Use the server session to get bond names instead of parsing the notebook code #97

Closed disberd closed 1 year ago

disberd commented 1 year ago

The current way PlutoSliderServer finds bonds is by going through the parsed cell code and looking for the presence of the @bind variable: https://github.com/JuliaPluto/PlutoSliderServer.jl/blob/01f611277c962e0087767f9547b8f4b6591f0214/src/MoreAnalysis.jl#L14-L28

This unfortunately do not work for custom macros that internally create bonds.

The SliderServer already instantiate a Pluto Server session so we can directly access the bound variables that are recorded inside the PlutoRunner module. This makes it easier to track all possible bound variables without resorting to complex rules for parsing the code within the cell inputs

Discussed this approach 2 weeks ago with @fonsp.

I will fix/add test once the related Pluto PR (https://github.com/fonsp/Pluto.jl/pull/2379) is merged

disberd commented 1 year ago

@fonsp this is now ready for review

disberd commented 1 year ago

@fonsp I did just use the example you gave me on zulip :D, didn't think about timing impact but I removed HypertextLiteral and just used Markdown now which should not impact the time