ITypeDefinition from ITypeResolverResult

SyntaxEditor .NET Languages Add-on for Windows Forms Forum

Posted 1 year 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 1 year ago by YEVGENIY A GRIGORYEV
Avatar

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

[Modified 1 year ago]

Answer - Posted 1 year 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 1 year ago by YEVGENIY A GRIGORYEV
Avatar

Thank you, this worked.

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.