VS 2008 HTML Editor and Document Outliner bug?

Last post 01-31-2008 4:19 PM by Dermot Hogan. 4 replies.

Sort Posts:

  • VS 2008 HTML Editor and Document Outliner bug?

    01-29-2008, 2:05 PM

    Hi,

    I have an HTML Editor embedded in a text editor and I'm trying to get the Document Outliner to work with both my custom text editor and the HTML Editor. I start off in my text editor and display my document outline in the Document Outline window. This works and I see my document outline displayed. I then switch to the HTML Editor  - and the HTML Document Outline is not displayed. This works in VS 2005

    The way I do this is to multiplex the Document Outliner by getting the IVsDocumentOutlineProvider interface from the HTML Editor and calling the HTML Editor on that interface if its frame is visible. If it isn't visible, I call my document outliner.

     I just dont get a GetOutline call from VS2008 as the HTML Editor frame is activated. However, I can get the outline displayed by its only after some switching back & forwards between the Document Outline and the HTML Editor. And I do then see the GetOutline call from VS 2008 and I call into the HTML Editor and get the outline to display. But this is prettty clunky to do and I don't get the correct logical view displayed.

    As I've said, this works fine in VS2005 - so I guess something has changed in VS2008. Is it a bug?

     

    Dermot

  • Re: VS 2008 HTML Editor and Document Outliner bug?

    01-29-2008, 5:13 PM

    I don't think this ia a bug since behavior can change between versions. We do not guarantee backward compatible behavior of the editor via VSIP interfaces. HTML outline implementation changed significantly in 2008. I guess I could help you to find a solution if you provide more information on what exactly are you trying to do with the HTML editor and document outline.

    Thanks

    ------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: VS 2008 HTML Editor and Document Outliner bug?

    01-29-2008, 5:56 PM

    Thanks!.Yes, I appreciate behaviour isn't guaranteed. But it sure looks like a bug to the end user!

    This is what I'm doing. I have a multitabbed editor which can switch between the HTML Editor and the core text editor. The core text Editor is wrapped in my editor object which implements IVsOLeCommandTarget, IVsCodeWindow, IVsDocOutlineProvider, etc. To switch, I first get the HTML Editor's frame and code window interfaces like this:

    logical = new Guid(LogicalViewID.Primary);
    ErrorHandler.ThrowOnFailure(uiShellOpenDocument.OpenSpecificEditor(0, htmlFileName, ref GuidList.guidHTMLEditor, null, ref logical, editorCaption.Caption(), pIVsUIHierarchy, itemId, docData, serviceProvider, out htmlFrame));
    ErrorHandler.ThrowOnFailure(htmlFrame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentFrame, _frame));
    ErrorHandler.ThrowOnFailure(htmlFrame.SetProperty((int)__VSFPROPID2.VSFPROPID_ParentHwnd, htmlControl.Handle));

    object o;
    r = htmlFrame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out o);
    htmlCodeWindow = (IVsCodeWindow)o;
    htmlDocOutlineProvider = (IVsDocOutlineProvider)htmlCodeWindow;

     I then show the frame (selecting the design/source view as required by the user) and the HTML Editor appears. Next, I implement the IVsDocumentProvider like this:

    int IVsDocOutlineProvider.GetOutline(out IntPtr phwnd, out IOleCommandTarget ppCmdTarget) {
    
       if (htmlFrame != null) {
          int r;
          r = htmlDocOutlineProvider.GetOutline(out phwnd, out ppCmdTarget);
          return r;
       } else {
          // do my stuff
         ppCmdTarget = this;
         phwnd = outliner.Handle;
         outliner.Refresh();
      }
    
     

    and similarly for the other parts of the IVsDocOutlineProvider interface. When the HTML Editor is closed, I set the htmlFrame to null and this allows me to display my Outliner rather than the HTML one.

    It all works rather nicely in VS2005 but not in VS2008!

     

    Dermot 

     

  • Re: VS 2008 HTML Editor and Document Outliner bug?

    01-30-2008, 7:52 PM
    Answer

    I think the reason is that HTML editor no longer provides separate outline for Source and Design views. In VS 2005 views were completely separate and each provided its own outline implementation. In VS 2008 both parts are working together (hence Split view is possible) and Document outline is driven by Source view (even if you are in Design view) Source is synchronized from Design all the time (no difference from Split view) so it is possible to have single implementation. Therefore GetOutline is called only once for all views. GetOutline does get called each time editor frame is activated when I click on the file tab in the IDE.

    Thanks

    ------------------------------------------------------------

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: VS 2008 HTML Editor and Document Outliner bug?

    01-31-2008, 4:19 PM

    OK. That explains why the behaviour is different between VS2005 & VS2008. But it doesn’t explain why it doesn’t work in VS 2008. I’ve done some careful experiments on the HTML Editor and this is what I get:

    a) If I open the HTML Editor in the primary logical view, I do get a call to GetOutline (which I route through to the HTML Editor and get a return status of zero. In fact both ReleaseOutline and GetOutline always succeed). If I open the HTML Editor in the Design view (or switch to the Design view before displaying the window), I do not get any such call. The Document Outline window is blank.

    b) On the other hand, opening the HTML Editor with the primary view, I get the the initial GetOutline call from VS (and pass it through to the HTML Editor) but the Document Outline window is completely blank. If I click in the HTML text, I do not get anything displayed in the Document Outline window.

    c) Now if I then click on the Document Outline tab itself, I get a single ‘document’ node displayed in the Document Outline (this is the name of my file). There is no outline tree. If I click on the this single document node, all of the text in the Source panel is highlighted but no tree is displayed in the Document Outline window. To get any sort of non-blank Document Outline, I always have to click on the Document Outline tab.

    d) If I then click on the Split/Design tab in the HTML Editor or in the HTML text, I get the correct tree displayed in the Document Outline. Once I get the full tree (by the above procedure) everything is ok (we are ‘synched’) until I move out of the HTML Editor – at which point we’re back to square one.

    It looks to me as if something is not being synchronized correctly.

    Dermot

Page 1 of 1 (5 items)
Microsoft Communities
Page view counter