Applies to Visual Studio 2017.6 and newer
This sample shows how to provide an Async QuickInfo provider in a Visual Studio extension.
Clone the repo to test out the sample in Visual Studio 2017 yourself.
Since Async QuickInfo support is new in Visual Studio 2017 Update 6, we need to specify that our extension requires that version or newer. We do that in the .vsixmanifest file like so:
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0.27413, 16.0)" />
15.0.27413 is the full version string of Visual Studio 2017 Update 6.
See the full sample .vsixmanifest file.
The code in this sample shows a tool tip (aka. QuickInfo) displaying the current line number. It uses the new IAsyncQuickInfoSourceProvider
interface which is a simple MEF component.
[Export(typeof(IAsyncQuickInfoSourceProvider))]
[Name("Line Async Quick Info Provider")]
[ContentType("any")]
internal sealed class LineAsyncQuickInfoSourceProvider : IAsyncQuickInfoSourceProvider
{
public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
{
return textBuffer.Properties.GetOrCreateSingletonProperty(() => new LineAsyncQuickInfoSource(textBuffer));
}
}
See the full IAsyncQuickInfoSourceProvider in the source.
Read the docs for all the details surrounding these scenarios.