/vs-extensibility-skills:adding-quickinfo-tooltipsfrom vs-extensibility-skills
Adds custom hover tooltips (Quick Info) to the Visual Studio editor via VSSDK MEF components. Covers IAsyncQuickInfoSourceProvider and legacy IQuickInfoSourceProvider patterns.
Ships in vs-extensibility-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Quick Info provides hover tooltips when the user mouses over text in the editor. Common scenarios:
Hover tooltips are one of the most natural information-discovery gestures — developers instinctively mouse over unfamiliar symbols. Custom Quick Info providers deliver contextual information exactly when the developer needs it, without any explicit action.
When to use Quick Info vs. alternatives:
Any extension that uses MEF editor exports must declare the MEF asset type in the .vsixmanifest file. Without this, Visual Studio will not discover your MEF components and your Quick Info source will not load.
Add this inside the <Assets> element of source.extension.vsixmanifest:
<Asset Type="Microsoft.VisualStudio.MefComponent"
d:Source="Project"
d:ProjectName="%CurrentProject%"
Path="|%CurrentProject%|" />
The VisualStudio.Extensibility SDK does not currently support custom Quick Info sources. Hover tooltips are provided by in-process MEF components.
If you need custom Quick Info, use the VSSDK (in-process) MEF approach.
The Community Toolkit does not wrap the Quick Info API — use the standard VSSDK MEF pattern below.
Visual Studio has two Quick Info APIs:
IAsyncQuickInfoSourceProvider) — Visual Studio 15.6+, preferredIQuickInfoSourceProvider) — older API, deprecatedNuGet packages: Microsoft.VisualStudio.SDK, Microsoft.VisualStudio.Language.Intellisense
Key namespace: Microsoft.VisualStudio.Language.Intellisense
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
namespace MyExtension;
internal sealed class MyQuickInfoSource : IAsyncQuickInfoSource
{
private readonly ITextBuffer _buffer;
public MyQuickInfoSource(ITextBuffer buffer)
{
_buffer = buffer;
}
public Task<QuickInfoItem> GetQuickInfoItemAsync(
IAsyncQuickInfoSession session,
CancellationToken cancellationToken)
{
var triggerPoint = session.GetTriggerPoint(_buffer.CurrentSnapshot);
if (triggerPoint == null)
return Task.FromResult<QuickInfoItem>(null);
// Get the word under the cursor
var line = triggerPoint.Value.GetContainingLine();
string lineText = line.GetText();
int column = triggerPoint.Value.Position - line.Start.Position;
// Find word boundaries
int start = column;
while (start > 0 && char.IsLetterOrDigit(lineText[start - 1]))
start--;
int end = column;
while (end < lineText.Length && char.IsLetterOrDigit(lineText[end]))
end++;
string word = lineText.Substring(start, end - start);
// Look up tooltip content for the word
string tooltip = GetTooltip(word);
if (tooltip == null)
return Task.FromResult<QuickInfoItem>(null);
var applicableSpan = _buffer.CurrentSnapshot.CreateTrackingSpan(
line.Start + start, end - start, SpanTrackingMode.EdgeInclusive);
// Return a ContainerElement with rich content
var content = new ContainerElement(
ContainerElementStyle.Stacked,
new ClassifiedTextElement(
new ClassifiedTextRun(
PredefinedClassificationTypeNames.Keyword, word)),
new ClassifiedTextElement(
new ClassifiedTextRun(
PredefinedClassificationTypeNames.NaturalLanguage, tooltip)));
return Task.FromResult(new QuickInfoItem(applicableSpan, content));
}
private string GetTooltip(string word)
{
return word.ToUpperInvariant() switch
{
"SELECT" => "SQL keyword: Retrieves data from one or more tables.",
"FROM" => "SQL keyword: Specifies the table(s) to query.",
"WHERE" => "SQL keyword: Filters rows based on a condition.",
_ => null,
};
}
public void Dispose() { }
}
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
namespace MyExtension;
[Export(typeof(IAsyncQuickInfoSourceProvider))]
[Name("My Quick Info Source")]
[ContentType("text")]
[Order]
internal sealed class MyQuickInfoSourceProvider : IAsyncQuickInfoSourceProvider
{
public IAsyncQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
{
return textBuffer.Properties.GetOrCreateSingletonProperty(
() => new MyQuickInfoSource(textBuffer));
}
}
Quick Info supports rich content via ContainerElement and classified text:
using Microsoft.VisualStudio.Text.Adornments;
// Stacked (vertical) layout
var content = new ContainerElement(
ContainerElementStyle.Stacked,
new ClassifiedTextElement(
new ClassifiedTextRun(PredefinedClassificationTypeNames.Keyword, "MyKeyword"),
new ClassifiedTextRun(PredefinedClassificationTypeNames.WhiteSpace, " "),
new ClassifiedTextRun(PredefinedClassificationTypeNames.Type, "MyType")),
new ClassifiedTextElement(
new ClassifiedTextRun(
PredefinedClassificationTypeNames.NaturalLanguage,
"This is the description of the keyword.")),
new ImageElement(KnownMonikers.StatusInformation.ToImageId()));
// Wrapped (horizontal) layout
var horizontal = new ContainerElement(
ContainerElementStyle.Wrapped,
new ImageElement(KnownMonikers.Method.ToImageId()),
new ClassifiedTextElement(
new ClassifiedTextRun(PredefinedClassificationTypeNames.Identifier, "MyMethod()")));
| Classification | Typical Color |
|---|---|
PredefinedClassificationTypeNames.Keyword | Blue |
PredefinedClassificationTypeNames.Type | Teal |
PredefinedClassificationTypeNames.Identifier | Default text |
PredefinedClassificationTypeNames.Comment | Green |
PredefinedClassificationTypeNames.StringLiteral | Red/brown |
PredefinedClassificationTypeNames.NaturalLanguage | Default text |
PredefinedClassificationTypeNames.Number | Light green |
GetQuickInfoItemAsync runs on a background thread — safe to do I/O or computation.null to show no tooltip (let other providers handle it).ContainerElement and ClassifiedTextElement for rich, themed content.ImageElement with KnownMonikers for icons.[Order] attribute controls priority when multiple Quick Info sources exist..vsixmanifest — see the top of this document.IAsyncQuickInfoSourceProvider via MEF. Implement IAsyncQuickInfoSource.GetQuickInfoItemAsync to return tooltip content.source.extension.vsixmanifest.IAsyncQuickInfoSourceProvider), not the legacy IQuickInfoSourceProvider.null when your source has nothing to contribute..vsixmanifest. Verify [ContentType] matches the file type. Ensure GetQuickInfoItemAsync returns a non-null QuickInfoItem for the hovered span.QuickInfoItem with empty content. Return null instead when you have nothing to contribute.IQuickInfoSource or doing expensive work in GetQuickInfoItemAsync. Pre-compute and cache on a background thread.ClassifiedTextElement and proper classification types.[ContentType] attribute on the provider.Do NOT use the legacy
IQuickInfoSourceProvider/IQuickInfoSourceAPI — deprecated since VS 2017 (15.6). UseIAsyncQuickInfoSourceProvider/IAsyncQuickInfoSource. Old walkthroughs still show the legacy API; do not follow them.
Do NOT do heavy computation in
GetQuickInfoItemAsync— called on every hover. Run expensive analysis on a background thread and cache results.
Do NOT return an empty
QuickInfoItemwhen you have nothing to contribute — returnnullinstead. Empty items reserve tooltip space and interfere with other providers.
Do NOT forget the
MefComponentasset type in.vsixmanifest— without it, your provider is silently ignored.
Do NOT hard-code colors or font sizes in tooltip content — use
ClassifiedTextElementwith proper classification types to respect the user's theme.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
visual-studio-extension, quick-info, hover-tooltip, vssdk, mef
Generated from the plugin's indexed repository (madskristensen/vs-agent-plugins) — no native marketplace selected
npx claudepluginhub p/madskristensen-vs-extensibility-skills41 skills in this plugin
/adding-codelens-indicatorsAdd custom CodeLens indicators that display inline information above code elements in the Visual Studio editor. Use when the user asks how to add a CodeLens indicator, show inline data above methods or classes, create a custom CodeLens provider, implement IAsyncCodeLensDataPointProvider, display git history or test status in CodeLens, or add a details popup to CodeLens entries. Covers VSSDK / VSIX Community Toolkit (in-process + out-of-process CodeLens service). VisualStudio.Extensibility (out-of-process) does not have a dedicated CodeLens API./adding-commandsAdd commands (menu items, toolbar buttons) to Visual Studio extensions. Use when the user asks how to create a command, add a menu item, add a toolbar button, register a command handler, wire up a .vsct file, use KnownMonikers icons on buttons, or place commands in menus/toolbars in a Visual Studio IDE extension. Covers VisualStudio.Extensibility (out-of-process), VSIX Community Toolkit (in-process), and legacy VSSDK (in-process) approaches./adding-context-menusAdd native-looking context menus to custom WPF UI in Visual Studio extensions (tool windows, custom tree views, list views). Use when the user wants to show a right-click context menu from their own UI that looks native to VS. Covers defining VSCT context menus (type="Context"), grouping commands with separators, and programmatically showing them via IVsUIShell.ShowContextMenu. Do NOT use regular WPF ContextMenu — it won't match VS theming or support command routing. Covers VSSDK and VSIX Community Toolkit (in-process). VisualStudio.Extensibility (out-of-process) does not support VSCT-based context menus on custom UI.Other plugins' skills for the same job