Compartilhar via


ViewFilter.HandleGoto(VSConstants+VSStd97CmdID) Method

Definition

Handles VsCommands.GotoDefn, VsCommands.GotoDecl and VsCommands.GotoRef by calling OnSyncGoto on the Source object and opening the text editor on the resulting URL, then scrolling to the resulting span.

public:
 virtual void HandleGoto(Microsoft::VisualStudio::VSConstants::VSStd97CmdID cmd);
 virtual void HandleGoto(Microsoft::VisualStudio::VSConstants::VSStd97CmdID cmd);
public virtual void HandleGoto (Microsoft.VisualStudio.VSConstants.VSStd97CmdID cmd);
abstract member HandleGoto : Microsoft.VisualStudio.VSConstants.VSStd97CmdID -> unit
override this.HandleGoto : Microsoft.VisualStudio.VSConstants.VSStd97CmdID -> unit
Public Overridable Sub HandleGoto (cmd As VSConstants.VSStd97CmdID)

Parameters

cmd
VSConstants.VSStd97CmdID

[in] A value from the VSConstants.VSStd97CmdID enumeration specifying the type of "go to" command to execute. Expected values are GotoDefn, GotoDecl, and GotoRef.

Remarks

This method is called to handle a "go to" command. This method is responsible for obtaining the appropriate uniform resource identifier (URI) from the parser and then loading the requested document.

The base method calls the GetCaretPos method on the IVsTextView object passed to the ViewFilter constructor to obtain the current caret position. This position is then passed to the <xref:Microsoft.VisualStudio.Package.Source.OnSyncGoto%2A> method on the Source object (obtained from the CodeWindowManager object in the ViewFilter constructor). If <xref:Microsoft.VisualStudio.Package.Source.OnSyncGoto%2A> returned a valid URI then the URI is passed to the <xref:Microsoft.VisualStudio.Package.VsShell.OpenDocument%2A> helper method in the <xref:Microsoft.VisualStudio.Package.VsShell> class to open the document. If the document is successfully opened, the EnsureSpanVisible method is called followed by the SetSelection method to show the destination span in the loaded file.

In the default managed package framework implementation of the language service classes, this method is called from the HandlePreExec method.

Applies to