I would like to create an SQL Server Management Studio v18 extension that opens from the execution plan window. I believe that this is technically possible because there is a third party tool that already does this:
So far, I've been able to create a basic extension in SSMS v18 using the guide located here. I was also able to move the placement of the button by referencing the IDs in the documentation. However, I can't figure out how to modify the .vsct file in order to move my button to be within the execution plan window.
How can I create an SSMS extension that opens from the execution plan window?

I figured it out.
In the
<Symbols>element of the *.vsct file addThen change
to
as described here.
(You may also want to set the
priorityon the parent<Groupelement to0x0001if eager to see your extension higher up in the menu)My mechanism for determining the magic Guid was initially quite laborious and is in the edit history for this Answer but a somewhat less laborious method would be to do set the registry key
And then open SSMS, get an execution plan and Ctrl + Shift + Right click to bring up a message box as below (128 decimal is
0x80).Now what?
It wasn't immediately apparent to me how to do anything useful inside the menu click event so I think it is informative to add an example.
As a POC I tried to colour nodes with a subtree cost above a threshold and/or where the underlying execution plan operators met some potentially problematic conditions.
For this I changed the code in the
Executemethod in the template generated code tothis relies on the following nested class