I'm trying to make an extension for Visual Studio 2015 that depends on the selected items in the Error List view.
I'm retrieving the list with the following code:
var errorList = this.dte2.ToolWindows.ErrorList as IVsTaskList2;
IVsEnumTaskItems items;
errorList.EnumSelectedItems(out items);
But my problem is now that i'm able to get the description (Text) but not the error code (HelpKeyword). The description do i get this way:
IVsTaskItem[] item = new IVsTaskItem[1];
while (items.Next(1, item, null) == 0)
{
string description;
item.get_Text(out description);
}
Hope someone can helped me on this as i'm quiet frustrated at the moment.
I was able to get this using a completely different approach:
var errorList = dte.ToolWindows.ErrorList as IErrorList;
var selected = errorList.TableControl.SelectedEntry;
if (selected != null)
{
object content;
if (selected.TryGetValue("errorcode", out content))
{
return (string)content;
}
}
This accesses the error window selected item as a table and just gets the correct column (the text column has key "text", BTW).
It certainly wasn't easy to figure this out. Thank you Microsoft for: 1) the almost total lack of documentation for any of this stuff, 2) completely breaking the interfaces that worked in VS2013, and 3) not simply adding the code as a property for ErrorItem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With