Partager via


AuthoringScope.Goto Method

Definition

Returns a URI (Universal Resource Identifier) based on the current location in the source and the specified command.

public:
 abstract System::String ^ Goto(Microsoft::VisualStudio::VSConstants::VSStd97CmdID cmd, Microsoft::VisualStudio::TextManager::Interop::IVsTextView ^ textView, int line, int col, [Runtime::InteropServices::Out] Microsoft::VisualStudio::TextManager::Interop::TextSpan % span);
 abstract std::wstring Goto(Microsoft::VisualStudio::VSConstants::VSStd97CmdID cmd, Microsoft::VisualStudio::TextManager::Interop::IVsTextView const & textView, int line, int col, [Runtime::InteropServices::Out] Microsoft::VisualStudio::TextManager::Interop::TextSpan & span);
public abstract string Goto (Microsoft.VisualStudio.VSConstants.VSStd97CmdID cmd, Microsoft.VisualStudio.TextManager.Interop.IVsTextView textView, int line, int col, out Microsoft.VisualStudio.TextManager.Interop.TextSpan span);
abstract member Goto : Microsoft.VisualStudio.VSConstants.VSStd97CmdID * Microsoft.VisualStudio.TextManager.Interop.IVsTextView * int * int * TextSpan -> string
Public MustOverride Function Goto (cmd As VSConstants.VSStd97CmdID, textView As IVsTextView, line As Integer, col As Integer, ByRef span As TextSpan) As String

Parameters

cmd
VSConstants.VSStd97CmdID

[in] A value from the VSConstants.VSStd97CmdID enumeration that determines what kind of destination URI must be returned. This is the command the user entered, typically from a context menu.

textView
IVsTextView

[in] The IVsTextView object containing the text under the cursor.

line
Int32

[in] The line number containing the text under the cursor.

col
Int32

[in] The offset into the line containing the text under the cursor.

span
TextSpan

[out] A TextSpan object marking the selected text area for which the URI is determined.

Returns

If successful, returns a string containing the URI; otherwise, returns a null value.

Remarks

This method is called to return the location of a file that contains the definition, declaration, or reference of the text at the specified position. For example, if the user places the caret on a class name and selected Go to Declaration from the context menu, the URI that is returned contains the path to the file containing the declaration of that class and the returned TextSpan indicates the entire class name at the caret position.

In the default managed package framework implementation, this method is called from the Source class method <xref:Microsoft.VisualStudio.Package.Source.OnSyncGoto%2A> that in turn is called from the ViewFilter method HandleGoto that in turn is called in response to a user command to go to a declaration, definition, or reference. The Source class method <xref:Microsoft.VisualStudio.Package.Source.OnSyncGoto%2A> executes a parse operation with the reason Goto. If the parse operation returns an AuthoringScope object then this method is called to obtain the URI.

Applies to