Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you force a call to ILineTransformSource.GetLineTransform in a VS extension for a change to a line adornments dimensions?

I 'm writing a Visual Studio extension where I'm creating line adornments that need to be resized when the user resizes the code view. I.e. when the user resizes Visual Studio's window width, I modify both the adornment's width and height. I'm handling the IWpfTextView.LayoutChanged event and I am resizing my adornments there. To avoid overlapping the adornments with the lines below it, I also implemented ILineTransformSource.GetLineTransform to enlarge the line's height to accommodate the size of the adornment.

However, when I change the dimensions of the adornments (when handling the IWpfTextView.LayoutChanged event) I'm not getting calls to my ILineTransformSource.GetLineTransform function to resize the line transform. This leaves the adornment overlapping the lines below it. I can't seem to find any way of forcing a call to ILineTransformSource.GetLineTransform. (Although, if the user scrolls the view, I do get these calls. But, I don't want to have to force the user to scroll the window to fix a visual glitch.)

Does anyone know of a way to force Visual Studio to call my ILineTransformSource.GetLineTransform so that I can resize the line transforms when my adornments change height?

like image 732
alexand256 Avatar asked Nov 04 '22 08:11

alexand256


1 Answers

Try calling the IWpfTextView.DisplayTextLineContainingBufferPosition method - this will force GetLineTransform calls as well.

like image 89
Alex Skorkin Avatar answered Nov 12 '22 13:11

Alex Skorkin