How to selectively exclude certain types from assembly?

SyntaxEditor .NET Languages Add-on for Silverlight Forum

Posted 8 years ago by Sergey
Avatar
Hi!
I need to add an assembly to be known by IntelliPromt, but I also need to exclude some types and/or namespaces from showing by IntelliPromt. Is it possible?

[Modified at 02/14/2012 12:14 PM]

Comments (10)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Sergey,

The easiest way to do that would be to mark those types with an EditorBrowsable attribute that indicates editors shouldn't show the type.


Actipro Software Support

Posted 8 years ago by Sergey
Avatar
Thank you a lot!
Could you tell about other possible ways too?
And how I can do this for compiled assemblies where I can change nothing?

[Modified at 02/14/2012 11:10 PM]
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Sergey,

The other option is for you to override the completion provider. For instance in C#, you'd create a class that inherits CSharpCompletionProvider then override its OnSessionOpening method. That is called immediately before display. You can add/remove completion session list items there.

Then you'll want to register your customer completion provider over the default one on the language:
language.RegisterService<CSharpCompletionProvider>(new MyCSharpCompletionProvider());


Actipro Software Support

Posted 8 years ago by Sergey
Avatar
Thank you, it's just what I need!
Posted 8 years ago by Sergey
Avatar
Another question.
I removed session item with text = "MyClass" and it works. But if I type "MyClass + dot" IntelliPromt shows "MyClass" members anyway. Is it possible to get full name of the item, for example "MyClass.MyMember" to detect "MyClass" in every resolving position?

I see that the item has a Tag property which contains full name of the item. But it's object type and I don't know which type I should cast it to. Debugger shows obfuscated name of that type. Is there another way to get item full name?
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Sergey,

The Tag property of each item should be an IResolverResult for this add-on. There are various possibilities of interfaces that inherit IResolverResult for each instance, such as ITypeMemberResolverResult. If it is a ITypeMemberResolverResult, you can look at the Member property to see which member it is and which declaring type.


Actipro Software Support

Posted 6 years ago by William Sardar
Avatar

Hi

I read above

You can add/remove completion session list items there.

Could you explain the best way to create these items for a given namespace or type?

Thank you

William

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

Hi William,

Per the post that mentioned that, you can override the OnSessionOpening method.  That method is passed the session instance.  In your override, update the session.Items collection by adding items.  You'll have to manually create the items though.  Some of our IntelliPrompt completion QuickStarts show how to do that.  After that, call the base.OnSessionOpening method.  Then be sure to register your custom completion provider as indicated in our post above.


Actipro Software Support

Posted 6 years ago by William Sardar
Avatar

Thank you for the quick reply.

Actually I mentioned to do it. I did only need to filter out items.

I have another question., The ICompletionItem items have a Tag property.

It looks like ActiPro automatically populates this with interesting and useful information about the types, namespaces, etc. that are automatically populated into the item collection.

However the Tag types have been obfuscated and Reflection is needed to access them. This seems bizarre - am I missing something?

 

Thank you

William

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

Hi William,

I believe in general those will all be IResolverResult and its derivative types in the ActiproSoftware.Text.Languages.DotNet.Resolution namespace.  So by looking at those you can get info such as the type definition for ITypeResolverResult's, etc.


Actipro Software Support

The latest build of this product (v2018.1 build 0233) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.