ITypeDefinition from ITypeResolverResult

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 2 years ago by YEVGENIY A GRIGORYEV
Version: 23.1.1
Avatar

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 years ago by YEVGENIY A GRIGORYEV
Avatar

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

[Modified 2 years ago]

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

Hello,

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 years ago by YEVGENIY A GRIGORYEV
Avatar

Thank you, this worked.

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

Add Comment

Please log in to a validated account to post comments.