locked
Getting active document in Visual Studion Diff Tool RRS feed

  • Question

  • I call visual studio internal tool using this method http://msdn.microsoft.com/en-us/library/hh582580.aspx. When left document has focus and cursor DTE.ActiveDocument always refers to right document and I can't determine active document. Maybe I have to use other way (not DTE) for getting active document?
    • Edited by MstislavS Wednesday, December 3, 2014 9:14 AM
    Wednesday, December 3, 2014 9:13 AM

All replies

  • Hi MstislavS,

    When you use the Diff Tool of Visual Studio, it actually makes a copy of one document, then open the other document. The opened document is the real active document, but the copied one is a "fake" document. Seems like that the VS IDE creates a layer on the opened document, it just display the copied document in the opened document in readonly mode. That means you can only modify the real active document.

    To change the real active document, the easiest way is to change the order of the file path parameters. For example, change "leftFileMoniker" to "rightFileMoniker", and "rightFileMoniker" to "leftFileMoniker".


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 8, 2014 9:14 AM
  • Thank you for reply. When one file is always read only how I can disable read only mode (without changing file monikers) or it is impossible? Maybe I have to use parameter 'roles' when I call IVsDifferenceService.OpenComparisonWindow2 http://msdn.microsoft.com/en-us/library/hh582580(v=vs.110).aspx method. Tell me please what values take this parameter and what does it mean more exactly? I can't find any examples with using 'roles' parameter. Thank you for reply.
    Tuesday, December 9, 2014 4:25 PM