ITypeDefinition from ITypeResolverResult

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

The latest build of this product (v23.1.1) was released 2 months ago, which was before this thread was created.
Posted 2 months ago by YEVGENIY A GRIGORYEV
Version: 23.1.1

Dear Actipro,

we are converting some of the remaining code that used the older WinForms Actipro libraries to the current.

The code in question runs in the context of OnSessionOpening of a custom CSharpCompletionProvider

If an ICompletionItem.Tag is an ITypeResolverResult, how can ITypeDefinition be obtained from the Tag? ITypeResolverResult.Type is an ITypeReference.

ITypeReference cannot be passed to IAssemblyDocumentation.GetDocumentation which expects an ITypeDefinition which we need to convert the code.

Thank you!

Comments (3)

Posted 2 months ago by YEVGENIY A GRIGORYEV

My apoligies, this should have been asked in DotNet laguages add-on. Appreicate your answer nevertheless!

[Modified 2 months ago]

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


ITypeDefinition inherits ITypeReference, so in cases where a type resolution completed, the ITypeResolver.Type will return an ITypeDefinition instance.  You can use code like "if (result.Type is ITypeDefinition typeDef) {" to test that.

Actipro Software Support

Posted 2 months ago by YEVGENIY A GRIGORYEV

Thank you, this worked.

Add Comment

Please log in to a validated account to post comments.