summaryrefslogtreecommitdiff
path: root/Source/DafnyExtension/ClassificationTagger.cs
diff options
context:
space:
mode:
authorGravatar wuestholz <unknown>2013-06-11 10:24:31 -0700
committerGravatar wuestholz <unknown>2013-06-11 10:24:31 -0700
commit4314d2bf8634ddc573c4f0a4266a6771cb5eb696 (patch)
tree56dfaee0e35b989e8b7a600dd5c33119054f3fb5 /Source/DafnyExtension/ClassificationTagger.cs
parente2508e12bf24a84f731884fcbd8f5f128dbf9f9a (diff)
DafnyExtension: Did some refactoring.
Diffstat (limited to 'Source/DafnyExtension/ClassificationTagger.cs')
-rw-r--r--Source/DafnyExtension/ClassificationTagger.cs28
1 files changed, 19 insertions, 9 deletions
diff --git a/Source/DafnyExtension/ClassificationTagger.cs b/Source/DafnyExtension/ClassificationTagger.cs
index 8f6191e5..b3bafa11 100644
--- a/Source/DafnyExtension/ClassificationTagger.cs
+++ b/Source/DafnyExtension/ClassificationTagger.cs
@@ -4,13 +4,15 @@ using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
-using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace DafnyLanguage
{
+
+ #region Provider
+
[Export(typeof(ITaggerProvider))]
[ContentType("dafny")]
[TagType(typeof(ClassificationTag))]
@@ -31,11 +33,15 @@ namespace DafnyLanguage
}
}
+ #endregion
+
+ #region Tagger
+
internal sealed class DafnyClassifier : ITagger<ClassificationTag>
{
ITextBuffer _buffer;
ITagAggregator<DafnyTokenTag> _aggregator;
- IDictionary<DafnyTokenKinds, IClassificationType> _typeMap;
+ IDictionary<DafnyTokenKind, IClassificationType> _typeMap;
static bool DafnyMenuWasInitialized;
@@ -45,14 +51,15 @@ namespace DafnyLanguage
_buffer = buffer;
_aggregator = tagAggregator;
_aggregator.TagsChanged += new EventHandler<TagsChangedEventArgs>(_aggregator_TagsChanged);
+
// use built-in classification types:
- _typeMap = new Dictionary<DafnyTokenKinds, IClassificationType>();
- _typeMap[DafnyTokenKinds.Keyword] = standards.Keyword;
- _typeMap[DafnyTokenKinds.Number] = standards.NumberLiteral;
- _typeMap[DafnyTokenKinds.String] = standards.StringLiteral;
- _typeMap[DafnyTokenKinds.Comment] = standards.Comment;
- _typeMap[DafnyTokenKinds.VariableIdentifier] = standards.Identifier;
- _typeMap[DafnyTokenKinds.VariableIdentifierDefinition] = typeService.GetClassificationType("Dafny identifier");
+ _typeMap = new Dictionary<DafnyTokenKind, IClassificationType>();
+ _typeMap[DafnyTokenKind.Keyword] = standards.Keyword;
+ _typeMap[DafnyTokenKind.Number] = standards.NumberLiteral;
+ _typeMap[DafnyTokenKind.String] = standards.StringLiteral;
+ _typeMap[DafnyTokenKind.Comment] = standards.Comment;
+ _typeMap[DafnyTokenKind.VariableIdentifier] = standards.Identifier;
+ _typeMap[DafnyTokenKind.VariableIdentifierDefinition] = typeService.GetClassificationType("Dafny identifier");
if (!DafnyMenuWasInitialized)
{
@@ -119,4 +126,7 @@ namespace DafnyLanguage
[Name("Dafny identifier")]
internal static ClassificationTypeDefinition UserType = null;
}
+
+ #endregion
+
}