Roslyn: String Interpolation highlight issue

Created on 13 Feb 2017  Â·  11Comments  Â·  Source: dotnet/roslyn

Version Used:
VS 2017, VS 2015
C# 6.0

String interpolation does not highlight argument(s) if a string contains colon character ":". Please refer the screenshot for more info.

Actual Behavior

image

Expected Behavior

image

Area-IDE Bug Resolution-Duplicate

Most helpful comment

Perhaps, but {key} should not be interpreted as being part of the URL itself when inside an interpolated string, as any attempt to navigate to it will almost certainly fail.

All 11 comments

This has bothered me for ages. :') {key} should keep the underline (blue if possible) but be white.

It happens because the text editor has a URL classifier that uses a color that has a higher priority than most other colors.

A workaround if you don't like to see any highlighted links: disable "Enable single-click URL navigation" in Text Editor / C# / General.

@0xd4d I am talking about the argument highlighting issue not the URL.

@deepumi it's becuase of the URL classifier that the arguments are blue. Its color has higher priority than the other colors you see above. End result: blue text.

Perhaps, but {key} should not be interpreted as being part of the URL itself when inside an interpolated string, as any attempt to navigate to it will almost certainly fail.

I have internal bug 172884 tracking this as well, and @dpugh suggested:

• Import your own tagger provider instances and find a IUrlTagger with metadata that matches the original tagger (content type == text, tag type == IUrlTag, name == “UrlTagger”). Use this provider to create an instance of the original tagger when you create your specialized tagger.
• In your tagger implementation, pass any GetTags() call on to the original tagger.
• Examine the returned tags and exclude any that contain a $.

Or provide C#/VB aware URL tagger and deprecate the language-agnostic one? Perhaps Roslyn could opt out of it completely rather than going through the results and removing them afterwards, that sounds a bit like waste of user's time to me.

Can't Roslyn ignore colon character ":"?

@deepumi Roslyn is not doing it currently at all, it's a global Visual Studio feature.

@miloush Oh! got it. Thank you.

Duplicate of #5863

Was this page helpful?
0 / 5 - 0 ratings