diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2015-04-20 17:42:27 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2015-04-20 17:43:18 +0300 |
commit | de043d330a8bf5855d4d983c804cd36727cb2406 (patch) | |
tree | e14fbbe878ebe73957e4bb5c56e9a87bba3b1ff8 | |
parent | 3ad913035f878439d6425106d9a4392a61913853 (diff) |
[CSharpBinding] Added colorization of Xamarin.Mac pseudo built in type
keywords.
-rw-r--r-- | main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs index 17c9950d36..80c29fe41d 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs @@ -38,6 +38,7 @@ using MonoDevelop.Ide.Editor.Highlighting; using MonoDevelop.Core.Text; using System.Collections.Generic; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.CSharp; namespace MonoDevelop.CSharp.Highlighting { @@ -142,7 +143,7 @@ namespace MonoDevelop.CSharp.Highlighting public HighlightingVisitior (SemanticModel resolver, Action<StyledTreeSegment> colorizeCallback, CancellationToken cancellationToken, ISegment textSpan) : base (resolver) { if (resolver == null) - throw new ArgumentNullException ("resolver"); + throw new ArgumentNullException (nameof (resolver)); this.cancellationToken = cancellationToken; this.colorizeCallback = colorizeCallback; this.region = new TextSpan (textSpan.Offset, textSpan.Length); @@ -194,5 +195,21 @@ namespace MonoDevelop.CSharp.Highlighting { colorizeCallback (new StyledTreeSegment (span.Start, span.Length, color)); } + + public override void VisitIdentifierName (Microsoft.CodeAnalysis.CSharp.Syntax.IdentifierNameSyntax node) + { + switch (node.Identifier.Text) { + case "nfloat": + case "nint": + case "nuint": + var symbol = base.semanticModel.GetSymbolInfo (node).Symbol as INamedTypeSymbol; + if (symbol != null && symbol.ContainingNamespace.ToDisplayString () == "System") { + Colorize (node.Span, "Keyword(Type)"); + return; + } + break; + } + base.VisitIdentifierName (node); + } } } |