bonsai-rx / bonsai

The compiler, IDE, and standard library for the Bonsai visual programming language for reactive systems
https://bonsai-rx.org
MIT License
141 stars 29 forks source link

Consider support for reading source code from nuget snupkg #1658

Open glopesdev opened 9 months ago

glopesdev commented 9 months ago

NuGet symbol packages (.snupkg) provide a standardized way of retrieving links to the package source. Since they are built automatically during package generation, they would be a great source of information to understand the functioning of individual modules, even if the package itself is undocumented.

Specifically, if we use Source Link it might even be possible to open up the code of installed package modules directly in VS Code or the editor window.

References

PathogenDavid commented 5 months ago

Do you envision this as something akin to "Go to Definition" where it opens the source of a specific node, or just showing the source of the package in general?

For the latter, I think it'd be just as useful (if not more useful) to just provide a link to open the source code repo link from the package metadata.

The former would be extremely non-trivial. Loading the PDBs is OK if you make a ton of assumptions, reading the Source Link data is straightforward, downloading the documents it points to wouldn't be that bad...but corresponding .NET types to those documents isn't super straightforward because it's simply not what the infrastructure around it is meant to do. (It's meant to be an extra tiny layer on top of a thick pile of existing debugger infrastructure that we don't have.) We could guess the file based on the name, but I'm not crazy about that idea.

IIRC Source Link-powered go to definition support in Roslyn had a dedicated Microsoft engineer working on it for well over a year and it still isn't complete and doesn't always work. (I could look into whether we could leverage that effort, but in the past I've found that editor-centric features in Roslyn are pretty heavily tied to Visual Studio.)

Also a lot of the power of having access to Source Link in workflows is being able to further navigate around in the code. At some point we'll have accidentally created a C# IDE. (I dunno about you, but I personally do not want to create a C# IDE.)

While this was fun to investigate, and I can definitely keep digging if you want me to; I'm not confident that the effort-to-utility ratio of actually implementing this makes sense.