ShaiGeva-7032 avatar image
0 Votes"
ShaiGeva-7032 asked PengGe-MSFT commented

Creating ImageElement from file to use as CompletionItem icon

I'm creating a visual studio extension that does auto-completions and I'm trying to set my own icon on completion items.

The CompletionItem class conveniently has an "icon" property that can be set using the constructor, and it accepts "ImageElement".

However, I can't find out how to create an ImageElement from a file (say, png).
The ImageElement constructor accepts a GUID, and in all the examples I could find, the GUID is the same well-known Microsoft class (Microsoft.VisualStudio.ImageCatalog).

How do I create an ImageElement with my own image?


· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for the response, but I can't find anything useful there.

The how-to is about XAML "Image" element, not about using
Microsoft.VisualStudio.Text.Adornments.ImageElement in C#. Different class in a different language, from what I can see.

The CompletionItem API is exactly my problem - it only says I need a
Microsoft.VisualStudio.Text.Adornments.ImageElement, but there are no examples on how to create one from a custom image file.

Thanks anyway.

0 Votes 0 ·

Hi, @ShaiGeva-7032
I searched for the ImageElement keyword, but did not find a sample of C# extension development. Most of the results are related to JavaScript and ASP.NET.

0 Votes 0 ·
Show more comments

0 Answers