Using EditorBrowsableState.Advanced

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 4 years ago by Esther Carbajo
Version: 19.1.0684
Avatar

Hello,

I am using the ActiPro SyntaxEditor control with the C#.Net language addon to read out all methods and properties of an assembly and display it in the syntax editor with intellisense when entering the correct namespace.

I also use the the EditorBrowsable Annotation to control showing specific methods/properties to the user.

Example from assembly:
/// <summary>
/// Access to PropertyA
/// </summary>
[EditorBrowsable(EditorBrowsableState.Always)]
public int PropertyA
{
get
{
return _PropertyA;
}

set
{
_PropertyA = value;
}
}

/// <summary>
/// Access to PropertyB
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public int PropertyB
{
get
{
return _PropertyB;
}

set
{
_PropertyB = value;
}
}

This works very well, so far no problems.

But now i want to make following changes and have no solution so far.

Implement a [EditorBrowsable(EditorBrowsableState::Advanced)] attribute to control if some methods/properties are shown under certain conditions.

(o = is shown; - = is not shown)

EditorBrowsableState visibility method xy visibility method xz
Never - -
Always o o
Advanced - o
not set o o

Is EditorBrowsable(EditorBrowsableState::Advanced)] attribute supported by ActiPro and how can i implement it?

Best regards

Esther

[Modified 4 years ago]

Comments (1)

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

Hi Esther,

Our .NET Languages Add-on's reflection mechanism will track [EditorBrowsable(EditorBrowsableState::Advanced)] and puts a boolean result for the presence of that attribute in ITypeDefinition.IsAdvanced and ITypeMemberDefinition.IsAdvanced.  You can examine those properties to know if the attribute was applied.

If you mean you want to adjust the completion list items that are displayed from their default, you could possibly make a class that inherits CSharpCompletionProvider and override the virtual OnSessionOpening method.  Then adjust the session.Items as appropriate.  You'd have to remove our default CSharpCompletionProvider language service from the syntax language, and install your custom one in its place.

I hope that helps.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.