private IClassificationType MapMultiline(CoffeeOverview.MultiLineType type) {
			switch (type) {
			case CoffeeOverview.MultiLineType.Comment:
				return this.clsCoffeeComment;
			case CoffeeOverview.MultiLineType.HeredocDouble:
			case CoffeeOverview.MultiLineType.HeredocSingle:
			case CoffeeOverview.MultiLineType.StringDouble:
			case CoffeeOverview.MultiLineType.StringSingle:
				return this.clsCoffeeString;
			default:
				return null;
			}
		}
Example #2
0
 public TaggerBraces(CoffeeOverview overview, ITextView view, ITextBuffer sourceBuffer)
 {
     this.overview     = overview;
     this.view         = view;
     this.sourceBuffer = sourceBuffer;
     this.currentChar  = null;
     this.view.Caret.PositionChanged += (o, e) => {
         this.UpdateAtCaretPosition(e.NewPosition);
     };
     this.view.LayoutChanged += (o, e) => {
         if (e.NewSnapshot != e.OldSnapshot)
         {
             this.UpdateAtCaretPosition(this.view.Caret.Position);
         }
     };
 }
		public Classifier(CoffeeOverview overview, IClassificationTypeRegistryService classificationRegistry) {
			this.overview = overview;
			this.clsCoffeeString = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeString);
			this.clsCoffeeIdentifier = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeIdentifier);
			this.clsCoffeeKeyword = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeKeyword);
			this.clsCoffeeNumericLiteral = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeNumericLiteral);
			this.clsCoffeeComment = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeComment);
			overview.MultiLinesChanged += (o, e) => {
				if (this.latestSnapshot != null && this.ClassificationChanged != null) {
					var spans = new NormalizedSnapshotSpanCollection(
						e.Added.Concat(e.Removed)
						.Select(x => x.Span.GetSpan(this.latestSnapshot)));
					foreach (var span in spans) {
						var args = new ClassificationChangedEventArgs(span);
						this.ClassificationChanged(this, args);
					}
				}
			};
		}
Example #4
0
 public Classifier(CoffeeOverview overview, IClassificationTypeRegistryService classificationRegistry)
 {
     this.overview                = overview;
     this.clsCoffeeString         = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeString);
     this.clsCoffeeIdentifier     = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeIdentifier);
     this.clsCoffeeKeyword        = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeKeyword);
     this.clsCoffeeNumericLiteral = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeNumericLiteral);
     this.clsCoffeeComment        = classificationRegistry.GetClassificationType(VisualFormatNames.CoffeeComment);
     overview.MultiLinesChanged  += (o, e) => {
         if (this.latestSnapshot != null && this.ClassificationChanged != null)
         {
             var spans = new NormalizedSnapshotSpanCollection(
                 e.Added.Concat(e.Removed)
                 .Select(x => x.Span.GetSpan(this.latestSnapshot)));
             foreach (var span in spans)
             {
                 var args = new ClassificationChangedEventArgs(span);
                 this.ClassificationChanged(this, args);
             }
         }
     };
 }