4444
4545class TwigExtension extends AbstractExtension implements GlobalsInterface
4646{
47- /**
48- * @param array<int, bool> $renderedSources
49- */
5047 public function __construct (
5148 protected readonly DOMJudgeService $ dj ,
5249 protected readonly ConfigurationService $ config ,
@@ -61,7 +58,6 @@ public function __construct(
6158 protected readonly SerializerInterface $ serializer ,
6259 #[Autowire('%kernel.project_dir% ' )]
6360 protected readonly string $ projectDir ,
64- protected array $ renderedSources = []
6561 ) {}
6662
6763 public function getFunctions (): array
@@ -933,39 +929,6 @@ public function codeEditor(
933929 ));
934930 }
935931
936- /**
937- * Gets the JavaScript to get a Monaco model instance for the submission file.
938- * Renders the source code of the file as Monaco model, if not already rendered.
939- * @return string The JavaScript source assignable to a model variable.
940- */
941- public function getMonacoModel (SubmissionFile $ file ): string
942- {
943- if (array_key_exists ($ file ->getSubmitfileid (), $ this ->renderedSources )) {
944- return sprintf (
945- <<<JS
946- monaco.editor.getModel(monaco.Uri.parse("diff/%d/%s"));
947- JS ,
948- $ file ->getSubmitfileid (),
949- $ file ->getFilename (),
950- );
951- }
952- $ this ->renderedSources [$ file ->getSubmitfileid ()] = true ;
953-
954- $ source = Utils::reencodeUtf8 ($ file ->getSourcecode ());
955- return sprintf (
956- <<<JS
957- monaco.editor.createModel(
958- %s,
959- undefined,
960- monaco.Uri.parse("diff/%d/%s")
961- );
962- JS ,
963- $ this ->serializer ->serialize ($ source , 'json ' ),
964- $ file ->getSubmitfileid (),
965- $ file ->getFilename (),
966- );
967- }
968-
969932 /** @param array<int, array{
970933 * rank: int,
971934 * filename: string,
0 commit comments