I've come across cases where the Visual Studio C# editor displays extra UI and/or data:
- The debugger breakpoints configuration introduced in VS 2015 - see here.
- Ozcode, which augments the editor with debug-time values.
I'd like to do something similar, but don't know which Visual Studio APIs to use. I've come across these Visual Studio extensibility technologies:
- Debugger Visualizers: allows a custom visualizer to be written in C#, but seems to require the output to be in a modal pop-up dialog. Therefore this does not seem to be the right framework.
- Projection Buffers: Seems promising but not sure if this is can be used to augment the primary editor window, as opposed to creating an entirely custom editor window.
So the question is, how can I write code that adds custom debug information to a Visual Studio editor at debug time?
Look at Editor Text Adornment that adds WPF visuals within the text, relative to individual characters and Editor Viewport Adornment that adds UI to the text editor itself.
For examples see Intra-Text Adornment Sample and Typing Speed Meter Sample.
来源:https://stackoverflow.com/questions/38958099/how-to-augment-the-visual-studio-c-sharp-editor-with-non-textual-information