visual-studiovsxvisual-studio-sdk

Visual Studio extension: How to make editor text behave like a link


I would like to write a Visual Studio extension, that makes a part of the text behave like a link: blue, underlined on hover, open a URL on click. (Like the default editor works for http://... texts.)

I can do classification (coloring) and also custom adornments and commands, so I could probably make this "manually", but I wonder if there is an easier way to do that.

I am interested to do this in normal Visual Studio (2017 or newer), not VS Code.


Solution

  • You can use UrlTag.

    On how to use tags see Walkthrough: Highlight text and Visual Studio 2017 Extension development tutorial part 5: Highlight code in Editor.