Skip to content

Iteration 2: Getting all simple code listings working#898

Open
Joshua-Lester3 wants to merge 29 commits intoIntelliTect:mainfrom
Joshua-Lester3:jlester/try-net-2
Open

Iteration 2: Getting all simple code listings working#898
Joshua-Lester3 wants to merge 29 commits intoIntelliTect:mainfrom
Joshua-Lester3:jlester/try-net-2

Conversation

@Joshua-Lester3
Copy link
Collaborator

Description

Describe your changes here.

Fixes #Issue_Number (if available)

Ensure that your pull request has followed all the steps below:

  • Code compilation
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary

Joshua-Lester3 and others added 21 commits February 5, 2026 12:23
- Updated appsettings.json to include TryDotNet origin configuration.
- Introduced code-runner.css for styling the interactive code execution panel.
- Implemented trydotnet-module.js for managing TryDotNet functionality, including session management, code execution, and error handling.
- Enhanced site.js to initialize TryDotNet functionality alongside chat widget.
Co-authored-by: Kevin B <Keboo@users.noreply.github.com>
…ace TestWebHostEnvironment with Moq for IWebHostEnvironment in WebApplicationFactory
…ding improvements

- Load runnable listings from chapter-listings.json and build a Set of valid listings.
- Implement functions to check if a listing is runnable and to strip region directives from code.
- Update createScaffolding to prepend common using directives and handle user code more effectively.
- Modify isCompleteProgram to recognize any class with a static Main method as complete.
- Inject Run buttons only for listings present in the curated JSON, improving user experience.
@Joshua-Lester3 Joshua-Lester3 marked this pull request as draft March 5, 2026 19:23
Joshua-Lester3 and others added 2 commits March 10, 2026 22:35
…or chapter listings

- Modified the logic in loadRunnableListings to only include listings where both can_compile and can_run are true.
- Updated comments to reflect the new requirements for fileObj properties.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the TryDotNet front-end integration to support running a broader set of code listings by (a) curating which listings get “Run” buttons and (b) adjusting how listing code is classified and prepared before execution.

Changes:

  • Add support for loading a curated runnable-listings set from chapter-listings.json and only injecting Run buttons for those listings.
  • Update “complete program” detection logic and change how listing code is pre-processed (region stripping / optional usings).
  • Adjust TryDotNet session initialization parameters for the opened document.
Comments suppressed due to low confidence (1)

EssentialCSharp.Web/wwwroot/js/trydotnet-module.js:148

  • createScaffolding() no longer includes any using directives, and the current flow does not call prependUsings() for scaffolded code. This will cause scaffolded snippets that rely on SDK implicit/global usings (e.g., Console, List<T>) to fail to compile under TryDotNet's console package. Either put the required usings back into the scaffolding template or ensure the generated fileContent (both complete and scaffolded) is passed through prependUsings() when needed.
function createScaffolding(userCode) {
    return `
namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            #region controller
${userCode}
            #endregion
        }
    }
}`;

@Joshua-Lester3 Joshua-Lester3 enabled auto-merge (squash) March 13, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants