Skip to content

Commit 57923c5

Browse files
Remove COMMON_USINGS and prependUsings function from TryDotNet module
1 parent 4d1f096 commit 57923c5

1 file changed

Lines changed: 0 additions & 20 deletions

File tree

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,6 @@ function stripRegionDirectives(code) {
114114
return code.replace(/^\s*#(?:region|endregion)\s+(?:INCLUDE|EXCLUDE).*$/gm, '').trim();
115115
}
116116

117-
// Common using directives that mirror the SDK's implicit global usings.
118-
// These are needed because TryDotNet's 'console' package does not inject them.
119-
const COMMON_USINGS = `using System;
120-
using System.Collections.Generic;
121-
using System.Linq;
122-
using System.Text;
123-
using System.Globalization;
124-
using System.Text.RegularExpressions;`;
125-
126-
/**
127-
* Prepends COMMON_USINGS to code that has no using directives of its own.
128-
* @param {string} code - Source code
129-
* @returns {string}
130-
*/
131-
function prependUsings(code) {
132-
if (/^\s*using\s+/m.test(code)) return code; // already has usings
133-
return `${COMMON_USINGS}\n\n${code}`;
134-
}
135-
136117
/**
137118
* Creates scaffolding for user code to run in the TryDotNet environment.
138119
* @param {string} userCode - The user's C# code to wrap
@@ -480,7 +461,6 @@ export function useTryDotNet() {
480461
// Top-level statement files get region directives stripped so the
481462
// scaffolding wrapper doesn't contain raw #region lines.
482463
if (isCompleteProgram(code)) {
483-
// return prependUsings(code);
484464
return code;
485465
}
486466
return stripRegionDirectives(code);

0 commit comments

Comments
 (0)