Using EditorBrowsableState.Advanced

SyntaxEditor .NET Languages Add-on for WPF Forum

The latest build of this product (v2019.1 build 0684) was released 1 month ago, which was before this thread was created.
Posted 29 days 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 29 days ago]

Comments (1)

Posted 29 days 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

Add Comment

Please log in to a validated account to post comments.