Inter-Line Adornments (like VS CodeLens) Brainstorming

Posted 2 years ago by Avatar Actipro Software Support - Cleveland, OH, USA

We are beginning to investigate adding a feature to SyntaxEditor that would allow you to reserve space above or below lines so that custom adornments can render in those spaces.

Example usages of this kind of feature in Visual Studio are CodeLens (references, changes, etc. listing above type/member declaration lines) and Peek Definition (shows a nested code editor).

We started this thread since there have been many requests for this feature and we wanted to have a way to communicate with and get feedback from everyone in one central location. Please feel free to offer up ideas and jump in with comments.


I think everyone can agree that some sort of text range tagging mechanism is appropriate for this feature. We currently have an IIntraTextSpacerTag interface with Baseline, Key, and Size properties on it. That tag can reserve space between text characters and then you can render adornments in that space. This is shown in our AdornmentsIntraTextNotes QuickStart.

The Visual Studio API has a SpaceNegotiatingAdornmentTag that is similar in concept to our IIntraTextSpacerTag and allows for intra-text spacing and adornments. That tag can also reserve space above or below a line. However when investigating more, it seems like it is NOT used (at least any more) for the VS CodeLens and Peek Definition features, and an InterLineAdornmentTag is used for those instead.

InterLineAdornmentTag is only focused on providing some vertical space either above or below a line. There also seems to be a more basic ILineTransformSource that can reserve space too.


Have any of you worked with these VS APIs and do you have any input on why they are separate?

How would you like to see it implemented in our product? Should we just add features to IIntraTextSpacerTag (like TopMargin and BottomMargin properties that wouldn't affect text layout on the line) or add another tag for this feature?

Should "top" space be above the line containing the start offset of the tagged range, and "bottom" space be below the line containing the end offset of the tagged range?

If you have multiple tags reserving space for the same line, how would you ensure that UI’s don’t overlay each other?

Would the “top” space be a sum of all top space requested for a line or just the highest top space amount requested?

Actipro Software Support

Comments (15)

Posted 2 years ago by William Lucking - Owner, Ephron Inc

For simplicity sake, I think adding the option to the existing IIntraTextSpacerTag is probably the best idea.  To ensure the tags do not overlay supply a measurement of the text span for which the tag is related and allow the developer to decide whether it will overlay or allow them to resize their UiElement that they intend to place in the margin.  It should be the highest top space.

[Modified 2 years ago]

Posted 2 years ago by Erwin Liong

Hi Actipro, 


Would this change be made available in an upcoming release? 

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Erwin,

We were hoping to get some customer feedback on the questions above, but haven't gotten much feedback yet.  We just finished another high priority project (updating our .NET Languages Add-ons to support C# 6 and VB 14), and should have time to brainstorm the inter-line adornment feature more now.  We still would like to get feedback on the questions above from you, our customers, though.

Actipro Software Support
Posted 2 years ago by Xinen Lee

Hi, here are our requirements:

- What we need is to be able to set a space between lines.

- We need to set the inter-line space only for certain lines, not all.

This is because we have implemented our feature using the intra-text adornment feature, however we ended up with very ugly side effects (as listed in due to the line becoming too tall. They include:

  1. caret is too long - it extends to the bottom where the adorners are
  2. when line is selected, the whole area including the bottom adorner space is highlighted
  3. when Display Whitespace is switched on, the whitespace characters are pushed down since they are rendered in the middle of the new taller line
  4. outlining '+' symbol is pushed down to be in the middle of the new taller line
  5. collapsed outlining region is displayed in middle of new taller line
  6. squiggly lines appear right at the bottom of the taller line
  7. code snippet fields become very tall

By allowing us to specify a space between lines for certain lines, we will be able to address the above issues.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA


What kinds of adornments does everyone want to place in the space between lines? 

Also, where would the data come from for this kind of feature?  Would it be based on text/token scanning or by examining an AST?

This sort of information will help us determine how best to implement the adornments feature.

Actipro Software Support
Posted 2 years ago by William Lucking - Owner, Ephron Inc

I would think we'd be offered the ability to add any UiElement.  I think the text/token scanning is best because that is how Visual Studio's technqiue works, but I'd accept other approaches too.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi William,

Any UIElement will be supported.  I am curious if you have any info on how the VS technique works.  We are working on a QuickStart here where it's showing a Code Lens type adornment above the start of any type declaration.  Our implementation is based on examining the AST though, which comes through asynchronously when parsing completes.

[Modified 2 years ago]

Actipro Software Support
Posted 2 years ago by William Lucking - Owner, Ephron Inc

As each line is being drawn a function is called allowing the transformation of the line with the new margins.  So, it is a text parsing deal to determine if the line is one of them you want to change its top/bottom margin and what adornment you want to place in that otherwise empty space.  I think you get measurements so you can place the adornment in the desired horizontal location and since you set the margin you already know your vertical space.  Of course, you can draw over other elements, but that seems fair.  

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

We are looking to collect a list of beta testers for the intra-line adornments features we are adding.  If you would like to work with preview builds of our implementation of these features to help ensure that what we make meets your needs, please write our support address.  We will add you to a beta tester list and give you early access to the intra-line adornments functionality.

Actipro Software Support
Posted 2 years ago by Xinen Lee

Hi Actipro

Thanks for the beta build! It's looking good. 

One thing that we will need, is for the adornments that are within a region, to be collapsed within it when the region is collapsed.


public interface AnInterface {
codelens adornment on bottom


Where "codelens adornment on bottom" is the Code Lens adornment attached below the line "public interface AnInterface {", when this region is collapsed, I would expect the "codelens adornment on bottom" to be hidden as if it was collapsed within the region.

If the adornment was on top, we would probably not want to collapse it. May need some property to define whether we want to collapse it?

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Xinen,

We can only really hide the adornment if your tagged range is within a collapsed text range.  Thus if your collapsed range is just the "{...}" portion but you are tagging at the start of the "public" keyword, that will never hide.  If you tag within the "{...}" instead, the adornment should hide if you collapse that outlining node.  But then of course you can't really align the text with the left of the "public" keyword.

You could possibly handle some of this yourself by keeping the tag where it is now, and not providing a tag (via your tagger) if you detect the "{...}" range is collapsed.  But from our side, I'm not sure we can do that kind of thing per the logic above since we have to go based on what tags you give us.

Actipro Software Support
Posted 2 years ago by Xinen Lee

Ok, I agree with the collapse/hiding behavior.

Posted 1 year ago by Erwin Liong

Hi Actipro, 


When will this functionality be made available? 


Thank you. 


Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA

Hello, it will roll out in the 2017.2 version, which is probably in the next month or two.

Actipro Software Support
Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA

We have the intra-line adornments feature wrapped up and ready to go for the upcoming 2017.2 version.  It has two new related samples, one for a Code Lens like UI and one for a Peek Definition like UI.

Actipro Software Support
Information The latest build of this product (2018.1 build 0673) was released 7 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.