dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.99k stars 4.03k forks source link

The color of links when using the dollar sign operator is wrong #32836

Open sharwell opened 5 years ago

sharwell commented 5 years ago

Affected Branch: Affected Build: Affected Product Language:

🔗 Originally filed as https://devdiv.visualstudio.com/DevDiv/_workitems/edit/172884

Steps to reproduce:

  1. create a console app with the following
class Program
{
    static void Main(string[] args)
    {
        var x = "value";
        var text = $"http://test/{x}/test";
    }
}

expected: the link is not blue expected: clicking on the link does nothing actual: this link is blue actual: clicking on the link takes you to the url

sharwell commented 5 years ago

@olegtk and David Pugh provided some information about a possible approach (comment from late 2015 may be out of date):

Yes, you can override the default URL tagger by defining your own tagger export with the following metadata:

[Export(typeof(ITaggerProvider))]
[ContentType(<C#, VB or whatever the base RoslynCode content type is>)]
[TagType(typeof(IUrlTag))]
[Name("UrlTagger")]
internal sealed class NewUrlTaggerProvider : ITaggerProvider

Since the new URL tagger has the same name as the default tagger and a more specific content type, it will be instantiated (instead of the default tagger) for C#/VB/whatever files.