waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.93k stars 113 forks source link

Simplify disassembly output for simple cases. #182

Closed waf closed 2 years ago

waf commented 2 years ago

In the case where a simple statement like "var sum = 5 + 3;" is submitted for decompilation, we send back a ton of text: the <Module> declaration, the generated Program, its constructor, as well as the generated <Main>$ method.

This PR simplifies the output so that in cases where there's only a Program.Main, we return just the contents of the Program.Main method. In other cases, like where functions and types are created, we still return the full output.

This PR also unfortunately removes the syntax highlighting attempt for IL -- we were co-opting the roslyn c# highlighting logic (which happened to mostly work, but now throws an exception).

codecov-commenter commented 2 years ago

Codecov Report

Merging #182 (1bc85a3) into main (4a074e4) will decrease coverage by 0.7%. The diff coverage is 91.1%.

@@           Coverage Diff           @@
##            main    #182     +/-   ##
=======================================
- Coverage   82.8%   82.0%   -0.8%     
=======================================
  Files         49      50      +1     
  Lines       3628    3689     +61     
  Branches     457     467     +10     
=======================================
+ Hits        3004    3025     +21     
- Misses       439     477     +38     
- Partials     185     187      +2     
Impacted Files Coverage Δ
CSharpRepl.Services/Disassembly/Disassembler.cs 91.2% <90.6%> (-3.5%) :arrow_down:
CSharpRepl/CSharpReplPromptCallbacks.cs 78.6% <100.0%> (+2.0%) :arrow_up:
CSharpRepl/CommandLine.cs 93.5% <0.0%> (-0.2%) :arrow_down:
CSharpRepl/ReadEvalPrintLoop.cs 89.8% <0.0%> (ø)
CSharpRepl/ConfigurationFile.cs 25.0% <0.0%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.