Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd custom editor windows to Visual Studio window panes
    primarykey
    data
    text
    <h1>My Problem</h1> <p>I'm trying to build an extension to Visual Studio that allows code to be edited on a per-function basis, rather than a per-file basis. I'm basically attempting to display code in a similar fashion to <a href="http://visualstudiogallery.msdn.microsoft.com/4a979842-b9aa-4adf-bfef-83bd428a0acb" rel="nofollow noreferrer">Microsoft Debugger Canvas</a>.</p> <p>I'm wondering how to host multiple Visual Studio editors within a single window (I believe the windows are implementing IVsWindowFrame). The functionality I'm after can be seen below:</p> <p><img src="https://i.stack.imgur.com/1ldeN.png" alt="Microsoft Debugger Canvas"></p> <p>Each editor window retains typical functionality and interacts with third-party extensions as expected. (For example, VsVim functions correctly within these windows).</p> <h1>What I've Tried</h1> <p>I've spent almost two weeks researching and trying this stuff and I'm having a lot of trouble figuring out which services, interfaces and classes I'm going to be using.</p> <h3>Reading through MSDN</h3> <p>First off, most of the <a href="http://msdn.microsoft.com/en-us/library/dd885122.aspx" rel="nofollow noreferrer">documentation</a> discusses how to edit a single editor window and add adornments, tags, margins etc. It doesn't discuss the possibility of spawning multiple editors within a window pane.</p> <p>I've looked through the documentation on a vast number of interfaces of interest to me including <code>IVsTextBuffer</code>, <code>IVsTextView</code> and <code>IVsInvisibleEditor</code>. Unfortunately I can't get some of these interfaces to play nicely together. </p> <p>On top this, the usually excellent MSDN is extremely lacking in this area. Many of the interfaces contain only a list of members without even a basic remark on intended use and functional. (<a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.componentmodelhost.icomponentmodel.aspx" rel="nofollow noreferrer">IComponentModel</a>, for example).</p> <p>Many of the interfaces make reference to a set of <a href="http://msdn.microsoft.com/en-us/library/bb165405%28v=vs.80%29.aspx" rel="nofollow noreferrer">Editor Samples</a> but the code cannot be read or downloaded on MSDN. Apparently it shipped with Visual Studio 2005, but I don't have this version of Visual Studio, nor can I find it.</p> <h3>Interacting with IVsUIShell</h3> <p>I can get access to all WindowFrames open using <code>IVsUIShell.GetDocumentWindowEnum();</code> I see there is an <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuishell.createdocumentwindow%28v=vs.80%29.aspx" rel="nofollow noreferrer">IVsUiShell.CreateDocumentWindow()</a> method, but I'm completely unfamiliar with the parameters it accepts, or if this is the correct path to go down.</p> <h1>What I need to do</h1> <ol> <li>Programatically create a dockable window pane</li> <li>Programatically add editors to this window pane. (And ensure they're correctly registered within Visual Studio, the running document table, etc.)</li> </ol> <p><strong>Edit:</strong></p> <p>I'm sorry, I should have expanded on my steps. When I said I needed to register with the running document table and Visual Studio, it's because I want to actually edit the original document in my custom editor. Below is a short example of the functionality available in Debugger Canvas that I'm trying to recreate:</p> <p><a href="https://i.imgur.com/aYm8A5E.gif" rel="nofollow noreferrer">http://i.imgur.com/aYm8A5E.gif</a> (I can't embed a .gif)</p> <p>Alternatively:</p> <p>If anyone knows where I can find the editor samples included with Visual Studio 2005 such as the <a href="http://msdn.microsoft.com/en-us/library/bb165316%28v=vs.80%29.aspx" rel="nofollow noreferrer">Basic Editor Sample</a> I'm sure I could figure this stuff out. The MSDN documentation has no code samples regarding these interfaces, which has made my job extremely difficult.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload