Share via


IVsProjectAsyncOpen.OpenItemAsync(UInt32, Guid, Boolean, Object) Method

Definition

Asynchronously opens an item in the project.

public Microsoft.VisualStudio.Shell.Interop.IVsTask OpenItemAsync (uint itemId, Guid logicalView, bool shouldGetDocDataFromRdt, object? docData);
abstract member OpenItemAsync : uint32 * Guid * bool * obj -> Microsoft.VisualStudio.Shell.Interop.IVsTask
Public Function OpenItemAsync (itemId As UInteger, logicalView As Guid, shouldGetDocDataFromRdt As Boolean, docData As Object) As IVsTask

Parameters

itemId
UInt32

Identifier of the item to open. Should be VSITEMID_ROOT or other valid item identifier. See the VSITEMID enumeration.

logicalView
Guid

Unique identifier of the logical view. If not GUID_NULL, indicates a specific type of view to create. For more information, see the LOGVIEWID.

shouldGetDocDataFromRdt
Boolean

If true, then the environment will use the doc data object obtained from the Running Document Table; otherwise, the service will open the document using the doc data passed in to docData.

docData
Object

A reference to the document data object of the item to open or null. This value passed into this parameter is ignored if shouldGetDocDataFromRdt is true.

Returns

A task representing the open operation. The result of the task is an IVsAsyncOpenDocumentResult for the opened item.

Remarks

By implementing IVsProjectSpecificEditorMap2 interface on your project object, you can do project-specific handling of files. That is, you can support either opening the file in a project-specific editor or allowing the global editor to open the item. Opening an item requires launching an editor using OpenStandardEditorAsync(...) or OpenSpecificEditorAsync(...), depending on the handling you want to implement. For more information, see GetSpecificEditorProperty.

NOTE: In your implementation of OpenItemAsync(UInt32, Guid, Boolean, Object), do not call Show() on the window frame you return.

Compare to ReopenItemAsync(UInt32, Guid, String, Guid, Boolean, Object)

The task returned by this method does not indicate that the document's view and docdata have been loaded. See DocumentLoadTask for more details.

Applies to