Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ICSharpCode.ILSpyCmd/IlspyCmdProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class ILSpyCmdProgram
public bool ReportExcludedTypes { get; set; }

[Option(generateDiagrammerCmd + "-docs", "The path or file:// URI of the XML file containing the target assembly's documentation comments." +
" You only need to set this if a) you want your diagrams annotated with them and b) the file name differs from that of the assmbly." +
" To enable XML documentation output for your assmbly, see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/#create-xml-documentation-output",
" You only need to set this if a) you want your diagrams annotated with them and b) the file name differs from that of the assembly." +
" To enable XML documentation output for your assembly, see https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/#create-xml-documentation-output",
CommandOptionType.SingleValue)]
public string XmlDocs { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions ICSharpCode.ILSpyCmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Options:
your regular expressions.
--generate-diagrammer-docs The path or file:// URI of the XML file containing the target assembly's
documentation comments. You only need to set this if a) you want your diagrams
annotated with them and b) the file name differs from that of the assmbly. To
enable XML documentation output for your assmbly, see
annotated with them and b) the file name differs from that of the assembly. To
enable XML documentation output for your assembly, see
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/#create-xml-documentation-output
--generate-diagrammer-strip-namespaces Optional space-separated namespace names that are removed for brevity from XML
documentation comments. Note that the order matters: e.g. replace
Expand Down
20 changes: 20 additions & 0 deletions ILSpy/Analyzers/AnalyzerEntityTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;

using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Utils;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX;
Expand Down Expand Up @@ -57,6 +61,22 @@ public override void ActivateItem(IPlatformRoutedEventArgs e)

public override object? ToolTip => Member?.ParentModule?.MetadataFile?.FileName;

/// <summary>
/// Renders a member signature with C# syntax highlighting for the Analyze tree view.
/// </summary>
protected object CreateHighlightedSignatureText(string signature)
{
IHighlightingDefinition? highlighting = Language.SyntaxHighlighting;
if (highlighting == null)
return signature;

var document = new TextDocument(signature);
var richText = DocumentPrinter.ConvertTextDocumentToRichText(document, new DocumentHighlighter(document, highlighting)).ToRichTextModel();
var textBlock = new TextBlock();
textBlock.Inlines.AddRange(richText.CreateRuns(document));
return textBlock;
}

public override bool HandleAssemblyListChanged(ICollection<LoadedAssembly> removedAssemblies, ICollection<LoadedAssembly> addedAssemblies)
{
if (Member == null)
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/Analyzers/TreeNodes/AnalyzedEventTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AnalyzedEventTreeNode(IEvent analyzedEvent, IEntity? source, string prefi
public override object Icon => EventTreeNode.GetIcon(analyzedEvent);

// TODO: This way of formatting is not suitable for events which explicitly implement interfaces.
public override object Text => prefix + Language.EntityToString(analyzedEvent, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames);
public override object Text => CreateHighlightedSignatureText(prefix + Language.EntityToString(analyzedEvent, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames));

protected override void LoadChildren()
{
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/Analyzers/TreeNodes/AnalyzedFieldTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public AnalyzedFieldTreeNode(IField analyzedField, IEntity? source)

public override object Icon => FieldTreeNode.GetIcon(analyzedField);

public override object Text => Language.EntityToString(analyzedField, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames);
public override object Text => CreateHighlightedSignatureText(Language.EntityToString(analyzedField, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames));

protected override void LoadChildren()
{
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/Analyzers/TreeNodes/AnalyzedMethodTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public AnalyzedMethodTreeNode(IMethod analyzedMethod, IEntity? source, string pr

public override object Icon => MethodTreeNode.GetIcon(analyzedMethod);

public override object Text => prefix + Language.EntityToString(analyzedMethod, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames);
public override object Text => CreateHighlightedSignatureText(prefix + Language.EntityToString(analyzedMethod, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames));

protected override void LoadChildren()
{
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/Analyzers/TreeNodes/AnalyzedPropertyTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public AnalyzedPropertyTreeNode(IProperty analyzedProperty, IEntity? source, str
public override object Icon => PropertyTreeNode.GetIcon(analyzedProperty);

// TODO: This way of formatting is not suitable for properties which explicitly implement interfaces.
public override object Text => prefix + Language.EntityToString(analyzedProperty, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames);
public override object Text => CreateHighlightedSignatureText(prefix + Language.EntityToString(analyzedProperty, ConversionFlags.ShowDeclaringType | ConversionFlags.UseFullyQualifiedEntityNames));

protected override void LoadChildren()
{
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/Analyzers/TreeNodes/AnalyzedTypeTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public AnalyzedTypeTreeNode(ITypeDefinition analyzedType, IEntity? source)

public override object Icon => TypeTreeNode.GetIcon(analyzedType);

public override object Text => Language.TypeToString(analyzedType);
public override object Text => CreateHighlightedSignatureText(Language.TypeToString(analyzedType));

protected override void LoadChildren()
{
Expand Down