0

I am trying decorate code lines with various metrics collected during an execution of a program. In order to do that I use VS extensibility and adornments layer. However it seems to be somewhat unstable and moves relative to the top of the document when the editor is scrolled and thus spoiling the alignment of code and the adornment. Also it is not always initialized in the top of the editor.

So how to anchor theadornment layer added to the code editor in Visual Studio 2010? I add a canvas into it by the folling way:

     _adornmentLayer = view.GetAdornmentLayer("CodeAdornment");
     _adornmentLayer.RemoveAllAdornments();
     Canvas.SetTop(myOwnCanvas, 0);
     adornmentLayer.AddAdornment(AdornmentPositioningBehavior.OwnerControlled, null, null, myOwnCanvas, null);

I start to have a feeling that it is a bug in the editor layouting.

honzajscz
  • 2,850
  • 1
  • 27
  • 29

1 Answers1

0

You might want to make a viewport adornment that will always be on the top of the editor. Otherwise, you might want to use AdornmentPositioningBehavior.TextRelative and give a span for the first line in the document.

gameweld
  • 1,319
  • 15
  • 21