Top-Level Code Prototype: Scenario B

There’s a lot of excitement these days for interweaving code and rich-text in the same environment. In my last post I touched on this referencing some of the work going on with “Try .NET” and the .NET docs. Other cool approaches to this are Jupyter Notebooks and Xamarin Workbooks. In this video I combine my top-level code prototype with with a proof-of-concept Visual Studio extension I hacked together to show an alternate approach that VB could take:

Special Thanks to the folks at Marked.js for saving me from having to roll my own markdown renderer for this demo.

Finding the balance point

This approach leverages all the flexibility of the Visual Studio editor to give you a rich text experience while sacrificing absolutely none of the capabilities of a full professional IDE.

I love the experience of Notebooks/Workbooks but the trade-off of starting to build-out an experience for VB outside of VS is that you end up spending a lot of cycles rebuilding the capabilities you already have. It starts with “let just have a run-able code block embedded in a page” but the next thing is:

  • But that code block should have the right syntax highlighting; can’t be just black text—that’s weird.
  • And… well, semantic colorization of types would be nice too.
  • Some semantic tooltips could really liven up the place…
  • And wouldn’t it be nice to step through this code one line at a time?
  • Wouldn’t it be nice if you could edit the code.
  • Well now we need completion.
  • Completion isn’t using the right keys, it doesn’t feel right because it doesn’t complete on <space> or <.> or trigger in the right contexts…
  • Hmm, definitely going to want that end-construct-generation… I’m tired of typing “End” blocks.
  • Probably going to want to get squiggles for syntax errors…
  • Hey, do you think we could get a Roslyn analyzer running up here?
  • How does a person graduate this experience out of a document and into a real-project?

Of course these are problems you can solve and have been solved but there are more challenges behind them and it all stems from digging yourself out of the hole you jump into when you start from scratch. This scenario is about inverting the problem and asking “How lightweight and rich of an experience can we get in the same Visual Studio where we’re going to be spending the vast majority of our time anyway?”

Many years ago I wrote several of the Roslyn API “Getting Started” docs. To really get Roslyn you have to have the Roslyn Syntax Visualizer running while you explore, you need to be able to inspect live data while learning. This is the kind of experience I envisioned when we I first wrote them.

Summary

I’m definitely not knocking great stuff like Notebooks/Workbooks but I can imagine rich, interactive, workbook-like experiences in VS, using amazing capabilities like inspecting data using custom debugger visualizers that would be very expensive to recreate elsewhere. So, again I’m asking “What if we invert the problem?”

Ultimately there’s a spectrum and this is just one point on it and I respect that we can end up up having more than one solution for different situations. At a minimum top-level code in VB potentially let’s both solutions share a file format. So I’d love to hear from you folks on where you draw your lines.

Let me know your thoughts the feature and this potential application of it. And please share!

Regards,

-ADG

P.S. This is Scenario B, it’s the second of 5 (though yesterday I tripped over a 6th). I’m trying a different approach with this prototype than in the past and I’ll post the usual GitHub issue with all the design details/questions I ran into sometime after I post Scenario D.

2 thoughts on “Top-Level Code Prototype: Scenario B

  1. This is amazing.
    I hope you can extend this work in another direction: formatting embedded scripts/languages in VB.NET. I suggested this in Roslyn:
    https://github.com/dotnet/roslyn/issues/34821
    I am facing this issue in two of my projects:
    1. Vazor:
    https://github.com/VBAndCs/Vazor
    where I use xml literals to generate razor views for VB.NET projects. The problem is vb.net editor doesn’t support html5 tags written inside xml literals, and xsd doesn’t work anymore!
    I need a way to tell VB editor to apply HTML editor on tags written in this scope. If not s in the proposal, at least by marking this method with some UseEditorAttribute(“HTML”).

    2. ZML:
    https://github.com/VBAndCs/ZML
    where I use XML tags to represent c# statements in Razor views. I need to have editor support for my defined zml tags and attrs.
    Your work give me hope this editor thing can be customized someday.
    If there is something to solve this now, even an external editor, please tell me bout.
    Thanks, and looking forward for this new documentation feature.

    Like

  2. Pingback: Top-Level Code Prototype: Scenario D | Anthony's blog

Comments are closed.