Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with VS Code Notebooks #411

Open
ThomasNieto opened this issue Aug 1, 2020 · 6 comments
Open

Integration with VS Code Notebooks #411

ThomasNieto opened this issue Aug 1, 2020 · 6 comments
Labels
Category-Module Pertaining to the module's functionality itself. Issue-Suggestion This should be added!

Comments

@ThomasNieto
Copy link
Contributor

Describe "Functionality"

I just read the PS blog on PowerShell VS Code notebook public preview and the first thing I thought where this might be useful was in PSKoans.

Its able to take ps1 scripts with comments formatted in markdown and display that in a notebook view. The code is then in a panel and is able to run in the same view like in a Jupyter notebook.

Context "Private or Public? What are the use cases? Parameters? Options?"

This can give additional formatting and "UI" around each Koan for people who just want to see the instructions and code snippet they're working on instead of the whole script.

Context "Additional Information"

@ThomasNieto ThomasNieto added Category-Module Pertaining to the module's functionality itself. Issue-Suggestion This should be added! labels Aug 1, 2020
@vexx32
Copy link
Owner

vexx32 commented Aug 1, 2020

Hmm, that could prove interesting. I'll have to have a look at how the koans render in the Notebook mode. All the examples given in the blog post are pretty tame, no indication of how a comment inside a scriptblock is rendered...

Perhaps it's worth asking @TylerLeonhardt and possibly others whether a Pester test could be rendered in a specific way that might help us out. 😉

@TylerLeonhardt
Copy link

Pester tests are a weird one because they have huge blocks of code.

Markdown cells in the mix of that would break those up.... Unless the describe blocks are small... But I don't think that's true for PSKoans, right?

@vexx32
Copy link
Owner

vexx32 commented Aug 1, 2020

Yeah, not really, no... the general format is:

<#
    Introductory paragraph(s).
#>
Describe 'Thing' {

    Context 'Part 1' {
        <#
            Detail sentence/paragraph(s)
        #>
        ...
    }

    Context 'Part 2' {
        <#
            Detail sentence/paragraph(s)
        #>
        ...
    }
}

Many of the It blocks have comments, too.

I was wondering if it's possible to define a custom view for the notebook mode? Such that, for example, for PSKoans it could render Describe / Context / It as various heading levels, and then comments more or less where they're at in the code (as Markdown), with the code for each It block being a discrete code block or something.

@TylerLeonhardt
Copy link

Yeah this would need a substantial change to Notebook Mode...

With that said, maybe there is an opportunity to implement a Notebook UI in https://github.com/TylerLeonhardt/vscode-powershell-test-adapter

Where the play button would run the test/tests inside the code block.

@TylerLeonhardt
Copy link

I don't really have time to work on that, but such an experience could be realized that way

@vexx32
Copy link
Owner

vexx32 commented Aug 1, 2020

Appreciate the pointers! 💖 It'll be something to look into when I get some time 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category-Module Pertaining to the module's functionality itself. Issue-Suggestion This should be added!
Projects
None yet
Development

No branches or pull requests

3 participants