tomasr / KeywordClassifier

A sample VS2010 extension that renders C# some keywords in a different color.

This URL has Read+Write access

KeywordClassifier / LanguageItems.cs
100644 57 lines (54 sloc) 1.742 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Winterdom.VisualStudio.Extensions.Text {
   interface ILanguageKeywords {
      String[] ControlFlow { get; }
      String[] Linq { get; }
      String[] Visibility { get; }
   }
 
   class CSharp : ILanguageKeywords {
      public const String ContentType = "CSharp";
      static readonly String[] CS_KEYWORDS = {
         "if", "else", "while", "do", "for", "foreach",
         "switch", "break", "continue", "return", "goto", "throw"
      };
      static readonly String[] CS_LINQ_KEYWORDS = {
         "select", "let", "where", "join", "orderby", "group",
         "by", "on", "equals", "into", "from", "descending",
         "ascending"
      };
      static readonly String[] CS_VIS_KEYWORDS = {
         "public", "private", "protected", "internal"
      };
      public String[] ControlFlow {
         get { return CS_KEYWORDS; }
      }
      public String[] Linq {
         get { return CS_LINQ_KEYWORDS; }
      }
      public String[] Visibility {
         get { return CS_VIS_KEYWORDS; }
      }
   }
   class Cpp : ILanguageKeywords {
      public const String ContentType = "C/C++";
      static readonly String[] CPP_KEYWORDS = {
         "if", "else", "while", "do", "for", "each", "switch",
         "break", "continue", "return", "goto", "throw"
      };
      static readonly String[] CPP_VIS_KEYWORDS = {
         "public", "private", "protected", "internal"
      };
      public String[] ControlFlow {
         get { return CPP_KEYWORDS; }
      }
      public String[] Linq {
         get { return new String[0]; }
      }
      public String[] Visibility {
         get { return CPP_VIS_KEYWORDS; }
      }
   }
}