diff --git a/ILSpy/Languages/CSharpHighlightingTokenWriter.cs b/ILSpy/Languages/CSharpHighlightingTokenWriter.cs index 2e698460c..450275c5f 100644 --- a/ILSpy/Languages/CSharpHighlightingTokenWriter.cs +++ b/ILSpy/Languages/CSharpHighlightingTokenWriter.cs @@ -23,6 +23,7 @@ using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.Decompiler.CSharp; using ICSharpCode.Decompiler.CSharp.OutputVisitor; using ICSharpCode.Decompiler.CSharp.Syntax; +using ICSharpCode.Decompiler.IL; using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.ILSpyX.Extensions; @@ -62,6 +63,9 @@ namespace ICSharpCode.ILSpy HighlightingColor eventDeclarationColor; HighlightingColor eventAccessColor; + HighlightingColor variableColor; + HighlightingColor parameterColor; + HighlightingColor valueKeywordColor; HighlightingColor thisKeywordColor; HighlightingColor trueKeywordColor; @@ -106,8 +110,8 @@ namespace ICSharpCode.ILSpy this.propertyAccessColor = highlighting.GetNamedColor("PropertyAccess"); this.eventDeclarationColor = highlighting.GetNamedColor("EventDeclaration"); this.eventAccessColor = highlighting.GetNamedColor("EventAccess"); - //this.variableDeclarationColor = this.variableAccessColor = defaultTextColor; - //this.parameterDeclarationColor = this.parameterAccessColor = defaultTextColor; + this.variableColor = highlighting.GetNamedColor("Variable"); + this.parameterColor = highlighting.GetNamedColor("Parameter"); this.valueKeywordColor = highlighting.GetNamedColor("NullOrValueKeywords"); this.thisKeywordColor = highlighting.GetNamedColor("ThisOrBaseReference"); this.trueKeywordColor = highlighting.GetNamedColor("TrueFalse"); @@ -345,13 +349,25 @@ namespace ICSharpCode.ILSpy public override void WriteIdentifier(Identifier identifier) { HighlightingColor color = null; - if (identifier.Name == "value" - && identifier.Parent?.GetResolveResult() is ILVariableResolveResult rr - && rr.Variable.Kind == Decompiler.IL.VariableKind.Parameter - && identifier.Ancestors.OfType().FirstOrDefault() is Accessor accessor - && accessor.Role != PropertyDeclaration.GetterRole) + if (identifier.Parent?.GetResolveResult() is ILVariableResolveResult rr) { - color = valueKeywordColor; + if (rr.Variable.Kind == VariableKind.Parameter) + { + if (identifier.Name == "value" + && identifier.Ancestors.OfType().FirstOrDefault() is { } accessor + && accessor.Role != PropertyDeclaration.GetterRole) + { + color = valueKeywordColor; + } + else + { + color = parameterColor; + } + } + else + { + color = variableColor; + } } if (identifier.Parent is AstType) { diff --git a/ILSpy/TextView/CSharp-Mode.xshd b/ILSpy/TextView/CSharp-Mode.xshd index 8bed02109..d2db08534 100644 --- a/ILSpy/TextView/CSharp-Mode.xshd +++ b/ILSpy/TextView/CSharp-Mode.xshd @@ -48,6 +48,8 @@ + + diff --git a/ILSpy/Themes/Theme.Dark.xaml b/ILSpy/Themes/Theme.Dark.xaml index ede1f10f8..76d3abfbb 100644 --- a/ILSpy/Themes/Theme.Dark.xaml +++ b/ILSpy/Themes/Theme.Dark.xaml @@ -72,6 +72,8 @@ + + diff --git a/ILSpy/Themes/Theme.Light.xaml b/ILSpy/Themes/Theme.Light.xaml index c55417bb4..ca08971e2 100644 --- a/ILSpy/Themes/Theme.Light.xaml +++ b/ILSpy/Themes/Theme.Light.xaml @@ -72,6 +72,8 @@ + + diff --git a/ILSpy/Themes/Theme.RSharpDark.xaml b/ILSpy/Themes/Theme.RSharpDark.xaml index f783da16d..62bfddf03 100644 --- a/ILSpy/Themes/Theme.RSharpDark.xaml +++ b/ILSpy/Themes/Theme.RSharpDark.xaml @@ -77,6 +77,8 @@ + + diff --git a/ILSpy/Themes/Theme.RSharpLight.xaml b/ILSpy/Themes/Theme.RSharpLight.xaml index 02021fb60..8eb28d77c 100644 --- a/ILSpy/Themes/Theme.RSharpLight.xaml +++ b/ILSpy/Themes/Theme.RSharpLight.xaml @@ -77,6 +77,8 @@ + + diff --git a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml index e7ad85099..7a94d4fab 100644 --- a/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeDarkPlus.xaml @@ -82,6 +82,8 @@ + + diff --git a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml index 6fa4995f6..2ab0d1000 100644 --- a/ILSpy/Themes/Theme.VSCodeLightPlus.xaml +++ b/ILSpy/Themes/Theme.VSCodeLightPlus.xaml @@ -82,6 +82,8 @@ + +