Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

No dependency resolution for `can_macroexpand` + external macro

Open damourChris opened this issue 1 year ago • 4 comments

A function definition that use the @htl macro and has a docstrings attached to it cannot be called before the definition as the cell isn't ordered properly.

You can see in MWE that the cell with the call to the bad function is located before the function definition and does not work. When placed after, it does.

Note that this only seems to be when combining @htl and docstring.

Minimum Working Example

MWE

Tested in Pluto v0.19.38

damourChris avatar Feb 15 '24 02:02 damourChris

Thanks for writing a MWE!

fonsp avatar Feb 21 '24 08:02 fonsp

I was facing the same issue and I think go introduced in a recent version. In my git history I can see that my notebook file got "corrupted" without having docstrings added.

geoextra avatar Feb 28 '24 14:02 geoextra

@Pangoraw Do you see a way to fix this? Otherwise let's just revert https://github.com/fonsp/Pluto.jl/pull/2797

fonsp avatar Feb 29 '24 10:02 fonsp

@Pangoraw Do you see a way to fix this? Otherwise let's just revert https://github.com/fonsp/Pluto.jl/pull/2797

It is interesting because it should carry on with the macro resolution but it doesn't. Maybe we can revert for now?

I think the problem is that we don't mark failed ExEx.try_macroexpand as unresolved so they are never resolved. See https://github.com/fonsp/Pluto.jl/issues/1388#issuecomment-898311194. Another example with @bind + @u_str:

Screencast from 01-03-2024 14:04:50.webm

Pangoraw avatar Mar 01 '24 13:03 Pangoraw