Export (0) Print
Expand All

IVsUIShellOpenDocument3.SetNewDocumentState Method

Determines whether, on subsequent documents open calls like OpenStandardEditor, the document will be opened provisionally or permanently. Allows an entity that is far removed from the IVsUIShellOpenDocument calls that opened a document to control how it is opened–provisionally or permanently.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assemblies:   Microsoft.VisualStudio.Shell.Interop.11.0 (in Microsoft.VisualStudio.Shell.Interop.11.0.dll)
  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

IVsNewDocumentStateContext SetNewDocumentState(
	uint state,
	ref Guid reason
)

Parameters

state
Type: System.UInt32

[in] The state used for the next document to be opened.

reason
Type: System.Guid

[in] The reason the state is being set (typically this is a tool window or language service GUID).

The returned IVsNewDocumentStateContext is not intended to be long-lived; callers of this method should call Restore (or release the context) immediately after the document is opened.

If you call this method with NDS_Provisional and then start the process to open a file, the file will be opened even if provisional viewing is not enabled for the file or its editor. If you only want to open a file if you know that it will be opened provisionally, you should make that determination using either GetProvisionalViewingStatusForFile or GetProvisionalViewingStatusForEditor and only call this method and open the file if they indicate provisional viewing is enabled.

You can also open a file in the Visual Studio preview tab by placing the calls to open it within a using statement, see NewDocumentStateScope.

Show:
© 2014 Microsoft