Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Roslyn formatting options in the decompiler #1088

Open
siegfriedpammer opened this issue Mar 11, 2018 · 2 comments
Open

Implement Roslyn formatting options in the decompiler #1088

siegfriedpammer opened this issue Mar 11, 2018 · 2 comments
Labels
C# Decompiler The decompiler engine itself Help Wanted New Feature Output Output code formatting; hyperlinks/tooltips on output code

Comments

@siegfriedpammer
Copy link
Member

As we are now part of Roslyn, it would be nice to support all the formatting options that Roslyn exposes (plus new ones dotnet/roslyn#25303).

  1. Copy Roslyn's CSharpFormattingOptions into ICSharpCode.Decompiler.CSharp.Output replacing all options with plain bool/enum properties, so we use the same names as Roslyn does for the options, but don't have a dependency on Roslyn.
  2. Implement the options in CSharpOutputVisitor.
  3. Extend the Roslyn integration to pass the current options to the decompiler.
@dgrunwald
Copy link
Member

Alternative idea: translate from our syntax tree to the Roslyn SyntaxTree, and use the existing Roslyn formatters.
Or even: write a code generator that converts the immutable Roslyn SyntaxTree into a mutable SyntaxTree, and also auto-generates a conversion function from the mutable SyntaxTree to the original Roslyn SyntaxTree. Then port the decompiler to use that newly generated SyntaxTree.
However, I don't think the Roslyn syntax tree structure is quite suitable for ILSpy, e.g. we do some fancy tricks with DirectionExpression wrapping/unwrapping, so this approach might run into problems. But I do think the current syntax tree design from NRefactory is not all that great a match for ILSpy (the linked list structure is problematic, e.g. in #1202). Maybe just generate a new one using a specification in .tt file, the same way we generate the ILAst?
Lots of open questions here...

@siegfriedpammer
Copy link
Member Author

See also #603 and #1079

@siegfriedpammer siegfriedpammer added the Output Output code formatting; hyperlinks/tooltips on output code label Aug 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# Decompiler The decompiler engine itself Help Wanted New Feature Output Output code formatting; hyperlinks/tooltips on output code
Projects
None yet
Development

No branches or pull requests

2 participants