using Microsoft.VisualStudio.Text.Editor; // Create a new IWpfTextView instance IWpfTextView textView = editorAdaptersFactoryService.CreateTextView(document.TextBuffer); // Use the IWpfTextView to set text textView.TextSnapshot.Insert(0, "Hello world!");
using Microsoft.VisualStudio.Text.Formatting; // Get the IAdornmentLayer from the IWpfTextView IWpfTextViewLineCollection textViewLines = textView.TextViewLines; IAdornmentLayer adornmentLayer = textViewLines.AdornmentLayer; // Create a new adornment and add it to the layer MyAdornment myAdornment = new MyAdornment(); adornmentLayer.AddAdornment(new SnapshotSpan(textView.TextSnapshot, 0, textView.TextSnapshot.Length), null, myAdornment);The IWpfTextView class is part of the Microsoft.VisualStudio.Text.Editor namespace, which is part of the Microsoft.VisualStudio.Text.Editor nuget package.