JuliaCI / PkgTemplates.jl

Create new Julia packages, the easy way
https://juliaci.github.io/PkgTemplates.jl
MIT License
640 stars 101 forks source link

Incorrect `Source` link for Plugin declared with `@plugin` #219

Open nickrobinson251 opened 4 years ago

nickrobinson251 commented 4 years ago

~I don't know if this is a Documenter.jl issue or a PkgTemplates.jl... but~ i think PkgTemplates.jl

The docs source button links to entirely the wrong place for almost all plugins. I think those that are defined with @plugin have the wrong source link, and instead link to https://github.com/JuliaLang/julia/tree/96786e22ccabfdafd073122abb1fb69cea921e17/base#L0-L35 (which is an excellent nonsense, especially as some link to base#L0-L7 or base#L0-L14 or base#L0-L26)

image

I discovered this by trying to look at the code for the Git Plugin... which also revealed this madness (in PkgTemplates v0.7.8)

julia> @which Git(ignore=["a"])
(::Core.var"#Type##kw")(::Any, ::Type{Git}) in PkgTemplates at /Users/nick/.julia/packages/Parameters/CVyBv/src/Parameters.jl:468

So that's fun. Maybe related? 😂

iamed2 commented 4 years ago

Maybe the __source__ information needs to be passed through to the Parameters.jl macro?

oxinabox commented 4 years ago

passing __source__ through a macro is hard. I have only every done it successfully for 1 line functions https://github.com/JuliaDiff/ChainRulesCore.jl/blob/67996f24a7b1bc5493b949c0e8ba616ef0c417d3/src/differentials/thunks.jl#L78

I have been meaning to write a function to do it reliably for other code. AFAICT you basically need to strip out all LineInfo nodes from the AST and replace them