@@ -66,8 +66,6 @@ public partial class CodeRunnerViewModel : ObservableObject
6666
6767 public CodeRunnerViewModel ( string languageExtension , string code , Func < string > getLatestCode )
6868 {
69- // Set the highlighting name based on the source language extension
70- AsmHighlightingName = MapLanguageExtensionToAsmHighlighting ( languageExtension ) ;
7169 Compilers = _compilersSettings . GetCompilersByExtension ( languageExtension ) ;
7270 var defaultCompilerId = _compilersSettings . GetDefaultCompilerIdByExtension ( languageExtension ) ;
7371 SelectedCompiler = Compilers . FirstOrDefault ( c => c . Id == defaultCompilerId ) ?? Compilers . FirstOrDefault ( ) ;
@@ -79,20 +77,30 @@ public CodeRunnerViewModel(string languageExtension, string code, Func<string> g
7977 }
8078
8179 // This method maps the source language extension to the appropriate assembly highlighting definition name.
82- private static string MapLanguageExtensionToAsmHighlighting ( string languageExtension )
80+ private static string MapLanguageExtensionToAsmHighlighting ( string languageExtension , CompilerInfo ? compiler )
8381 {
82+ if ( languageExtension . Equals ( "cs" , StringComparison . OrdinalIgnoreCase ) &&
83+ compiler ? . Id ? . Contains ( "ildasm" , StringComparison . OrdinalIgnoreCase ) == true )
84+ {
85+ return "il" ;
86+ }
87+
8488 return languageExtension . ToLowerInvariant ( ) switch
8589 {
86- //"cs" => "il",
90+
8791 "java" => "java-bytecode" ,
88- "py" => "python-bytecode" ,
8992 _ => "asm" , // Default for C++, Rust, D, etc.
9093 } ;
9194 }
9295
93- partial void OnSelectedCompilerChanged ( CompilerInfo ? value )
96+ partial void OnSelectedCompilerChanged ( CompilerInfo ? oldValue , CompilerInfo ? newValue )
9497 {
95- Flags = value ? . Flags ?? "" ;
98+ Flags = newValue ? . Flags ?? "" ;
99+ AsmHighlightingName = MapLanguageExtensionToAsmHighlighting ( Extension , newValue ) ;
100+ // clear previous outputs
101+ AsmCode = "" ;
102+ StdOut = "" ;
103+ ErrorText = "" ;
96104 }
97105
98106 private bool CanExecuteCompilerActions ( )
0 commit comments