Example #1
0
        public override RichText GetRichTextTooltip(IEntity entity)
        {
            var flags           = ConversionFlags.All & ~(ConversionFlags.ShowBody | ConversionFlags.PlaceReturnTypeAfterParameterList);
            var output          = new StringWriter();
            var decoratedWriter = new TextWriterTokenWriter(output);
            var writer          = new CSharpHighlightingTokenWriter(TokenWriter.InsertRequiredSpaces(decoratedWriter), locatable: decoratedWriter);

            new CSharpAmbience()
            {
                ConversionFlags = flags
            }.ConvertSymbol(entity, writer, new DecompilerSettings().CSharpFormattingOptions);
            return(new RichText(output.ToString(), writer.HighlightingModel));
        }
Example #2
0
        void WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
        {
            syntaxTree.AcceptVisitor(new InsertParenthesesVisitor {
                InsertParenthesesForReadability = true
            });
            output.IndentationString = settings.CSharpFormattingOptions.IndentationString;
            TokenWriter tokenWriter = new TextTokenWriter(output, settings, typeSystem);

            if (output is ISmartTextOutput highlightingOutput)
            {
                tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, highlightingOutput);
            }
            syntaxTree.AcceptVisitor(new CSharpOutputVisitor(tokenWriter, settings.CSharpFormattingOptions));
        }
Example #3
0
        void WriteCode(ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
        {
            syntaxTree.AcceptVisitor(new InsertParenthesesVisitor {
                InsertParenthesesForReadability = true
            });
            TokenWriter tokenWriter = new TextTokenWriter(output, settings, typeSystem)
            {
                FoldBraces = settings.FoldBraces, ExpandMemberDefinitions = settings.ExpandMemberDefinitions
            };

            if (output is ISmartTextOutput highlightingOutput)
            {
                tokenWriter = new CSharpHighlightingTokenWriter(tokenWriter, highlightingOutput);
            }
            syntaxTree.AcceptVisitor(new CSharpOutputVisitor(tokenWriter, settings.CSharpFormattingOptions));
        }