I downloaded the source for Rainbow Braces and changed the following file:
src\Tagger\RainbowTaggerProvider.cs
Added 'Phalanger' to line 118.
Then recompiled the extension and reinstalled and it works.
Code below for anyone else that wants to use it.
Regards,
John
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace RainbowBraces
{
[Export(typeof(IViewTaggerProvider))]
[ContentType(ContentTypes.CPlusPlus)]
[ContentType(ContentTypes.CSharp)]
[ContentType(ContentTypes.VisualBasic)]
[ContentType(ContentTypes.FSharp)]
[ContentType(ContentTypes.Css)]
[ContentType(ContentTypes.Less)]
[ContentType(ContentTypes.Scss)]
[ContentType(ContentTypes.Json)]
[ContentType(ContentTypes.Xaml)]
[ContentType(ContentTypes.Xml)]
[ContentType(ContentTypes.WebForms)]
[ContentType("TypeScript")]
[ContentType("SQL")]
[ContentType("SQL Server Tools")]
[ContentType("php")]
[ContentType("PHPProjection")]
[ContentType("Phalanger")]
[ContentType("Code++")]
[ContentType("XSharp")]
[ContentType("Razor")]
[ContentType("LegacyRazorVisualBasic")]
[ContentType("WebForms")]
[ContentType("html-delegation")]
[ContentType("d")]
[TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]
[TextViewRole(PredefinedTextViewRoles.EmbeddedPeekTextView)]
[TextViewRole(CustomTextViewRoles.StickyScroll)]
[TextViewRole(CustomTextViewRoles.Diff)]
[TextViewRole(CustomTextViewRoles.Repl)]
[TextViewRole(CustomTextViewRoles.SearchResultPreview)]
[TagType(typeof(IClassificationTag))]
public class CreationListener : IViewTaggerProvider
{
[Import]
internal IClassificationTypeRegistryService _registry = null;
[Import]
internal IViewTagAggregatorFactoryService _aggregator = null;
[Import]
internal IClassificationFormatMapService _formatMap = null;
private bool _isProcessing;
public ITagger<T> CreateTagger<T>(ITextView textView, ITextBuffer buffer) where T : ITag
{
// Calling CreateTagAggregator creates a recursive situation, so _isProcessing ensures it only runs once per textview.
if (!IsSupportedBuffer(textView, buffer) || _isProcessing)
{
return null;
}
_isProcessing = true;
try
{
ITagger<T> result = buffer.Properties.GetOrCreateSingletonProperty(() => new RainbowTagger(textView, buffer, _registry, _aggregator, _formatMap)) as ITagger<T>;
(result as RainbowTagger)?.AddView(textView);
return result;
}
finally
{
_isProcessing = false;
}
}
private static bool IsSupportedBuffer(ITextView textView, ITextBuffer buffer)
{
bool result = false;
if (textView.TextBuffer == buffer) result = true;
// Sticky scroll container is allowed for colorization.
if (textView.Roles.Contains(CustomTextViewRoles.StickyScroll)) result = true;
// Inline diff editor is allowed for colorization. (but before and after codes are mixed and can looks weird)
if (textView.Roles.Contains(CustomTextViewRoles.InlineDiff)) result = true;
// Allow REPL text view for scripts.
if (textView.Roles.Contains(CustomTextViewRoles.Repl)) result = true;
// HTML/WebForms textview don't use HTML buffer but only HTMLProjection or WebFormsProjection.
if (IsSuportedHtmlTextBufferContentType(textView.TextBuffer.ContentType) && IsSupportedHtmlContentType(buffer.ContentType))
{
result = true;
}
return result;
static bool IsSuportedHtmlTextBufferContentType(IContentType contentType)
{
bool result = false;
if (contentType.IsOfType("HTMLProjection")) result = true;
if (contentType.IsOfType("WebFormsProjection")) result = true;
if (contentType.IsOfType("html-delegation")) result = true;
return result;
}
static bool IsSupportedHtmlContentType(IContentType contentType)
{
bool result = false;
if (contentType.IsOfType("HTML")) result = true;
if (contentType.IsOfType("Basic")) result = true;
if (contentType.IsOfType("CSharp")) result = true;
if (contentType.IsOfType("PHPProjection")) result = true;
if (contentType.IsOfType("Phalanger")) result = true;
if (contentType.IsOfType("WebForms")) result = true;
if (contentType.IsOfType("LegacyRazorCSharp")) result = true;
if (contentType.IsOfType("html-delegation")) result = true;
return result;
}
}
}
}