AuthoringScope.Goto Method
Returns a URI (Universal Resource Identifier) based on the current location in the source and the specified command.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Syntax
'宣言
Public MustOverride Function Goto ( _
cmd As VSConstants..::..VSStd97CmdID, _
textView As IVsTextView, _
line As Integer, _
col As Integer, _
<OutAttribute> ByRef span As TextSpan _
) As String
'使用
Dim instance As AuthoringScope
Dim cmd As VSConstants..::..VSStd97CmdID
Dim textView As IVsTextView
Dim line As Integer
Dim col As Integer
Dim span As TextSpan
Dim returnValue As String
returnValue = instance.Goto(cmd, textView, _
line, col, span)
public abstract string Goto(
VSConstants..::..VSStd97CmdID cmd,
IVsTextView textView,
int line,
int col,
out TextSpan span
)
public:
virtual String^ Goto(
VSConstants..::..VSStd97CmdID cmd,
IVsTextView^ textView,
int line,
int col,
[OutAttribute] TextSpan% span
) abstract
abstract Goto :
cmd:VSConstants..::..VSStd97CmdID *
textView:IVsTextView *
line:int *
col:int *
span:TextSpan byref -> string
public abstract function Goto(
cmd : VSConstants..::..VSStd97CmdID,
textView : IVsTextView,
line : int,
col : int,
span : TextSpan
) : String
Parameters
- cmd
Type: Microsoft.VisualStudio.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
Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextView
[in] The IVsTextView object containing the text under the cursor.
- line
Type: System.Int32
[in] The line number containing the text under the cursor.
- col
Type: System.Int32
[in] The offset into the line containing the text under the cursor.
- span
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan%
[out] A TextSpan object marking the selected text area for which the URI is determined.
Return Value
Type: System.String
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 OnSyncGoto(VSConstants.VSStd97CmdID, IVsTextView, Int32, Int32, TextSpan%) 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 OnSyncGoto(VSConstants.VSStd97CmdID, IVsTextView, Int32, Int32, TextSpan%) 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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.